#include <swconfig.h>
Public Methods | |
SWConfig (const char *ifilename) | |
Constructor of SWConfig. More... | |
virtual | ~SWConfig () |
virtual void | Load () |
Load from disk Load the contzent from disk. | |
virtual void | Save () |
Save to disk Save the content of this config object to disk. | |
virtual SWConfig & | operator+= (SWConfig &addFrom) |
Merges the values of addFrom. More... | |
virtual ConfigEntMap & | operator[] (const char *section) |
Get a section This is an easy way to get and store config values. More... | |
Public Attributes | |
string | filename |
The filename used by this SWConfig object. | |
SectionMap | Sections |
Map of available sections The map of available sections. | |
Private Methods | |
char | getline (FILE *fp, string &line) |
Definition at line 44 of file swconfig.h.
|
Constructor of SWConfig.
Definition at line 27 of file swconfig.cpp. References filename, and Load.
|
|
Merges the values of addFrom.
Definition at line 134 of file swconfig.cpp. References Sections.
00135 { 00136 00137 SectionMap::iterator section; 00138 ConfigEntMap::iterator entry; 00139 00140 for (section = addFrom.Sections.begin(); section != addFrom.Sections.end(); section++) { 00141 for (entry = (*section).second.begin(); entry != (*section).second.end(); entry++) { 00142 Sections[(*section).first].insert(ConfigEntMap::value_type((*entry).first, (*entry).second)); 00143 } 00144 } 00145 return *this; 00146 } |
|
Get a section This is an easy way to get and store config values.
The following will work:
SWConfig config("/home/user/.setttings"); config["Colors"]["Background"] = "red"; Definition at line 148 of file swconfig.cpp. References Sections.
00148 { 00149 return Sections[section]; 00150 } |