ACE  6.1.0
Public Member Functions | Private Member Functions
ACE_Ini_ImpExp Class Reference

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>

Inheritance diagram for ACE_Ini_ImpExp:
Inheritance graph
[legend]
Collaboration diagram for ACE_Ini_ImpExp:
Collaboration graph
[legend]

List of all members.

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 &section, const ACE_TString &path, FILE *out)
ACE_TCHARsquish (ACE_TCHAR *src)
 ACE_Ini_ImpExp (const ACE_Ini_ImpExp &)
ACE_Ini_ImpExpoperator= (const ACE_Ini_ImpExp &)

Detailed Description

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.

Todo:
  • Strings with embedded newlines cause the import to fail
  • Strings with embedded quotes " cause the import to fail
  • Importing/exporting for values in the root section does not work
  • Add dynamic buffer when importing. currently it will not allow importing of values greater than a fixed amount (4096 bytes)

Constructor & Destructor Documentation

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]

Member Function Documentation

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]
ACE_TCHAR * ACE_Ini_ImpExp::squish ( ACE_TCHAR src) [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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines