22 using namespace basis;
40 if (
this == &to_copy)
return *
this;
42 _add_spaces = to_copy._add_spaces;
49 const char *space_char =
"";
50 if (_add_spaces) space_char =
" ";
51 for (
int i = 0; i <
symbols(); i++) {
53 output +=
a_sprintf(
"%s\n",
operator[](i).s());
56 space_char,
operator[](i).s());
64 for (
int i = 0; i <
symbols(); i++) {
68 if (!str2)
return false;
69 if (*str1 != *str2)
return false;
76 int size =
sizeof(int);
77 for (
int i = 0; i <
symbols(); i++) {
87 for (
int i = 0; i <
symbols(); i++) {
98 for (
int i = 0; i < syms; i++) {
101 if (!content.
unpack(packed_form))
return false;
103 if (ret != common::IS_NEW)
return false;
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
void pack(byte_array &target) const
stores this string in the "target". it can later be unpacked again.
bool begins(const astring &maybe_prefix) const
Returns true if "this" string begins with "maybe_prefix".
int length() const
Returns the current length of the string.
bool unpack(byte_array &source)
retrieves a string (packed with pack()) from "source" into this string.
A very common template for a dynamic array of bytes.
Outcomes describe the state of completion for an operation.
Provides a symbol_table that holds strings as the content.
virtual bool unpack(basis::byte_array &packed_form)
Restores the packable from the "packed_form".
basis::astring text_form() const
prints the contents of the table into the returned string.
bool operator==(const string_table &to_compare) const
static bool is_comment(const basis::astring &to_check)
string_table & operator=(const string_table &to_copy)
virtual void pack(basis::byte_array &packed_form) const
Creates a packed form of the packable object in "packed_form".
virtual int packed_size() const
Estimates the space needed for the packed structure.
Maintains a list of names, where each name has a type and some contents.
const basis::astring & name(int index) const
returns the name held at the "index".
basis::astring * find(const basis::astring &name) const
returns the contents held for "name" or NULL_POINTER if it wasn't found.
basis::outcome add(const basis::astring &name, const basis::astring &storage)
Enters a symbol name into the table along with some contents.
basis::astring & operator[](int index)
provides access to the symbol_table's contents at the "index".
int symbols() const
returns the number of symbols listed in the table.
The guards collection helps in testing preconditions and reporting errors.
A dynamic container class that holds any kind of object via pointers.
void attach(byte_array &packed_form, const byte_array &to_attach)
Packs a byte_array "to_attach" into "packed_form".
bool detach(byte_array &packed_form, byte_array &to_detach)
Unpacks a byte_array "to_detach" from "packed_form".
#define STRTAB_COMMENT_PREFIX
anything beginning with this is considered a comment.