ACE_Configuration Class Reference

Base class for configuration databases. More...

#include <Configuration.h>

Inheritance diagram for ACE_Configuration:

Inheritance graph
[legend]
Collaboration diagram for ACE_Configuration:

Collaboration graph
[legend]
List of all members.

Public Types

enum  VALUETYPE { STRING, INTEGER, BINARY, INVALID }
 Enumeration for the various types of values we can store. More...


Public Member Functions

virtual ~ACE_Configuration (void)
 Destructor.

virtual const ACE_Configuration_Section_Keyroot_section (void) const
 Obtain a reference to the root section of this configuration.

virtual int open_section (const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, int create, ACE_Configuration_Section_Key &result)=0
virtual int remove_section (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *sub_section, int recursive)=0
 Removes a named section.

virtual int enumerate_values (const ACE_Configuration_Section_Key &key, int index, ACE_TString &name, VALUETYPE &type)=0
virtual int enumerate_sections (const ACE_Configuration_Section_Key &key, int index, ACE_TString &name)=0
virtual int set_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const ACE_TString &value)=0
 Sets a string-typed value.

virtual int set_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int value)=0
 Sets a integer-typed value.

virtual int set_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const void *data, size_t length)=0
 Sets a binary-typed value.

virtual int get_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, ACE_TString &value)=0
 Gets a string-typed value.

virtual int get_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int &value)=0
 Gets an integer-typed value.

virtual int get_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, void *&data, size_t &length)=0
 Gets a binary-typed value.

virtual int find_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, VALUETYPE &type)=0
virtual int remove_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name)=0
 Removes a named value.

int expand_path (const ACE_Configuration_Section_Key &key, const ACE_TString &path_in, ACE_Configuration_Section_Key &key_out, int create=1)
int export_config (const ACE_TCHAR *filename)
int import_config (const ACE_TCHAR *filename)
bool operator== (const ACE_Configuration &rhs) const
bool operator!= (const ACE_Configuration &rhs) const

Static Public Attributes

ACE_TCHAR NULL_String_ = '\0'

Protected Member Functions

 ACE_Configuration (void)
 Default ctor.

ACE_Section_Key_Internalget_internal_key (const ACE_Configuration_Section_Key &key)
 Resolves the internal key from a section key.

int validate_name (const ACE_TCHAR *name, int allow_path=0)
int validate_value_name (const ACE_TCHAR *name)
 ACE_Configuration (const ACE_Configuration &rhs)
ACE_Configurationoperator= (const ACE_Configuration &rhs)

Protected Attributes

ACE_Configuration_Section_Key root_

Detailed Description

Base class for configuration databases.

For internal use only.

This class provides an interface for configuration databases. A concrete class is required that implements the interface.

See also:
ACE_Configuration_Heap

ACE_Configuration_Win32Registry

Definition at line 138 of file Configuration.h.


Member Enumeration Documentation

enum ACE_Configuration::VALUETYPE
 

Enumeration for the various types of values we can store.

Enumeration values:
STRING 
INTEGER 
BINARY 
INVALID 

Definition at line 142 of file Configuration.h.

Referenced by operator==().

00143   {
00144     STRING,
00145     INTEGER,
00146     BINARY,
00147     INVALID
00148   };


Constructor & Destructor Documentation

ACE_Configuration::~ACE_Configuration void   )  [virtual]
 

Destructor.

Definition at line 91 of file Configuration.cpp.

00092 {
00093 }

ACE_Configuration::ACE_Configuration void   )  [protected]
 

Default ctor.

Definition at line 86 of file Configuration.cpp.

00087   : root_ ()
00088 {
00089 }

ACE_Configuration::ACE_Configuration const ACE_Configuration rhs  )  [protected]
 


Member Function Documentation

virtual int ACE_Configuration::enumerate_sections const ACE_Configuration_Section_Key key,
int  index,
ACE_TString name
[pure virtual]
 

Enumerates through the subsections in a section.

Parameters:
key Section key to iterate through.
index Iteration position. Must be zero on the first call to iterate through key. Increment index by one on each successive call to this method.
name Receives the subsection's name.
Note:
You may not modify the key section while enumerating. If the section is modified during enumeration, results are undefined; you must restart the enumeration from index 0.
Return values:
0 for success, name has a valid name.
1 there are no more subsections in the section.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Ini_ImpExp::export_section(), ACE_Registry_ImpExp::export_section(), and operator==().

virtual int ACE_Configuration::enumerate_values const ACE_Configuration_Section_Key key,
int  index,
ACE_TString name,
VALUETYPE type
[pure virtual]
 

Enumerates through the values in a section.

Parameters:
key Section key to iterate through.
index Iteration position. Must be zero on the first call to iterate through key. Increment index by one on each successive call to this method.
name Receives the value's name.
type Receives the value's data type.
Note:
You may not delete or add values while enumerating. If the section is modified during enumeration, results are undefined; you must restart the enumeration from index 0.
Return values:
0 for success, name and type are valid.
1 there are no more values in the section.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Ini_ImpExp::export_section(), ACE_Registry_ImpExp::export_section(), and operator==().

int ACE_Configuration::expand_path const ACE_Configuration_Section_Key key,
const ACE_TString path_in,
ACE_Configuration_Section_Key key_out,
int  create = 1
 

Expands to from . If create is true, the subsections are created. Returns 0 on success, non zero on error The path consists of sections separated by the backslash '\' or forward slash '/'. Returns 0 on success, -1 if <create) is 0 and the path refers a nonexistant section

Definition at line 102 of file Configuration.cpp.

References ACE_TCHAR, ACE_TString, ACE_Tokenizer::delimiter_replace(), ACE_Auto_Basic_Array_Ptr< X >::get(), ACE_Tokenizer::next(), open_section(), and ACE_String_Base< CHAR >::rep().

Referenced by ACE_Ini_ImpExp::import_config(), and ACE_Registry_ImpExp::import_config().

00106 {
00107   // Make a copy of key
00108   ACE_Configuration_Section_Key current_section = key;
00109   ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> pData (path_in.rep ());
00110   ACE_Tokenizer parser (pData.get ());
00111   parser.delimiter_replace ('\\', '\0');
00112   parser.delimiter_replace ('/', '\0');
00113 
00114   for (ACE_TCHAR *temp = parser.next ();
00115        temp != 0;
00116        temp = parser.next ())
00117     {
00118       // Open the section
00119       if (open_section (current_section,
00120                         temp,
00121                         create,
00122                         key_out))
00123         return -1;
00124 
00125       current_section = key_out;
00126     }
00127 
00128   return 0;
00129 
00130 }

int ACE_Configuration::export_config const ACE_TCHAR filename  ) 
 

Deprecated:
Exports the configuration database to filename. If filename is already present, it is overwritten. This function is deprecated and will be removed in a future version of ACE. Please use either ACE_Registry_ImpExp or ACE_Ini_ImpExp instead.

Definition at line 135 of file Configuration.cpp.

References ACE_TCHAR, and ACE_Registry_ImpExp::export_config().

00136 {
00137   ACE_Registry_ImpExp exporter (*this);
00138   return exporter.export_config (filename);
00139 }

virtual int ACE_Configuration::find_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name,
VALUETYPE type
[pure virtual]
 

Retrieves the type of a named configuration value.

Parameters:
key Configuration section to look up the name in.
name Name of the configuration value to get the type of.
type Receives the data type of the named value, if it exists.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by operator==().

virtual int ACE_Configuration::get_binary_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name,
void *&  data,
size_t &  length
[pure virtual]
 

Gets a binary-typed value.

Parameters:
key Configuration section to get the value from.
name Name of the configuration value to get.
data Receives a pointer to memory holding the binary data for the value. This method allocates the memory pointed to using operator new[]. The caller is responsible for freeing the memory using operator delete[].
length Receives the number of bytes in the value.
Return values:
0 for success; caller is responsible for freeing the returned memory.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Ini_ImpExp::export_section(), ACE_Registry_ImpExp::export_section(), and operator==().

virtual int ACE_Configuration::get_integer_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name,
u_int &  value
[pure virtual]
 

Gets an integer-typed value.

Parameters:
key Configuration section to get the value from.
name Name of the configuration value to get.
value Receives the configuration value if it exists and has type INTEGER.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Ini_ImpExp::export_section(), ACE_Registry_ImpExp::export_section(), and operator==().

ACE_Section_Key_Internal * ACE_Configuration::get_internal_key const ACE_Configuration_Section_Key key  )  [protected]
 

Resolves the internal key from a section key.

Definition at line 96 of file Configuration.cpp.

References ACE_Configuration_Section_Key::key_.

Referenced by ACE_Configuration_Heap::enumerate_sections(), ACE_Configuration_Heap::enumerate_values(), and ACE_Configuration_Heap::load_key().

00097 {
00098   return key.key_;
00099 }

virtual int ACE_Configuration::get_string_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name,
ACE_TString value
[pure virtual]
 

Gets a string-typed value.

Parameters:
key Configuration section to get the value from.
name Name of the configuration value to get.
value Receives the configuration value if it exists and has type STRING.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Ini_ImpExp::export_section(), ACE_Registry_ImpExp::export_section(), and operator==().

int ACE_Configuration::import_config const ACE_TCHAR filename  ) 
 

Deprecated:
Imports the configuration database from filename. Any existing data is not removed. This function is deprecated and will be removed in a future version of ACE. Please use ACE_Registry_ImpExp or ACE_Ini_ImpExp instead.

Definition at line 142 of file Configuration.cpp.

References ACE_TCHAR, and ACE_Registry_ImpExp::import_config().

00143 {
00144   ACE_Registry_ImpExp importer (*this);
00145   return importer.import_config (filename);
00146 }

virtual int ACE_Configuration::open_section const ACE_Configuration_Section_Key base,
const ACE_TCHAR sub_section,
int  create,
ACE_Configuration_Section_Key result
[pure virtual]
 

Opens a named section in an existing section.

Parameters:
base Existing section in which to open the named section.
sub_section Name of the section to open.
create If zero, the named section must exist. If non-zero, the named section will be created if it does not exist.
result Reference; receives the section key for the new section.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by expand_path(), ACE_Ini_ImpExp::export_section(), ACE_Registry_ImpExp::export_section(), and operator==().

bool ACE_Configuration::operator!= const ACE_Configuration rhs  )  const
 

Determine if the contents of this object are different from the contents of the object on the right hand side. Returns 0 (False) if they are equal and 1 (True) if they are not equal

Definition at line 423 of file Configuration.cpp.

00424 {
00425   return !(*this == rhs);
00426 }

ACE_Configuration& ACE_Configuration::operator= const ACE_Configuration rhs  )  [protected]
 

bool ACE_Configuration::operator== const ACE_Configuration rhs  )  const
 

Determine if the contents of this object is the same as the contents of the object on the right hand side. Returns 1 (True) if they are equal and 0 (False) if they are not equal

Definition at line 203 of file Configuration.cpp.

References ACE_TString, BINARY, ACE_String_Base< CHAR >::c_str(), enumerate_sections(), enumerate_values(), find_value(), get_binary_value(), get_integer_value(), get_string_value(), INTEGER, open_section(), root_section(), STRING, and VALUETYPE.

00204 {
00205   bool rc = true;
00206   int sectionIndex = 0;
00207   ACE_TString sectionName;
00208   ACE_Configuration *nonconst_this = const_cast<ACE_Configuration*> (this);
00209   ACE_Configuration &nonconst_rhs  = const_cast<ACE_Configuration&> (rhs);
00210 
00211   const ACE_Configuration_Section_Key& rhsRoot = rhs.root_section ();
00212   ACE_Configuration_Section_Key rhsSection;
00213   ACE_Configuration_Section_Key thisSection;
00214 
00215   // loop through each section in this object
00216   while ((rc) && (nonconst_this->enumerate_sections (this->root_,
00217                                                      sectionIndex,
00218                                                      sectionName) == 0))
00219     {
00220       // find that section in the rhs object
00221       if (nonconst_rhs.open_section (rhsRoot,
00222                                      sectionName.c_str (),
00223                                      0,
00224                                      rhsSection) != 0)
00225         {
00226           // If the rhs object does not contain the section then we are
00227           // not equal.
00228           rc = false;
00229         }
00230       else if (nonconst_this->open_section (this->root_,
00231                                             sectionName.c_str (),
00232                                             0,
00233                                             thisSection) != 0)
00234         {
00235           // if there is some error opening the section in this object
00236           rc = false;
00237         }
00238       else
00239         {
00240           // Well the sections match
00241           int         valueIndex = 0;
00242           ACE_TString valueName;
00243           VALUETYPE   valueType;
00244           VALUETYPE   rhsType;
00245 
00246           // Enumerate each value in this section
00247           while ((rc) && nonconst_this->enumerate_values (thisSection,
00248                                                           valueIndex,
00249                                                           valueName,
00250                                                           valueType) == 0)
00251             {
00252               // look for the same value in the rhs section
00253               if (nonconst_rhs.find_value (rhsSection,
00254                                            valueName.c_str (),
00255                                            rhsType) != 0)
00256                 {
00257                   // We're not equal if the same value cannot
00258                   // be found in the rhs object.
00259                   rc = false;
00260                 }
00261               else if (valueType != rhsType)
00262                 {
00263                   // we're not equal if the types do not match.
00264                   rc = false;
00265                 }
00266               else
00267                 {
00268                   // finally compare values.
00269                   if (valueType == STRING)
00270                     {
00271                       ACE_TString thisString, rhsString;
00272                       if (nonconst_this->get_string_value (thisSection,
00273                                                            valueName.c_str (),
00274                                                            thisString) != 0)
00275                         {
00276                           // we're not equal if we cannot get this string
00277                           rc = false;
00278                         }
00279                       else if (nonconst_rhs.get_string_value (
00280                                  rhsSection,
00281                                  valueName.c_str (),
00282                                  rhsString) != 0)
00283                         {
00284                           // we're not equal if we cannot get rhs string
00285                           rc = false;
00286                         }
00287                       rc = (thisString == rhsString);
00288                     }
00289                   else if (valueType == INTEGER)
00290                     {
00291                       u_int thisInt = 0;
00292                       u_int rhsInt = 0;
00293                       if (nonconst_this->get_integer_value (
00294                             thisSection,
00295                             valueName.c_str (),
00296                             thisInt) != 0)
00297                         {
00298                           // we're not equal if we cannot get this int
00299                           rc = false;
00300                         }
00301                       else if (nonconst_rhs.get_integer_value (
00302                                  rhsSection,
00303                                  valueName.c_str (),
00304                                  rhsInt) != 0)
00305                         {
00306                           // we're not equal if we cannot get rhs int
00307                           rc = false;
00308                         }
00309                       rc = (thisInt == rhsInt);
00310                     }
00311                   else if (valueType == BINARY)
00312                     {
00313                       void* thisData = 0;
00314                       void* rhsData = 0;
00315                       size_t thisLength = 0;
00316                       size_t rhsLength = 0;
00317                       if (nonconst_this->get_binary_value (thisSection,
00318                                                            valueName.c_str (),
00319                                                            thisData,
00320                                                            thisLength) != 0)
00321                         {
00322                           // we're not equal if we cannot get this data
00323                           rc = false;
00324                         }
00325                       else if (nonconst_rhs.get_binary_value (
00326                                  rhsSection,
00327                                  valueName.c_str (),
00328                                  rhsData,
00329                                  rhsLength) != 0)
00330                         {
00331                           // we're not equal if we cannot get this data
00332                           rc = false;
00333                         }
00334 
00335                       rc = (thisLength == rhsLength);
00336                       // are the length's the same?
00337 
00338                       if (rc)
00339                         {
00340                           unsigned char* thisCharData =
00341                             (unsigned char*)thisData;
00342                           unsigned char* rhsCharData = (unsigned char*)rhsData;
00343                           // yes, then check each element
00344                           for (size_t count = 0;
00345                                (rc) && (count < thisLength);
00346                                count++)
00347                             {
00348                               rc = (* (thisCharData + count) == * (rhsCharData + count));
00349                             }
00350 
00351                           delete [] thisCharData;
00352                           delete [] rhsCharData;
00353                         }// end if the length's match
00354                     }
00355                   // We should never have valueTypes of INVALID, therefore
00356                   // we're not comparing them.  How would we since we have
00357                   // no get operation for invalid types.
00358                   // So, if we have them, we guess they are equal.
00359 
00360                 }// end else if values match.
00361 
00362               ++valueIndex;
00363 
00364             }// end value while loop
00365 
00366           // look in the rhs for values not in this
00367           valueIndex = 0;
00368           while ((rc) && (nonconst_rhs.enumerate_values (rhsSection,
00369                                                          valueIndex,
00370                                                          valueName,
00371                                                          rhsType) == 0))
00372             {
00373               // look for the same value in this section
00374               if (nonconst_this->find_value (thisSection,
00375                                              valueName.c_str (),
00376                                              valueType) != 0)
00377                 {
00378                   // We're not equal if the same value cannot
00379                   // be found in the rhs object.
00380                   rc = false;
00381                 }
00382               ++valueIndex;
00383             }// end while for rhs values not in this.
00384 
00385         }// end else if sections match.
00386 
00387       sectionIndex++;
00388 
00389     }// end section while loop
00390 
00391   // Finally, make sure that there are no sections in rhs that do not
00392   // exist in this
00393   sectionIndex = 0;
00394   while ((rc)
00395          && (nonconst_rhs.enumerate_sections (rhsRoot,
00396                                               sectionIndex,
00397                                               sectionName) == 0))
00398     {
00399       // find the section in this
00400       if (nonconst_this->open_section (this->root_,
00401                                        sectionName.c_str (),
00402                                        0,
00403                                        thisSection) != 0)
00404         {
00405           // if there is some error opening the section in this object
00406           rc = false;
00407         }
00408       else if (nonconst_rhs.open_section (rhsRoot,
00409                                           sectionName.c_str (),
00410                                           0,
00411                                           rhsSection) != 0)
00412         {
00413           // If the rhs object does not contain the section then we
00414           // are not equal.
00415           rc = false;
00416         }
00417       ++sectionIndex;
00418     }
00419   return rc;
00420 }

virtual int ACE_Configuration::remove_section const ACE_Configuration_Section_Key key,
const ACE_TCHAR sub_section,
int  recursive
[pure virtual]
 

Removes a named section.

Parameters:
key Section key to remove the named section from.
sub_section Name of the section to remove.
recursive If non zero, any subkeys below sub_section are removed as well.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

virtual int ACE_Configuration::remove_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name
[pure virtual]
 

Removes a named value.

Parameters:
key Configuration section to remove the named value from.
name Name of the configuration value to remove.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

const ACE_Configuration_Section_Key & ACE_Configuration::root_section void   )  const [virtual]
 

Obtain a reference to the root section of this configuration.

Definition at line 192 of file Configuration.cpp.

References root_.

Referenced by ACE_Ini_ImpExp::export_config(), ACE_Registry_ImpExp::export_config(), ACE_Ini_ImpExp::import_config(), ACE_Registry_ImpExp::import_config(), and operator==().

00193 {
00194   return root_;
00195 }

virtual int ACE_Configuration::set_binary_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name,
const void *  data,
size_t  length
[pure virtual]
 

Sets a binary-typed value.

Parameters:
key Configuration section to set the value in.
name Name of the configuration value to set. If a value with the specified name exists, it is replaced.
data Pointer to the binary data for the value.
length Number of bytes for the new value.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Registry_ImpExp::import_config().

virtual int ACE_Configuration::set_integer_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name,
u_int  value
[pure virtual]
 

Sets a integer-typed value.

Parameters:
key Configuration section to set the value in.
name Name of the configuration value to set. If a value with the specified name exists, it is replaced.
value The integer to set the configuration value to.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Registry_ImpExp::import_config(), and ACE_Registry_ImpExp::process_previous_line_format().

virtual int ACE_Configuration::set_string_value const ACE_Configuration_Section_Key key,
const ACE_TCHAR name,
const ACE_TString value
[pure virtual]
 

Sets a string-typed value.

Parameters:
key Configuration section to set the value in.
name Name of the configuration value to set. If a value with the specified name exists, it is replaced.
value The string to set the configuration value to.
Return values:
0 for success.
-1 for error; ACE_OS::last_error() retrieves error code.

Implemented in ACE_Configuration_Win32Registry, and ACE_Configuration_Heap.

Referenced by ACE_Ini_ImpExp::import_config(), ACE_Registry_ImpExp::import_config(), and ACE_Registry_ImpExp::process_previous_line_format().

int ACE_Configuration::validate_name const ACE_TCHAR name,
int  allow_path = 0
[protected]
 

Tests to see if is valid. must be < 255 characters and not contain the path separator '\', brackets [] or = (maybe just restrict to alphanumeric?) returns non zero if name is not valid. The path separator is allowed, except for the first character, if is true.

Definition at line 149 of file Configuration.cpp.

References ACE_LIB_TEXT, ACE_TCHAR, and ACE_OS::strcspn().

Referenced by ACE_Configuration_Heap::open_section(), ACE_Configuration_Heap::remove_section(), and validate_value_name().

00150 {
00151   // Invalid character set
00152   const ACE_TCHAR* reject =
00153     allow_path ? ACE_LIB_TEXT ("][") : ACE_LIB_TEXT ("\\][");
00154 
00155   // Position of the first invalid character or terminating null.
00156   size_t pos = ACE_OS::strcspn (name, reject);
00157 
00158   // Check if it is an invalid character.
00159   if (name[pos] != ACE_LIB_TEXT ('\0'))
00160     {
00161       errno = EINVAL;
00162       return -1;
00163     }
00164 
00165   // The first character can never be a path separator.
00166   if (name[0] == ACE_LIB_TEXT ('\\'))
00167     {
00168       errno = EINVAL;
00169       return -1;
00170     }
00171 
00172   // Validate length.
00173   if (pos == 0 || pos > 255)
00174     {
00175       errno = ENAMETOOLONG;
00176       return -1;
00177     }
00178 
00179   return 0;
00180 }

int ACE_Configuration::validate_value_name const ACE_TCHAR name  )  [protected]
 

Test to see if is valid. The default value for a key can be unnamed, which means either is == 0 or == '` is valid. Otherwise, it calls validate_name() to test for the same rules that apply to keys.

Definition at line 183 of file Configuration.cpp.

References ACE_TCHAR, NULL_String_, and validate_name().

Referenced by ACE_Configuration_Heap::find_value(), ACE_Configuration_Heap::get_binary_value(), ACE_Configuration_Heap::get_integer_value(), ACE_Configuration_Heap::get_string_value(), ACE_Configuration_Heap::remove_value(), ACE_Configuration_Heap::set_binary_value(), ACE_Configuration_Heap::set_integer_value(), and ACE_Configuration_Heap::set_string_value().

00184 {
00185   if (name == 0 || *name == this->NULL_String_)
00186     return 0;
00187 
00188   return this->validate_name (name);
00189 }


Member Data Documentation

ACE_TCHAR ACE_Configuration::NULL_String_ = '\0' [static]
 

* Represents the "NULL" string to simplify the internal logic.

Definition at line 84 of file Configuration.cpp.

Referenced by validate_value_name().

ACE_Configuration_Section_Key ACE_Configuration::root_ [protected]
 

Definition at line 429 of file Configuration.h.

Referenced by root_section().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:20:52 2006 for ACE by doxygen 1.3.6