feisty meow concerns codebase  2.140
ini_parser.h
Go to the documentation of this file.
1 #ifndef INI_PARSER_CLASS
2 #define INI_PARSER_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : ini_parser *
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 "table_configurator.h"
19 
20 namespace configuration {
21 
23 
74 {
75 public:
76  ini_parser(const basis::astring &to_parse,
79 
82  ~ini_parser();
83 
84  void reset(const basis::astring &to_parse);
86 
87  void add(const basis::astring &to_parse);
89 
94  bool well_formed() const { return _well_formed; }
96 
97  bool restate(basis::astring &new_ini, bool add_spaces = false);
99 
102  void merge_section(const basis::astring &section_name, const structures::string_table &to_merge);
104 
108 private:
109  bool _well_formed;
110  basis::astring *_preface;
111 
112  void chow_through_eol(basis::astring &to_chow);
114 
115  bool parse_section(basis::astring &to_parse, basis::astring &section_name);
117 
119 };
120 
121 } //namespace.
122 
123 #endif
124 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
treatment_of_defaults behavior() const
observes the behavior chosen for the load() function.
Definition: configurator.h:46
Parses strings in the fairly well-known INI file format.
Definition: ini_parser.h:74
void add(const basis::astring &to_parse)
merges items parsed from "to_parse" into the current set.
Definition: ini_parser.cpp:118
ini_parser(const basis::astring &to_parse, treatment_of_defaults behavior=RETURN_ONLY)
constructs an ini_parser by parsing entries out of "to_parse".
Definition: ini_parser.cpp:51
void merge_section(const basis::astring &section_name, const structures::string_table &to_merge)
merges the table "to_merge" into the "section_name".
Definition: ini_parser.cpp:162
bool well_formed() const
returns true if the ini file's contents were in the format expected.
Definition: ini_parser.h:94
bool restate(basis::astring &new_ini, bool add_spaces=false)
stores a cleaned version of the internal state into "new_ini".
Definition: ini_parser.cpp:220
Supports the configurator interface using a collection of string tables.
Provides a symbol_table that holds strings as the content.
Definition: string_table.h:32