DUtils::ConfigFile Class Reference
Manages simple text-based configuration files.
More...
#include <ConfigFile.h>
List of all members.
Detailed Description
Manages simple text-based configuration files.
Constructor & Destructor Documentation
ConfigFile::ConfigFile |
( |
const char * |
filename, |
|
|
const FILE_MODES |
mode | |
|
) |
| | |
Creates a config file by opening a file
- Parameters:
-
| filename | |
| mode,: | READ or WRITE |
- Exceptions:
-
DUtils::ConfigFile::ConfigFile |
( |
const std::string & |
filename, |
|
|
const FILE_MODES |
mode | |
|
) |
| | |
Creates a config file by opening a file
- Parameters:
-
| filename | |
| mode,: | READ or WRITE |
- Exceptions:
-
Member Function Documentation
void ConfigFile::Close |
( |
|
) |
|
Closes any opened file. It is not necessary to call this function explicitly
template<class T >
T DUtils::ConfigFile::get |
( |
const char * |
name |
) |
const [inline] |
Gets data from the file. Returns 0 or similar if it does not exist
- Parameters:
-
template<class T >
T DUtils::ConfigFile::get |
( |
const std::string & |
name |
) |
const [inline] |
Gets data from the file. Returns 0 or similar if it does not exist.
- Parameters:
-
template<class T >
T DUtils::ConfigFile::getAnonymous |
( |
int |
n |
) |
const [inline] |
Gets anonymous data from the file. Returns 0 or similar if it does not exist
- Parameters:
-
| n | index of anonymous entry |
void ConfigFile::Init |
( |
const char * |
filename, |
|
|
const FILE_MODES |
mode | |
|
) |
| | [protected] |
void DUtils::ConfigFile::OpenForAppending |
( |
const std::string & |
filename |
) |
[inline] |
Opens a file for writing at the end. It closes any other opened file
- Parameters:
-
- Exceptions:
-
void ConfigFile::OpenForAppending |
( |
const char * |
filename |
) |
|
Opens a file for writing at the end. It closes any other opened file
- Parameters:
-
- Exceptions:
-
void DUtils::ConfigFile::OpenForReading |
( |
const std::string & |
filename |
) |
[inline] |
Opens a file for reading. It closes any other opened file
- Parameters:
-
- Exceptions:
-
void ConfigFile::OpenForReading |
( |
const char * |
filename |
) |
|
Opens a file for reading. It closes any other opened file
- Parameters:
-
- Exceptions:
-
void DUtils::ConfigFile::OpenForWriting |
( |
const std::string & |
filename |
) |
[inline] |
Opens a file for writing. It closes any other opened file
- Parameters:
-
- Exceptions:
-
void ConfigFile::OpenForWriting |
( |
const char * |
filename |
) |
|
Opens a file for writing. It closes any other opened file
- Parameters:
-
- Exceptions:
-
template<class T >
void DUtils::ConfigFile::put |
( |
const char * |
name, |
|
|
const T & |
data | |
|
) |
| | [inline] |
Writes or overwrites a piece of data with the given name
- Parameters:
-
template<class T >
void DUtils::ConfigFile::put |
( |
const std::string & |
name, |
|
|
const T & |
data | |
|
) |
| | [inline] |
Writes or overwrites a piece of data with the given name
- Parameters:
-
void ConfigFile::readContent |
( |
|
) |
[protected] |
Reads the content of the m_file already opened and stores it in m_data. This operation also resolves the possible name deferencing when using variables
void ConfigFile::resolveVar |
( |
std::string & |
value, |
|
|
const std::set< string > & |
used | |
|
) |
| | [protected] |
Resolves the value of a single variable
- Parameters:
-
| value | the string value to modify |
| used | the names of the tokens that cannot be replaced because of circular dependencies |
void ConfigFile::resolveVariables |
( |
|
) |
[protected] |
Resolves the value of the variables used as right-hand expressions
int DUtils::ConfigFile::sizeAnonymous |
( |
|
) |
const [inline] |
Returns the number of anonymous entries when reading a file
- Returns:
- n
void ConfigFile::writeContent |
( |
|
) |
[protected] |
Writes the items into the file
The documentation for this class was generated from the following files: