feisty meow concerns codebase  2.140
section_manager.h
Go to the documentation of this file.
1 #ifndef SECTION_MANAGER_CLASS
2 #define SECTION_MANAGER_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : section_manager *
7 * Author : Chris Koeritz *
8 * *
9 *******************************************************************************
10 * Copyright (c) 2000-$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 
21 
22 namespace configuration {
23 
25 
34 class section_manager : public virtual basis::nameable
35 {
36 public:
38  const basis::astring &header_prefix);
40 
57 
58  DEFINE_CLASS_NAME("section_manager");
59 
60  bool section_exists(const basis::astring &section_name);
62 
65 
68  bool add_section(const basis::astring &section_name, const structures::string_table &to_add);
70 
72  bool replace_section(const basis::astring &section, const structures::string_table &replacement);
74 
76  bool zap_section(const basis::astring &section_name);
78 
80  bool find_section(const basis::astring &section_name, structures::string_table &found);
82 
85  configurator &config() { return _config; }
87 
93 
96 
98 private:
99  configurator &_config;
100  basis::astring *_toc_title;
101  basis::astring *_section_prefix;
102 
104  section_manager &operator =(const section_manager &);
106 };
107 
108 } //namespace.
109 
110 #endif
111 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
Root object for any class that knows its own name.
Definition: contracts.h:123
Provides a base class for configuration repositories.
Definition: configurator.h:34
Tracks a collection of related configurations in a configurator.
basis::astring make_section_heading(const basis::astring &section)
provides the appropriate heading string for the "section" name.
DEFINE_CLASS_NAME("section_manager")
bool get_section_names(structures::string_array &sections)
loads the "sections" array with all section names.
section_manager(configurator &config, const basis::astring &toc_title, const basis::astring &header_prefix)
creates a section_manager that uses the "config" for storage.
bool add_section(const basis::astring &section_name, const structures::string_table &to_add)
stores a new section for "section_name" using the table "to_add".
bool get_toc(structures::string_table &toc)
reads the table of contents into "toc".
bool zap_section(const basis::astring &section_name)
removes the data for "section_name" from both the config and TOC.
bool section_exists(const basis::astring &section_name)
returns true if the section called "section_name" exists in the config.
bool replace_section(const basis::astring &section, const structures::string_table &replacement)
replaces the contents of "section" with the "replacement" table.
bool find_section(const basis::astring &section_name, structures::string_table &found)
loads the data from "section_name" into the table "found".
configurator & config()
allows access to the configurator we operate on.
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