Imports the configuration database from filename as strings. Allows non-typed values. (no #, dword: hex:, etc. prefixes) and skips whitespace (tabs and spaces) as in standard .ini and .conf files. Values (to right of equal sign) can be double quote delimited to embed tabs and spaces in the string. Caller must convert string to type. More...
#include <Configuration_Import_Export.h>
Public Member Functions | |
ACE_Ini_ImpExp (ACE_Configuration &) | |
virtual | ~ACE_Ini_ImpExp (void) |
virtual int | import_config (const ACE_TCHAR *filename) |
virtual int | export_config (const ACE_TCHAR *filename) |
Private Member Functions | |
int | export_section (const ACE_Configuration_Section_Key §ion, const ACE_TString &path, FILE *out) |
ACE_TCHAR * | squish (ACE_TCHAR *src) |
ACE_Ini_ImpExp (const ACE_Ini_ImpExp &) | |
ACE_Ini_ImpExp & | operator= (const ACE_Ini_ImpExp &) |
Imports the configuration database from filename as strings. Allows non-typed values. (no #, dword: hex:, etc. prefixes) and skips whitespace (tabs and spaces) as in standard .ini and .conf files. Values (to right of equal sign) can be double quote delimited to embed tabs and spaces in the string. Caller must convert string to type.
This method allows for lines in the .ini or .conf file like this:
TimeToLive = 100 Delay = FALSE Flags = FF34 Heading = "ACE - Adaptive Communication Environment"
(note leading whitespace (tabs) in examples below)
SeekIndex = 14 TraceLevel = 6 # Can comment lines like this Justification = left_justified
The caller can then retrieve the string with the regular <get_string_value> function and convert the string to the desired data type.
ACE_Ini_ImpExp::ACE_Ini_ImpExp | ( | ACE_Configuration & | config ) |
Construction
ACE_Ini_ImpExp::~ACE_Ini_ImpExp | ( | void | ) | [virtual] |
Destructor
ACE_Ini_ImpExp::ACE_Ini_ImpExp | ( | const ACE_Ini_ImpExp & | ) | [private] |
int ACE_Ini_ImpExp::export_config | ( | const ACE_TCHAR * | filename ) | [virtual] |
This method exports the entire configuration database to filename. Once the file is opened this method calls export_section() passing the root section.
Implements ACE_Config_ImpExp_Base.
int ACE_Ini_ImpExp::export_section | ( | const ACE_Configuration_Section_Key & | section, |
const ACE_TString & | path, | ||
FILE * | out | ||
) | [private] |
Method provided by derived classes in order to write one section to the file specified. Called by export_config() when exporting the entire configuration object.
int ACE_Ini_ImpExp::import_config | ( | const ACE_TCHAR * | filename ) | [virtual] |
Imports the configuration database from filename. No existing data is removed.
Implements ACE_Config_ImpExp_Base.
ACE_Ini_ImpExp& ACE_Ini_ImpExp::operator= | ( | const ACE_Ini_ImpExp & | ) | [private] |
Method to squish leading and trailing whitespaces in a string. Whitespace is defined as: spaces (' '), tabs ('\t') or cr/lf. Returns a pointer to the first non-whitespace character in the buffer provided, or a pointer to the terminating null if the string is all whitespace. The terminating null is moved forward to the first character past the last non-whitespace.