structures::string_table Class Reference

Provides a symbol_table that holds strings as the content. More...

#include <string_table.h>

Inheritance diagram for structures::string_table:
Inheritance graph
[legend]
Collaboration diagram for structures::string_table:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 string_table (int estimated_elements=100)
 the "estimated_elements" specifies how many items to prepare to efficiently hold.
 string_table (const string_table &to_copy)
virtual ~string_table ()
 DEFINE_CLASS_NAME ("string_table")
string_tableoperator= (const string_table &to_copy)
bool operator== (const string_table &to_compare) const
virtual bool equal_to (const equalizable &to_compare) const
basis::astring text_form () const
 prints the contents of the table into the returned string.
virtual void text_form (basis::base_string &fill) const
 Provides a text view of all the important info owned by this object.
bool add_spaces () const
void add_spaces (bool add_them)
virtual int packed_size () const
 Estimates the space needed for the packed structure.
virtual void pack (basis::byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form".
virtual bool unpack (basis::byte_array &packed_form)
 Restores the packable from the "packed_form".

Static Public Member Functions

static bool is_comment (const basis::astring &to_check)

Detailed Description

Provides a symbol_table that holds strings as the content.

This is essentially a table of named strings.

Definition at line 28 of file string_table.h.


Constructor & Destructor Documentation

structures::string_table::string_table ( int  estimated_elements = 100  )  [inline]

the "estimated_elements" specifies how many items to prepare to efficiently hold.

Definition at line 34 of file string_table.h.

structures::string_table::string_table ( const string_table to_copy  ) 

Definition at line 26 of file string_table.cpp.

structures::string_table::~string_table (  )  [virtual]

Definition at line 33 of file string_table.cpp.


Member Function Documentation

void structures::string_table::add_spaces ( bool  add_them  )  [inline]

Definition at line 69 of file string_table.h.

bool structures::string_table::add_spaces (  )  const [inline]

Definition at line 68 of file string_table.h.

Referenced by configuration::ini_parser::restate().

structures::string_table::DEFINE_CLASS_NAME ( "string_table"   ) 
virtual bool structures::string_table::equal_to ( const equalizable &  to_compare  )  const [inline, virtual]

Definition at line 46 of file string_table.h.

References operator==().

bool structures::string_table::is_comment ( const basis::astring to_check  )  [static]

Definition at line 35 of file string_table.cpp.

References basis::astring::begins(), and STRTAB_COMMENT_PREFIX.

Referenced by text_form().

string_table & structures::string_table::operator= ( const string_table to_copy  ) 

Definition at line 38 of file string_table.cpp.

bool structures::string_table::operator== ( const string_table to_compare  )  const
void structures::string_table::pack ( basis::byte_array packed_form  )  const [virtual]

Creates a packed form of the packable object in "packed_form".

This must append to the data in "packed_form" rather than clearing prior contents.

Implements basis::packable.

Definition at line 84 of file string_table.cpp.

References structures::attach(), structures::symbol_table< basis::astring >::name(), structures::symbol_table< basis::astring >::operator[](), basis::astring::pack(), and structures::symbol_table< basis::astring >::symbols().

int structures::string_table::packed_size (  )  const [virtual]
virtual void structures::string_table::text_form ( basis::base_string state_fill  )  const [inline, virtual]

Provides a text view of all the important info owned by this object.

It is understood that there could be a large amount of information and that this function might take a relatively long time to complete.

Implements basis::text_formable.

Definition at line 64 of file string_table.h.

References text_form().

Referenced by text_form().

astring structures::string_table::text_form (  )  const

prints the contents of the table into the returned string.

if names in the table start with the comment prefix (see above), then they will not be printed as "X=Y" but instead as just "Y".

Definition at line 46 of file string_table.cpp.

References is_comment(), structures::symbol_table< basis::astring >::name(), and structures::symbol_table< basis::astring >::symbols().

Referenced by configuration::ini_parser::restate().

bool structures::string_table::unpack ( basis::byte_array packed_form  )  [virtual]

Restores the packable from the "packed_form".

This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.

Implements basis::packable.

Definition at line 93 of file string_table.cpp.

References structures::symbol_table< basis::astring >::add(), structures::detach(), structures::symbol_table< basis::astring >::name(), structures::symbol_table< basis::astring >::reset(), and basis::astring::unpack().


The documentation for this class was generated from the following files:
Generated on Sat Jan 28 04:26:00 2012 for hoople2 project by  doxygen 1.6.3