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 92 of file Configuration.cpp.

00093 {
00094 }

ACE_Configuration::ACE_Configuration void   )  [protected]
 

Default ctor.

Definition at line 87 of file Configuration.cpp.

00088   : root_ ()
00089 {
00090 }

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 key. 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 103 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().

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

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 136 of file Configuration.cpp.

References ACE_TCHAR, and ACE_Registry_ImpExp::export_config().

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

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 97 of file Configuration.cpp.

References ACE_Configuration_Section_Key::key_.

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

00098 {
00099   return key.key_;
00100 }

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 143 of file Configuration.cpp.

References ACE_TCHAR, and ACE_Registry_ImpExp::import_config().

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

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 424 of file Configuration.cpp.

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

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 204 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.

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

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 193 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==().

00194 {
00195   return root_;
00196 }

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 name is valid. name 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 150 of file Configuration.cpp.

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

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

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

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

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

Definition at line 184 of file Configuration.cpp.

References ACE_TCHAR, NULL_String_, and validate_name().

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

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


Member Data Documentation

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

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

Definition at line 85 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 Sun Jan 27 12:54:17 2008 for ACE by doxygen 1.3.6