22 using namespace basis;
28 #define LOG(to_print) printf("%s::%s: %s\n", static_class_name(), func, astring(to_print).s())
30 class table_o_string_tables :
public symbol_table<string_table>
39 _real_table(new table_o_string_tables)
44 _real_table(new table_o_string_tables)
55 if (
this == &to_copy)
return *
this;
59 for (
int sectindy = 0; sectindy < sects.
length(); sectindy++) {
61 astring curr_section = sects[sectindy];
64 put_section(curr_section, entries);
73 {
return !!_real_table->find(section); }
78 for (
int i = 0; i < _real_table->symbols(); i++)
79 to_fill += _real_table->name(i);
83 {
return _real_table->whack(section) == common::OKAY; }
89 if (!sect)
return false;
90 return sect->
whack(ent) == common::OKAY;
102 sect = _real_table->find(section);
104 sect->
add(entry, to_store);
113 if (!sect)
return false;
115 if (!looked)
return false;
176 if (!sect)
return false;
177 for (
int i = 0; i < sect->
symbols(); i++)
178 info.
add(sect->
name(i), (*sect)[i]);
190 sect = _real_table->find(section);
void reset(int number=0, const contents *initial_contents=NULL_POINTER)
Resizes this array and sets the contents from an array of contents.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
int length() const
Returns the current length of the string.
Provides a base class for configuration repositories.
Supports the configurator interface using a collection of string tables.
virtual bool delete_entry(const basis::astring §ion, const basis::astring &entry)
removes the entry specified by the "section" and "entry" name.
virtual bool put(const basis::astring §ion, const basis::astring &entry, const basis::astring &to_store)
implements the configurator storage function.
table_configurator(treatment_of_defaults behavior=AUTO_STORE)
Constructor just needs to know what to do for missing items.
virtual void sections(structures::string_array &list)
retrieves the section names into "list".
virtual bool delete_section(const basis::astring §ion)
removes the entire "section" specified.
virtual bool get(const basis::astring §ion, const basis::astring &entry, basis::astring &found)
implements the configurator retrieval function.
virtual bool section_exists(const basis::astring §ion)
true if the "section" is presently in the table config.
virtual bool put_section(const basis::astring §ion, const structures::string_table &info)
writes a table called "info" into the "section" held here.
virtual bool get_section(const basis::astring §ion, structures::string_table &info)
reads the entire table held under "section" into a table called "info".
virtual ~table_configurator()
An array of strings with some additional helpful methods.
Provides a symbol_table that holds strings as the content.
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".
contents * 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 contents &storage)
Enters a symbol name into the table along with some contents.
basis::outcome whack(const basis::astring &name)
removes a symbol from the table.
int symbols() const
returns the number of symbols listed in the table.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
A dynamic container class that holds any kind of object via pointers.