feisty meow concerns codebase  2.140
table_configurator.h
Go to the documentation of this file.
1 #ifndef TABLE_CONFIGURATOR_CLASS
2 #define TABLE_CONFIGURATOR_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : table_configurator *
7 * Author : Chris Koeritz *
8 * *
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 \*****************************************************************************/
17 
18 #include "configurator.h"
19 
20 #include <basis/contracts.h>
21 
22 namespace configuration {
23 
24 // forward.
25 class table_o_string_tables;
26 
28 
29 class table_configurator : public virtual configurator
30 {
31 public:
34 
38  table_configurator(const table_configurator &to_copy);
39 
40  virtual ~table_configurator();
41 
43 
44  DEFINE_CLASS_NAME("table_configurator");
45 
46  virtual void sections(structures::string_array &list);
48 
49  void reset(); // clears out all contents.
50 
51  virtual bool get(const basis::astring &section, const basis::astring &entry,
52  basis::astring &found);
54 
55  virtual bool put(const basis::astring &section, const basis::astring &entry,
56  const basis::astring &to_store);
58 
59  virtual bool section_exists(const basis::astring &section);
61 
62  virtual bool delete_section(const basis::astring &section);
64 
65  virtual bool delete_entry(const basis::astring &section, const basis::astring &entry);
67 
68  virtual bool get_section(const basis::astring &section, structures::string_table &info);
70 
71  virtual bool put_section(const basis::astring &section, const structures::string_table &info);
73 
74 private:
75  table_o_string_tables *_real_table;
77 };
78 
79 } //namespace.
80 
81 #endif
82 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
Provides a base class for configuration repositories.
Definition: configurator.h:34
treatment_of_defaults behavior() const
observes the behavior chosen for the load() function.
Definition: configurator.h:46
Supports the configurator interface using a collection of string tables.
virtual bool delete_entry(const basis::astring &section, const basis::astring &entry)
removes the entry specified by the "section" and "entry" name.
virtual bool put(const basis::astring &section, 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.
DEFINE_CLASS_NAME("table_configurator")
virtual void sections(structures::string_array &list)
retrieves the section names into "list".
virtual bool delete_section(const basis::astring &section)
removes the entire "section" specified.
virtual bool get(const basis::astring &section, const basis::astring &entry, basis::astring &found)
implements the configurator retrieval function.
virtual bool section_exists(const basis::astring &section)
true if the "section" is presently in the table config.
virtual bool put_section(const basis::astring &section, const structures::string_table &info)
writes a table called "info" into the "section" held here.
virtual bool get_section(const basis::astring &section, structures::string_table &info)
reads the entire table held under "section" into a table called "info".
table_configurator & operator=(const table_configurator &to_copy)
An array of strings with some additional helpful methods.
Definition: string_array.h:32
Provides a symbol_table that holds strings as the content.
Definition: string_table.h:32