summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2002-07-17 19:21:35 +0000
committerSteve Huston <shuston@riverace.com>2002-07-17 19:21:35 +0000
commit53ec6492a4fbfb7a942575859aadeab21de17cf8 (patch)
treee4e893e11e230a82840d0a84db2ef726d261954c
parent87f70bdc49fcd550cd26828dcb9b59b75bf6f5cd (diff)
downloadATCD-53ec6492a4fbfb7a942575859aadeab21de17cf8.tar.gz
ChangeLogTag:Wed Jul 17 15:18:31 2002 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog16
-rw-r--r--ChangeLogs/ChangeLog-03a16
-rw-r--r--ace/Configuration.cpp202
-rw-r--r--ace/Configuration.h213
-rw-r--r--ace/OS.cpp10
-rw-r--r--ace/OS.i16
6 files changed, 324 insertions, 149 deletions
diff --git a/ChangeLog b/ChangeLog
index b6454306a33..d0b6e4e7217 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Wed Jul 17 15:18:31 2002 Steve Huston <shuston@riverace.com>
+
+ * ace/Configuration.h: Doxygen improvements.
+
+ * ace/Configuration.cpp: All error cases where a return
+ (-2, -3, -4, -5) occurred now return -1 with errno set.
+
+ * ace/OS.{i cpp}: Follow-up to Wed Jul 17 11:34:28 2002 Steve Huston
+ Only make ACE_WIN64 use intptr_t - must have a new SDK to get
+ intptr_t, and not all have it.... so use it only for ACE_WIN64
+ since the compiler comes in the newer SDK... Win32 does
+ fine with long, which is what an intrptr_t is on Win32.
+
+ Also fixed the PACE-busted conditional compiles around siginfo_t
+ to match the declaration in OS.h. Win32 needs this stuff.
+
Wed Jul 17 14:25:39 2002 Steve Huston <shuston@riverace.com>
* include/makeinclude/platform_aix_ibm.GNU: Added -qfuncsect to the
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index b6454306a33..d0b6e4e7217 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,19 @@
+Wed Jul 17 15:18:31 2002 Steve Huston <shuston@riverace.com>
+
+ * ace/Configuration.h: Doxygen improvements.
+
+ * ace/Configuration.cpp: All error cases where a return
+ (-2, -3, -4, -5) occurred now return -1 with errno set.
+
+ * ace/OS.{i cpp}: Follow-up to Wed Jul 17 11:34:28 2002 Steve Huston
+ Only make ACE_WIN64 use intptr_t - must have a new SDK to get
+ intptr_t, and not all have it.... so use it only for ACE_WIN64
+ since the compiler comes in the newer SDK... Win32 does
+ fine with long, which is what an intrptr_t is on Win32.
+
+ Also fixed the PACE-busted conditional compiles around siginfo_t
+ to match the declaration in OS.h. Win32 needs this stuff.
+
Wed Jul 17 14:25:39 2002 Steve Huston <shuston@riverace.com>
* include/makeinclude/platform_aix_ibm.GNU: Added -qfuncsect to the
diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp
index def401e6ac2..3f5a026b6d2 100644
--- a/ace/Configuration.cpp
+++ b/ace/Configuration.cpp
@@ -223,15 +223,24 @@ ACE_Configuration::validate_name (const ACE_TCHAR* name, int allow_path)
// Check if it is an invalid character.
if (name[pos] != ACE_LIB_TEXT ('\0'))
- return -1;
+ {
+ errno = EINVAL;
+ return -1;
+ }
// The first character can never be a path separator.
if (name[0] == ACE_LIB_TEXT ('\\'))
- return -1;
+ {
+ errno = EINVAL;
+ return -1;
+ }
// Validate length.
if (pos == 0 || pos > 255)
- return -2;
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
return 0;
}
@@ -531,7 +540,7 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
&result_key) != ERROR_SUCCESS)
{
if (!create)
- return -2;
+ return -1;
if (ACE_TEXT_RegCreateKeyEx (base_key,
sub_section,
@@ -547,12 +556,12 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K
0
#endif /* __MINGW32__ */
) != ERROR_SUCCESS)
- return -3;
+ return -1;
}
ACE_Section_Key_Win32 *temp;
- ACE_NEW_RETURN (temp, ACE_Section_Key_Win32 (result_key), -4);
+ ACE_NEW_RETURN (temp, ACE_Section_Key_Win32 (result_key), -1);
result = ACE_Configuration_Section_Key (temp);
return 0;
}
@@ -573,11 +582,11 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
{
ACE_Configuration_Section_Key section;
if (open_section (key, sub_section, 0, section))
- return -2;
+ return -1;
HKEY sub_key;
if (load_key (section, sub_key))
- return -3;
+ return -1;
ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE];
DWORD buffer_size = ACE_DEFAULT_BUFSIZE;
@@ -601,17 +610,17 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
#if (ACE_HAS_WINNT4 != 0)
if (ACE_TEXT_RegDeleteKey (base_key, sub_section) != ERROR_SUCCESS)
- return -2;
+ return -1;
#else
if (!recursive)
{
ACE_Configuration_Section_Key section;
if (open_section (key, sub_section, 0, section))
- return -2;
+ return -1;
HKEY sub_key;
if (load_key (section, sub_key))
- return -3;
+ return -1;
ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE];
DWORD buffer_size = ACE_DEFAULT_BUFSIZE;
@@ -624,10 +633,10 @@ ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section
0,
0,
0) == ERROR_SUCCESS)
- return -2;
+ return -1;
}
else if (ACE_TEXT_RegDeleteKey (base_key, sub_section) != ERROR_SUCCESS)
- return -2;
+ return -1;
#endif
return 0;
@@ -658,7 +667,7 @@ ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Secti
if (rc == ERROR_NO_MORE_ITEMS)
return 1;
else if (rc != ERROR_SUCCESS)
- return -2;
+ return -1;
name = name_buffer;
@@ -702,7 +711,7 @@ ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Sec
if (rc == ERROR_NO_MORE_ITEMS)
return 1;
else if (rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS)
- return -2;
+ return -1;
name = name_buffer;
@@ -725,9 +734,10 @@ ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Secti
name,
0,
REG_SZ,
- (BYTE *) value.fast_rep (),
- (value.length () + 1) * sizeof (ACE_TCHAR)) != ERROR_SUCCESS)
- return -2;
+ (BYTE *) value.fast_rep (),
+ (value.length () + 1) * sizeof (ACE_TCHAR))
+ != ERROR_SUCCESS)
+ return -1;
return 0;
}
@@ -748,9 +758,9 @@ ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Sect
name,
0,
REG_DWORD,
- (BYTE *) &value,
+ (BYTE *) &value,
sizeof (value)) != ERROR_SUCCESS)
- return -2;
+ return -1;
return 0;
}
@@ -772,9 +782,9 @@ ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Secti
name,
0,
REG_BINARY,
- (BYTE *) data,
+ (BYTE *) data,
length) != ERROR_SUCCESS)
- return -2;
+ return -1;
return 0;
}
@@ -798,17 +808,20 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
name,
0,
&type,
- (BYTE *) 0,
+ (BYTE *) 0,
&buffer_length) != ERROR_SUCCESS)
- return -2;
+ return -1;
if (type != REG_SZ)
- return -3;
+ {
+ errno = 0; ACE_OS::last_error (ERROR_INVALID_DATATYPE);
+ return -1;
+ }
ACE_TCHAR *temp = 0;
ACE_NEW_RETURN (temp,
ACE_TCHAR[buffer_length],
- 0);
+ -1);
ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> buffer (temp);
@@ -816,10 +829,10 @@ ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Secti
name,
0,
&type,
- (BYTE *) buffer.get (),
+ (BYTE *) buffer.get (),
&buffer_length) != ERROR_SUCCESS)
{
- return -5;
+ return -1;
}
value = buffer.get ();
@@ -844,12 +857,15 @@ ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Sect
name,
0,
&type,
- (BYTE *) &value,
+ (BYTE *) &value,
&length) != ERROR_SUCCESS)
- return -2;
+ return -1;
if (type != REG_DWORD)
- return -3;
+ {
+ errno = 0; ACE_OS::last_error (ERROR_INVALID_DATATYPE);
+ return -1;
+ }
return 0;
}
@@ -874,27 +890,30 @@ ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Secti
name,
0,
&type,
- (BYTE *) 0,
+ (BYTE *) 0,
&buffer_length) != ERROR_SUCCESS)
- return -2;
+ return -1;
if (type != REG_BINARY)
- return -3;
+ {
+ errno = 0; ACE_OS::last_error (ERROR_INVALID_DATATYPE);
+ return -1;
+ }
length = buffer_length;
- ACE_NEW_RETURN (data, BYTE[length], -4);
+ ACE_NEW_RETURN (data, BYTE[length], -1);
if (ACE_TEXT_RegQueryValueEx (base_key,
name,
0,
&type,
- (BYTE *) data,
+ (BYTE *) data,
&buffer_length) != ERROR_SUCCESS)
{
delete [] (BYTE *) data;
data = 0;
- return -5;
+ return -1;
}
return 0;
@@ -953,7 +972,7 @@ ACE_Configuration_Win32Registry::remove_value (const ACE_Configuration_Section_K
return -1;
if (ACE_TEXT_RegDeleteValue (base_key, name) != ERROR_SUCCESS)
- return -2;
+ return -1;
return 0;
}
@@ -1374,15 +1393,18 @@ ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base,
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2;
+ return -1;
// See if this section already exists
ACE_Configuration_ExtId SubSectionExtId (sub_section);
int ignored = 0;
if (!IntId.section_hash_map_->find (SubSectionExtId, ignored, allocator_))
- // already exists!
- return -3;
+ {
+ // already exists!
+ errno = EEXIST;
+ return -1;
+ }
// Create the new section name
// only prepend a separater if were not at the root
@@ -1398,7 +1420,7 @@ ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base,
if (IntId.section_hash_map_->bind (SSExtId, ignored, allocator_))
{
allocator_->free (pers_name);
- return -4;
+ return -1;
}
return (new_section (section, result));
}
@@ -1435,7 +1457,7 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
if (value_open_helper (default_map_size_, value_hash_map ) == -1)
{
this->allocator_->free (value_hash_map );
- return -2;
+ return -1;
}
// create the section map
@@ -1452,7 +1474,7 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
{
this->allocator_->free (value_hash_map );
this->allocator_->free (section_hash_map);
- return -2;
+ return -1;
}
ACE_Configuration_ExtId name (ptr);
@@ -1484,7 +1506,9 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
// set the result
ACE_Configuration_Section_Key_Heap *temp;
- ACE_NEW_RETURN (temp, ACE_Configuration_Section_Key_Heap (section.fast_rep ()), -2);
+ ACE_NEW_RETURN (temp,
+ ACE_Configuration_Section_Key_Heap (section.fast_rep ()),
+ -1);
result = ACE_Configuration_Section_Key (temp);
return return_value;
}
@@ -1556,14 +1580,18 @@ ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key
if (index_->find (ExtId, IntId, allocator_))
{
if (!create)
- return -2;
-
+ {
+ errno = ENOENT;
+ return -1;
+ }
return add_section (base, sub_section, result);
}
ACE_Configuration_Section_Key_Heap *temp;
- ACE_NEW_RETURN (temp, ACE_Configuration_Section_Key_Heap (section.fast_rep ()), -3);
+ ACE_NEW_RETURN (temp,
+ ACE_Configuration_Section_Key_Heap (section.fast_rep ()),
+ -1);
result = ACE_Configuration_Section_Key (temp);
return 0;
@@ -1586,7 +1614,7 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key
ACE_Configuration_ExtId ParentExtId (section.fast_rep ());
ACE_Configuration_Section_IntId ParentIntId;
if (index_->find (ParentExtId, ParentIntId, allocator_))
- return -2;// no parent key
+ return -1;// no parent key
// Find this subkey
if (section.length ())
@@ -1597,20 +1625,20 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key
SECTION_ENTRY* section_entry;
SECTION_HASH* hashmap = index_;
if (hashmap->find (SectionExtId, section_entry))
- return -2;
+ return -1;
if (recursive)
{
ACE_Configuration_Section_Key section;
if (open_section (key, sub_section, 0, section))
- return -3;
+ return -1;
int index = 0;
ACE_TString name;
while (!enumerate_sections (section, index, name))
{
if (remove_section (section, name.fast_rep (), 1))
- return -4;
+ return -1;
index++;
}
@@ -1618,17 +1646,20 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key
// Now make sure we dont have any subkeys
if (section_entry->int_id_.section_hash_map_->current_size ())
- return -3;
+ {
+ errno = ENOTEMPTY;
+ return -1;
+ }
// Now remove subkey from parent key
ACE_Configuration_ExtId SubSExtId (sub_section);
SUBSECTION_ENTRY* subsection_entry;
if (((SUBSECTION_HASH*)ParentIntId.section_hash_map_)->
find (SubSExtId, subsection_entry))
- return -4;
+ return -1;
if (ParentIntId.section_hash_map_->unbind (SubSExtId, allocator_))
- return -5;
+ return -1;
subsection_entry->ext_id_.free (allocator_);
@@ -1653,7 +1684,7 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key
// remove it
if (index_->unbind (SectionExtId, allocator_))
- return -5;
+ return -1;
// Free the memory
ExtIdToFree.free (allocator_);
@@ -1681,7 +1712,7 @@ ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& k
ACE_Configuration_ExtId ExtId (pKey->path_);
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2;
+ return -1;
// Handle iterator resets
if (index == 0)
@@ -1695,7 +1726,7 @@ ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& k
ACE_NEW_RETURN (pKey->value_iter_,
VALUE_HASH::ITERATOR (hash_map->begin ()),
- -3);
+ -1);
}
// Get the next entry
@@ -1729,7 +1760,7 @@ ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key&
ACE_Configuration_ExtId ExtId (pKey->path_);
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2; // unknown section
+ return -1; // unknown section
// Handle iterator resets
if (index == 0)
@@ -1739,7 +1770,7 @@ ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key&
ACE_NEW_RETURN (pKey->section_iter_,
SUBSECTION_HASH::ITERATOR (IntId.section_hash_map_->begin ()),
- -3);
+ -1);
}
// Get the next entry
@@ -1770,7 +1801,7 @@ ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& k
ACE_Configuration_ExtId section_ext (section.fast_rep ());
ACE_Configuration_Section_IntId section_int;
if (index_->find (section_ext, section_int, allocator_))
- return -2;
+ return -1;
// Get the entry for this item (if it exists)
VALUE_ENTRY* entry;
@@ -1802,7 +1833,7 @@ ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& k
{
allocator_->free (pers_value);
allocator_->free (pers_name);
- return -3;
+ return -1;
}
return 0;
}
@@ -1828,7 +1859,7 @@ ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key&
ACE_Configuration_ExtId section_ext (section.fast_rep ());
ACE_Configuration_Section_IntId section_int;
if (index_->find (section_ext, section_int, allocator_))
- return -2; // section does not exist
+ return -1; // section does not exist
// Get the entry for this item (if it exists)
VALUE_ENTRY* entry;
@@ -1850,7 +1881,7 @@ ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key&
if (section_int.value_hash_map_->bind (item_name, item_value, allocator_))
{
allocator_->free (pers_name);
- return -3;
+ return -1;
}
return 0;
}
@@ -1877,7 +1908,7 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
ACE_Configuration_ExtId section_ext (section.fast_rep ());
ACE_Configuration_Section_IntId section_int;
if (index_->find (section_ext, section_int, allocator_))
- return -2; // section does not exist
+ return -1; // section does not exist
// Get the entry for this item (if it exists)
VALUE_ENTRY* entry;
@@ -1907,7 +1938,7 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
{
allocator_->free (pers_value);
allocator_->free (pers_name);
- return -3;
+ return -1;
}
return 0;
}
@@ -1917,7 +1948,7 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2; // section does not exist
+ return -1; // section does not exist
// See if the value exists first
ACE_Configuration_ExtId VExtIdFind (name);
@@ -1937,7 +1968,7 @@ ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& k
{
allocator_->free (pers_value);
allocator_->free (pers_name);
- return -3;
+ return -1;
}
return 0;
}
@@ -1972,17 +2003,20 @@ ACE_Configuration_Heap::get_string_value (const ACE_Configuration_Section_Key& k
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2; // section does not exist
+ return -1; // section does not exist
// See if it exists first
ACE_Configuration_ExtId VExtId (name);
ACE_Configuration_Value_IntId VIntId;
if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_))
- return -3; // unknown value
+ return -1; // unknown value
// Check type
if (VIntId.type_ != ACE_Configuration::STRING)
- return -4;
+ {
+ errno = ENOENT;
+ return -1;
+ }
// everythings ok, return the data
value = ACE_static_cast (ACE_TCHAR*, VIntId.data_.ptr_);
@@ -2007,18 +2041,21 @@ ACE_Configuration_Heap::get_integer_value (const ACE_Configuration_Section_Key&
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2; // section does not exist
+ return -1; // section does not exist
// See if it exists first
ACE_Configuration_ExtId VExtId (name);
ACE_Configuration_Value_IntId VIntId;
if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_))
- return -3; // unknown value
+ return -1; // unknown value
// Check type
if (VIntId.type_ != ACE_Configuration::INTEGER)
- return -4;
+ {
+ errno = ENOENT;
+ return -1;
+ }
// Everythings ok, return the data
value = VIntId.data_.int_;
@@ -2044,20 +2081,23 @@ ACE_Configuration_Heap::get_binary_value (const ACE_Configuration_Section_Key& k
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2; // section does not exist
+ return -1; // section does not exist
ACE_Configuration_ExtId VExtId (name);
ACE_Configuration_Value_IntId VIntId;
// See if it exists first
if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_))
- return -3; // unknown value
+ return -1; // unknown value
// Check type
if (VIntId.type_ != ACE_Configuration::BINARY)
- return -4;
+ {
+ errno = ENOENT;
+ return -1;
+ }
// Make a copy
- ACE_NEW_RETURN (data, char[VIntId.length_], -5);
+ ACE_NEW_RETURN (data, char[VIntId.length_], -1);
ACE_OS::memcpy (data, VIntId.data_.ptr_, VIntId.length_);
length = VIntId.length_;
return 0;
@@ -2110,13 +2150,13 @@ ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key,
ACE_Configuration_ExtId ExtId (section.fast_rep ());
ACE_Configuration_Section_IntId IntId;
if (index_->find (ExtId, IntId, allocator_))
- return -2; // section does not exist
+ return -1; // section does not exist
// Find it
ACE_Configuration_ExtId ValueExtId (name);
VALUE_ENTRY* value_entry;
if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry))
- return -4;
+ return -1;
// free it
value_entry->ext_id_.free (allocator_);
@@ -2124,7 +2164,7 @@ ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key,
// Unbind it
if (IntId.value_hash_map_->unbind (ValueExtId, allocator_))
- return -3;
+ return -1;
return 0;
}
diff --git a/ace/Configuration.h b/ace/Configuration.h
index 21ef9c67d2c..44b676c4d24 100644
--- a/ace/Configuration.h
+++ b/ace/Configuration.h
@@ -14,13 +14,13 @@
* section contains other sections or values. Values may contain string,
* unsigned integer and binary data.
*
- * Note: these classes are not thread safe, if multiple threads use these
+ * @note These classes are not thread safe, if multiple threads use these
* classes, you are responsible for serializing access.
*
* For examples of using this class, see:
- * 1) The test code in ACE_Wrappers/test
- * 2) wxConfigViewer, a Windows like Registry Editor for ACE_Configuration
- * 3) TAO's IFR, it makes extensive use of ACE_Configuration
+ * -# The test code in ACE_wrappers/test
+ * -# wxConfigViewer, a Windows like Registry Editor for ACE_Configuration
+ * -# TAO's IFR, it makes extensive use of ACE_Configuration
*
* @todo Templatize this class with an ACE_LOCK to provide thread safety
*
@@ -52,6 +52,8 @@
/**
* @class ACE_Section_Key_Internal
*
+ * @internal
+ *
* @brief A base class for internal handles to section keys for
* configuration implementations
*
@@ -81,7 +83,7 @@ protected:
/**
* @class ACE_Configuration_Section_Key
*
- * @brief Referenced counted wrapper for <ACE_Section_Key_Internal>.
+ * @brief Reference counted wrapper for ACE_Section_Key_Internal.
*
* Reference counted wrapper class for the abstract internal
* section key. A user gets one of these to represent a section
@@ -91,21 +93,23 @@ class ACE_Export ACE_Configuration_Section_Key
{
friend class ACE_Configuration;
public:
- /// Default ctor
+ /// Default constructor.
ACE_Configuration_Section_Key (void);
- /// Ctor based on a pointer to a concrete internal key, does an
- /// add_ref on <key>.
+ /// Constructor that initializes to a pointer to a concrete internal key.
+ /**
+ * @arg key The section key to reference. Calls add_ref() with @a key.
+ */
ACE_EXPLICIT ACE_Configuration_Section_Key (ACE_Section_Key_Internal *key);
- /// Copy ctor, does an add_ref on rhs.key_.
+ /// Copy constructor, increments the reference count on the key.
ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key &rhs);
- /// Destructor, does a <dec_ref> on <key_>.
+ /// Destructor, decrements reference count on the referenced key.
~ACE_Configuration_Section_Key (void);
- /// Assignment operator, does a <dec_ref> on <key_> and <add_ref> to
- /// <rhs.key_>
+ /// Assignment operator, increments reference count for this object
+ /// and decrements it on @a rhs.
ACE_Configuration_Section_Key &
operator= (const ACE_Configuration_Section_Key &rhs);
private:
@@ -115,9 +119,15 @@ private:
/**
* @class ACE_Configuration
*
+ * @internal
+ *
* @brief Base class for configuration databases
*
- * This class provides an interface for configuration databases.
+ * This class provides an interface for configuration databases. A concrete
+ * class is required that implements the interface.
+ *
+ * @sa ACE_Configuration_Heap
+ * @sa ACE_Configuration_Win32Registry
*/
class ACE_Export ACE_Configuration
{
@@ -134,34 +144,61 @@ public:
/// Destructor
virtual ~ACE_Configuration (void);
- /// Returns the root section of this configuration.
+ /// Obtain a reference to the root section of this configuration.
+ /*
+ * @return Reference to the configuration's root section. Note that
+ * it is a const reference.
+ */
virtual const ACE_Configuration_Section_Key& root_section (void) const;
/**
- * Finds a <sub_section> in <base> and places the resulting key in
- * <result>. If create is non zero, the sub_section will be created
- * if it doesn't exist
+ * Opens a named section in an existing section.
+ *
+ * @arg base Existing section in which to open the named section.
+ * @arg sub_section Name of the section to open.
+ * @arg create If zero, the named section must exist. If non-zero,
+ * the named section will be created if it does not exist.
+ * @arg result Reference; receives the section key for the new section.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
*/
virtual int open_section (const ACE_Configuration_Section_Key &base,
const ACE_TCHAR *sub_section,
int create,
ACE_Configuration_Section_Key& result) = 0;
- /// Removes the <sub_section> from <key>. If recursive is non zero,
- /// any subkeys below <sub_section> are remove as well.
+ /// Removes a named section.
+ /**
+ * @arg key Section key to remove the named section from.
+ * @arg sub_section Name of the section to remove.
+ * @arg recursive If non zero, any subkeys below @a sub_section are
+ * removed as well.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
+ */
virtual int remove_section (const ACE_Configuration_Section_Key &key,
const ACE_TCHAR *sub_section,
int recursive) = 0;
/**
- * Method to enumerate through the <name> and <type> of values in a
- * <key>. To begin iteration, <index> must be zero. to continue
- * iteration, invoke enumerate_values again while incrementing
- * index. Each iteration will return the <name> of the value and
- * its <type>. This method returns 0 on success, <0 on error and 1
- * when there are no more values to iterate through. Note - you may
- * not delete or add values while enumerating. If you need to do
- * this, you start the enumeration over again.
+ * Enumerates through the values in a section.
+ *
+ * @arg key Section key to iterate through.
+ * @arg index Iteration position. Must be zero on the first call to iterate
+ * through @a key. Increment @a index by one on each successive
+ * call to this method.
+ * @arg name Receives the value's name.
+ * @arg 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.
+ *
+ * @retval 0 for success, @a name and @a type are valid.
+ * @retval 1 there are no more values in the section.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
*/
virtual int enumerate_values (const ACE_Configuration_Section_Key& key,
int index,
@@ -169,52 +206,110 @@ public:
VALUETYPE& type) = 0;
/**
- * Method to enumerate through the <name> subsections in <key>. To
- * begin iteration, <index> must zero. to continue iteration, invoke
- * enumerate_sections again while incrementing index. Each
- * iteration will return the <name> of the sub section. This method
- * returns 0 on success, <0 on error and 1 when there are no more
- * subsections to iterate through. Note - you may not delete or add
- * values while enumerating. If you need to do this, you start the
- * enumeration over again.
+ * Enumerates through the subsections in a section.
+ *
+ * @arg key Section key to iterate through.
+ * @arg index Iteration position. Must be zero on the first call to iterate
+ * through @a key. Increment @a index by one on each successive
+ * call to this method.
+ * @arg name Receives the subsection's name.
+ *
+ * @note You may not modify the @a key section while enumerating. If the
+ * section is modified during enumeration, results are undefined;
+ * you must restart the enumeration from index 0.
+ *
+ * @retval 0 for success, @a name has a valid name.
+ * @retval 1 there are no more subsections in the section.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
*/
virtual int enumerate_sections (const ACE_Configuration_Section_Key& key,
int index, ACE_TString& name) = 0;
- /// Sets the value in <key> with <name> to a string of <value>
+ /// Sets a string-typed value.
+ /**
+ * @arg key Configuration section to set the value in.
+ * @arg name Name of the configuration value to set. If a value with
+ * the specified name exists, it is replaced.
+ * @arg value The string to set the configuration value to.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
+ */
virtual int set_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
const ACE_TString& value) = 0;
- /// Sets the value in <key> with <name> to an integer of <value>
+ /// Sets a integer-typed value.
+ /**
+ * @arg key Configuration section to set the value in.
+ * @arg name Name of the configuration value to set. If a value with
+ * the specified name exists, it is replaced.
+ * @arg value The integer to set the configuration value to.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
+ */
virtual int set_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int value) = 0;
- /// Sets the value in <key> with <name> to binary data of <data> with
- /// <length>.
+ /// Sets a binary-typed value.
+ /**
+ * @arg key Configuration section to set the value in.
+ * @arg name Name of the configuration value to set. If a value with
+ * the specified name exists, it is replaced.
+ * @arg data Pointer to the binary data for the value.
+ * @arg length Number of bytes for the new value.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
+ */
virtual int set_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
const void* data,
u_int length) = 0;
- /// Gets the string value of <name> from <key> and places it in
- /// <value>. Returns non zero on error (if value is not a string).
+ /// Gets a string-typed value.
+ /**
+ * @arg key Configuration section to get the value from.
+ * @arg name Name of the configuration value to get.
+ * @arg value Receives the configuration value if it exists and
+ * has type STRING.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
+ */
virtual int get_string_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
ACE_TString& value) = 0;
- /// Gets the integer value of <name> from <key> and places it in
- /// <value>. Returns non zero on error (if value is not an integer).
+ /// Gets an integer-typed value.
+ /**
+ * @arg key Configuration section to get the value from.
+ * @arg name Name of the configuration value to get.
+ * @arg value Receives the configuration value if it exists and
+ * has type INTEGER.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
+ */
virtual int get_integer_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
u_int& value) = 0;
+ /// Gets a binary-typed value.
/**
- * Gets the binary value of <name> from <key> and places a copy in
- * <data> and sets <length> to the length of the data. caller is
- * responsible for deleting <data>. Returns non zero on error (if
- * value is not binary).
+ * @arg key Configuration section to get the value from.
+ * @arg name Name of the configuration value to get.
+ * @arg 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[].
+ * @arg length Receives the number of bytes in the value.
+ *
+ * @retval 0 for success; caller is responsible for freeing the
+ * returned memory.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
*/
virtual int get_binary_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
@@ -222,17 +317,27 @@ public:
u_int& length) = 0;
/**
- * Checks to see if an entry of <name> is in <key> and places the
- * data type in <type>. Returns 0 on success (entry is found),
- * -1 on error
+ * Retrieves the type of a named configuration value.
+ *
+ * @arg key Configuration section to look up the name in.
+ * @arg name Name of the configuration value to get the type of.
+ * @arg type Receives the data type of the named value, if it exists.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
*/
virtual int find_value(const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name,
VALUETYPE& type) = 0;
-
- /// Removes the the value <name> from <key>. returns non zero on
- /// error.
+ /// Removes a named value.
+ /**
+ * @arg key Configuration section to remove the named value from.
+ * @arg name Name of the configuration value to remove.
+ *
+ * @retval 0 for success.
+ * @retval -1 for error; ACE_OS::last_error() retrieves error code.
+ */
virtual int remove_value (const ACE_Configuration_Section_Key& key,
const ACE_TCHAR* name) = 0;
@@ -251,7 +356,7 @@ public:
/**
* @deprecated Exports the configuration database to filename.
- * If <filename> is already present, it is overwritten. This function is
+ * If @a 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.
*/
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 9ecdea3b03c..506924f81b6 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -899,11 +899,11 @@ ACE_OS::fopen (const ACE_TCHAR *filename,
}
# else
hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
-# if defined (__BORLANDC__)
- int fd = _open_osfhandle (long (handle), hmode);
-# else
+# if defined (ACE_WIN64)
int fd = _open_osfhandle (intptr_t (handle), hmode);
-# endif /* __BORLANDC__ */
+# else
+ int fd = _open_osfhandle (long (handle), hmode);
+# endif /* ACE_WIN64 */
if (fd != -1)
{
# if defined (__BORLANDC__) && !defined (ACE_USES_WCHAR)
@@ -4514,7 +4514,6 @@ spaef (FUNCPTR entry, ...)
# endif /* VXWORKS */
# if !defined (ACE_HAS_SIGINFO_T)
-# if !defined (ACE_WIN32)
siginfo_t::siginfo_t (ACE_HANDLE handle)
: si_handle_ (handle),
si_handles_ (&handle)
@@ -4526,7 +4525,6 @@ siginfo_t::siginfo_t (ACE_HANDLE *handles)
si_handles_ (handles)
{
}
-# endif /* ! ACE_WIN32 */
# endif /* ACE_HAS_SIGINFO_T */
pid_t
diff --git a/ace/OS.i b/ace/OS.i
index 1667b3f5a88..8b57de14372 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -9160,11 +9160,11 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
FILE *file = 0;
-# if defined (__BORLANDC__)
- int crt_handle = ::_open_osfhandle (long (handle), 0);
-# else
+# if defined (ACE_WIN64)
int crt_handle = ::_open_osfhandle (intptr_t (handle), 0);
-# endif /* __BORLANDC__ */
+# else
+ int crt_handle = ::_open_osfhandle (long (handle), 0);
+# endif /* ACE_WIN64 */
if (crt_handle != -1)
{
@@ -10749,11 +10749,11 @@ ACE_OS::isatty (ACE_HANDLE handle)
ACE_UNUSED_ARG (handle);
return 0;
#else
-# if defined (__BORLANDC__)
- int fd = ::_open_osfhandle (long (handle), 0);
-# else
+# if defined (ACE_WIN64)
int fd = ::_open_osfhandle (intptr_t (handle), 0);
-# endif /* __BORLANDC__ */
+# else
+ int fd = ::_open_osfhandle (long (handle), 0);
+# endif /* ACE_WIN64 */
int status = ::_isatty (fd);
::_close (fd);