1 #ifndef TABLE_CONFIGURATOR_CLASS
2 #define TABLE_CONFIGURATOR_CLASS
4 /*****************************************************************************\
6 * Name : table_configurator *
7 * Author : Chris Koeritz *
9 *******************************************************************************
10 * Copyright (c) 2001-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
18 #include "configurator.h"
20 #include <basis/contracts.h>
22 namespace configuration {
25 class table_o_string_tables;
27 //! Supports the configurator interface using a collection of string tables.
29 class table_configurator : public virtual configurator
32 table_configurator(treatment_of_defaults behavior = AUTO_STORE);
33 //!< Constructor just needs to know what to do for missing items.
34 /*!< Creates a table_configurator that loads and stores entries into
35 the internal collection of tables. It will use the "behavior" regarding
36 missing entries when load() is invoked. */
38 table_configurator(const table_configurator &to_copy);
40 virtual ~table_configurator();
42 table_configurator &operator =(const table_configurator &to_copy);
44 DEFINE_CLASS_NAME("table_configurator");
46 virtual void sections(structures::string_array &list);
47 //!< retrieves the section names into "list".
49 void reset(); // clears out all contents.
51 virtual bool get(const basis::astring §ion, const basis::astring &entry,
52 basis::astring &found);
53 //!< implements the configurator retrieval function.
55 virtual bool put(const basis::astring §ion, const basis::astring &entry,
56 const basis::astring &to_store);
57 //!< implements the configurator storage function.
59 virtual bool section_exists(const basis::astring §ion);
60 //!< true if the "section" is presently in the table config.
62 virtual bool delete_section(const basis::astring §ion);
63 //!< removes the entire "section" specified.
65 virtual bool delete_entry(const basis::astring §ion, const basis::astring &entry);
66 //!< removes the entry specified by the "section" and "entry" name.
68 virtual bool get_section(const basis::astring §ion, structures::string_table &info);
69 //!< reads the entire table held under "section" into a table called "info".
71 virtual bool put_section(const basis::astring §ion, const structures::string_table &info);
72 //!< writes a table called "info" into the "section" held here.
75 table_o_string_tables *_real_table;
76 //!< the data structure we're actually operating on.