summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog97
-rw-r--r--ChangeLogs/ChangeLog-02a97
-rw-r--r--ChangeLogs/ChangeLog-03a97
-rw-r--r--ace/Basic_Types.h11
-rw-r--r--ace/CDR_Stream.h6
-rw-r--r--ace/Local_Name_Space.cpp26
-rw-r--r--ace/Local_Name_Space.h10
-rw-r--r--ace/Local_Name_Space_T.cpp68
-rw-r--r--ace/Local_Name_Space_T.h56
-rw-r--r--ace/Makefile1
-rw-r--r--ace/Name_Space.cpp13
-rw-r--r--ace/Name_Space.h40
-rw-r--r--ace/Naming_Context.cpp58
-rw-r--r--ace/Naming_Context.h28
-rw-r--r--ace/OS_String.cpp54
-rw-r--r--ace/OS_String.h88
-rw-r--r--ace/OS_String.inl62
-rw-r--r--ace/Remote_Name_Space.cpp65
-rw-r--r--ace/Remote_Name_Space.h28
-rw-r--r--ace/SString.cpp706
-rw-r--r--ace/SString.h401
-rw-r--r--ace/SString.i532
-rw-r--r--ace/String_Base.cpp183
-rw-r--r--ace/String_Base.h237
-rw-r--r--ace/String_Base.i358
-rw-r--r--ace/ace_dll.dsp13
-rw-r--r--ace/ace_lib.dsp21
-rw-r--r--netsvcs/clients/Naming/Client/Client_Test.cpp14
-rw-r--r--netsvcs/lib/Name_Handler.cpp40
-rw-r--r--netsvcs/lib/Name_Handler.h12
-rw-r--r--tests/Naming_Test.cpp88
-rw-r--r--tests/SString_Test.cpp12
32 files changed, 1588 insertions, 1934 deletions
diff --git a/ChangeLog b/ChangeLog
index 7984930cb8f..9f0cd110a9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,95 @@
+Tue Dec 04 20:08:49 2001 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ Merged in the new String_Base template class.
+
+ * ace/Makefile: Added String_Base into the list of template
+ files.
+
+ * ace/Basic_Types.h: Added definitions of ACE_WCHAR_T and
+ ACE_WINT_T which are defined to wchat_t and wint_t when
+ ACE_HAS_WCHAR are defined, and ACE_USHORT16 otherwise. They are
+ needed to support various "wide character" string operations
+ that we need to support the templatized ACE_WString, which uses
+ ACE_USHORT16 as the wide char type when wchar_t is not
+ supported.
+
+ * ace/OS_String.h:
+ * ace/OS_String.inl:
+ * ace/OS_String.cpp: Made several wchar version string functions
+ available no matter ACE_HAS_WCHAR is defined or not. There are
+ more functions (the ones that have *_emulation helpers
+ available) that can be made availabe at all time, but I just
+ fixed the ones that ACE_WString needed for now. We can add more
+ later.
+
+ * ace/SString.h: Changed the definition of ACE_WSTRING_TYPE to
+ ACE_WCHAR_T. ACE_WCHAR_T is defined in the same fashion as
+ ACE_WSTRING_TYPE was originally defined.
+
+ * ace/Local_Name_Space.cpp: ACE_NS_WString::char_rep works just
+ fine. We don't need to use ACE_Wide_To_Ascii::convert
+ explicitly since it is not available when ACE_HAS_WCHAR isn't
+ defined.
+
+ * ace/SString.cpp (operator<<): Avoided the problem of printing
+ wchar strings temporarily. Using ACE_Wide_To_Ascii didn't work
+ on platforms that don't support wchar. Thanks to Keith Hamburg
+ for pointing this out.
+
+ * ace/String_Base.cpp: Fixed incorrect RCSID name. Thanks to
+ Keith Hamburg <khamburg@cs.wustl.edu> for reporting it.
+
+ * ace/SString.cpp:
+ * ace/SString.h:
+ * ace/SString.i: Changed ACE_WString to be a typedef of
+ ACE_String_Base<ACE_WSTRING_TYPE> and added a subclass of it
+ called ACE_NS_WString to maintain backward compatibility.
+
+ * tests/Naming_Test.cpp:
+ * ace/Local_Name_Space.cpp:
+ * ace/Local_Name_Space.h:
+ * ace/Local_Name_Space_T.cpp:
+ * ace/Local_Name_Space_T.h:
+ * ace/Name_Space.cpp:
+ * ace/Name_Space.h:
+ * ace/Naming_Context.cpp:
+ * ace/Naming_Context.h:
+ * ace/Remote_Name_Space.cpp:
+ * ace/Remote_Name_Space.h:
+ * netsvcs/clients/Naming/Client/Client_Test.cpp:
+ * netsvcs/lib/Name_Handler.cpp:
+ * netsvcs/lib/Name_Handler.h: Changed the use of ACE_WString to
+ ACE_NS_WString.
+
+ * tests/SString_Test.cpp: Added ACE_TEXT_WIDE to convert char
+ strings to wchar strings for initializing ACE_WString as you can
+ no longer initialize a ACE_WString with a char string.
+
+ * ace/String_Base.h:
+ * ace/String_Base.i:
+ * ace/String_Base.cpp: Abstracted out ACE_CString and ACE_WString
+ into a templatized String_Base.
+
+ * ace/CDR_Stream.h: Removed forward declarating ACE_CString and
+ added inclusion of <SString.h>.
+
+ * ace/SString.h:
+ * ace/SString.i:
+ * ace/SString.cpp: Changed ACE_CString to be a typedef of
+ ACE_String_Base<char>.
+
+ * ace/ace_dll.dsp:
+ * ace/ace_lib.dsp: Added String_Base.* to appropriate folders.
+
Tue Dec 4 20:57:09 2001 Balachandran Natarajan <bala@cs.wustl.edu>
* performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
- * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
+ * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
Added a outgoing queue to the test. This should more or less
represent a simple CORBA invocation. Reduced a call to new to by
- using a shared data block with a lock.
-
+ using a shared data block with a lock.
+
Tue Dec 4 19:10:22 2001 Steve Huston <shuston@riverace.com>
* ace/config-sunos5.6.h: Removed the setting of _POSIX_C_SOURCE to
@@ -42,18 +125,18 @@ Tue Dec 4 10:07:31 2001 Steve Huston <shuston@riverace.com>
Tue Dec 4 06:59:09 2001 Balachandran Natarajan <bala@cs.wustl.edu>
- * performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp:
+ * performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp:
* performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.h:
* performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
- * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
-
+ * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
+
New tests for measuring the throughput of two different server
concurrency architectures. The idea is to make it simpler than
what is already there and hence the tests. The old tests were a
bit confusing and very complicated. The old tests have been
retained. The tests are for getting some ball-park figures for
RT_CORBA and for TAO in general.
-
+
Tue Dec 4 10:00:04 2001 Johnny Willemsen <jwillemsen@remedy.nl>
* examples/Reactor/Multicast/client.cpp:
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 7984930cb8f..9f0cd110a9b 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,12 +1,95 @@
+Tue Dec 04 20:08:49 2001 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ Merged in the new String_Base template class.
+
+ * ace/Makefile: Added String_Base into the list of template
+ files.
+
+ * ace/Basic_Types.h: Added definitions of ACE_WCHAR_T and
+ ACE_WINT_T which are defined to wchat_t and wint_t when
+ ACE_HAS_WCHAR are defined, and ACE_USHORT16 otherwise. They are
+ needed to support various "wide character" string operations
+ that we need to support the templatized ACE_WString, which uses
+ ACE_USHORT16 as the wide char type when wchar_t is not
+ supported.
+
+ * ace/OS_String.h:
+ * ace/OS_String.inl:
+ * ace/OS_String.cpp: Made several wchar version string functions
+ available no matter ACE_HAS_WCHAR is defined or not. There are
+ more functions (the ones that have *_emulation helpers
+ available) that can be made availabe at all time, but I just
+ fixed the ones that ACE_WString needed for now. We can add more
+ later.
+
+ * ace/SString.h: Changed the definition of ACE_WSTRING_TYPE to
+ ACE_WCHAR_T. ACE_WCHAR_T is defined in the same fashion as
+ ACE_WSTRING_TYPE was originally defined.
+
+ * ace/Local_Name_Space.cpp: ACE_NS_WString::char_rep works just
+ fine. We don't need to use ACE_Wide_To_Ascii::convert
+ explicitly since it is not available when ACE_HAS_WCHAR isn't
+ defined.
+
+ * ace/SString.cpp (operator<<): Avoided the problem of printing
+ wchar strings temporarily. Using ACE_Wide_To_Ascii didn't work
+ on platforms that don't support wchar. Thanks to Keith Hamburg
+ for pointing this out.
+
+ * ace/String_Base.cpp: Fixed incorrect RCSID name. Thanks to
+ Keith Hamburg <khamburg@cs.wustl.edu> for reporting it.
+
+ * ace/SString.cpp:
+ * ace/SString.h:
+ * ace/SString.i: Changed ACE_WString to be a typedef of
+ ACE_String_Base<ACE_WSTRING_TYPE> and added a subclass of it
+ called ACE_NS_WString to maintain backward compatibility.
+
+ * tests/Naming_Test.cpp:
+ * ace/Local_Name_Space.cpp:
+ * ace/Local_Name_Space.h:
+ * ace/Local_Name_Space_T.cpp:
+ * ace/Local_Name_Space_T.h:
+ * ace/Name_Space.cpp:
+ * ace/Name_Space.h:
+ * ace/Naming_Context.cpp:
+ * ace/Naming_Context.h:
+ * ace/Remote_Name_Space.cpp:
+ * ace/Remote_Name_Space.h:
+ * netsvcs/clients/Naming/Client/Client_Test.cpp:
+ * netsvcs/lib/Name_Handler.cpp:
+ * netsvcs/lib/Name_Handler.h: Changed the use of ACE_WString to
+ ACE_NS_WString.
+
+ * tests/SString_Test.cpp: Added ACE_TEXT_WIDE to convert char
+ strings to wchar strings for initializing ACE_WString as you can
+ no longer initialize a ACE_WString with a char string.
+
+ * ace/String_Base.h:
+ * ace/String_Base.i:
+ * ace/String_Base.cpp: Abstracted out ACE_CString and ACE_WString
+ into a templatized String_Base.
+
+ * ace/CDR_Stream.h: Removed forward declarating ACE_CString and
+ added inclusion of <SString.h>.
+
+ * ace/SString.h:
+ * ace/SString.i:
+ * ace/SString.cpp: Changed ACE_CString to be a typedef of
+ ACE_String_Base<char>.
+
+ * ace/ace_dll.dsp:
+ * ace/ace_lib.dsp: Added String_Base.* to appropriate folders.
+
Tue Dec 4 20:57:09 2001 Balachandran Natarajan <bala@cs.wustl.edu>
* performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
- * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
+ * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
Added a outgoing queue to the test. This should more or less
represent a simple CORBA invocation. Reduced a call to new to by
- using a shared data block with a lock.
-
+ using a shared data block with a lock.
+
Tue Dec 4 19:10:22 2001 Steve Huston <shuston@riverace.com>
* ace/config-sunos5.6.h: Removed the setting of _POSIX_C_SOURCE to
@@ -42,18 +125,18 @@ Tue Dec 4 10:07:31 2001 Steve Huston <shuston@riverace.com>
Tue Dec 4 06:59:09 2001 Balachandran Natarajan <bala@cs.wustl.edu>
- * performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp:
+ * performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp:
* performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.h:
* performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
- * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
-
+ * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
+
New tests for measuring the throughput of two different server
concurrency architectures. The idea is to make it simpler than
what is already there and hence the tests. The old tests were a
bit confusing and very complicated. The old tests have been
retained. The tests are for getting some ball-park figures for
RT_CORBA and for TAO in general.
-
+
Tue Dec 4 10:00:04 2001 Johnny Willemsen <jwillemsen@remedy.nl>
* examples/Reactor/Multicast/client.cpp:
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 7984930cb8f..9f0cd110a9b 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,12 +1,95 @@
+Tue Dec 04 20:08:49 2001 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ Merged in the new String_Base template class.
+
+ * ace/Makefile: Added String_Base into the list of template
+ files.
+
+ * ace/Basic_Types.h: Added definitions of ACE_WCHAR_T and
+ ACE_WINT_T which are defined to wchat_t and wint_t when
+ ACE_HAS_WCHAR are defined, and ACE_USHORT16 otherwise. They are
+ needed to support various "wide character" string operations
+ that we need to support the templatized ACE_WString, which uses
+ ACE_USHORT16 as the wide char type when wchar_t is not
+ supported.
+
+ * ace/OS_String.h:
+ * ace/OS_String.inl:
+ * ace/OS_String.cpp: Made several wchar version string functions
+ available no matter ACE_HAS_WCHAR is defined or not. There are
+ more functions (the ones that have *_emulation helpers
+ available) that can be made availabe at all time, but I just
+ fixed the ones that ACE_WString needed for now. We can add more
+ later.
+
+ * ace/SString.h: Changed the definition of ACE_WSTRING_TYPE to
+ ACE_WCHAR_T. ACE_WCHAR_T is defined in the same fashion as
+ ACE_WSTRING_TYPE was originally defined.
+
+ * ace/Local_Name_Space.cpp: ACE_NS_WString::char_rep works just
+ fine. We don't need to use ACE_Wide_To_Ascii::convert
+ explicitly since it is not available when ACE_HAS_WCHAR isn't
+ defined.
+
+ * ace/SString.cpp (operator<<): Avoided the problem of printing
+ wchar strings temporarily. Using ACE_Wide_To_Ascii didn't work
+ on platforms that don't support wchar. Thanks to Keith Hamburg
+ for pointing this out.
+
+ * ace/String_Base.cpp: Fixed incorrect RCSID name. Thanks to
+ Keith Hamburg <khamburg@cs.wustl.edu> for reporting it.
+
+ * ace/SString.cpp:
+ * ace/SString.h:
+ * ace/SString.i: Changed ACE_WString to be a typedef of
+ ACE_String_Base<ACE_WSTRING_TYPE> and added a subclass of it
+ called ACE_NS_WString to maintain backward compatibility.
+
+ * tests/Naming_Test.cpp:
+ * ace/Local_Name_Space.cpp:
+ * ace/Local_Name_Space.h:
+ * ace/Local_Name_Space_T.cpp:
+ * ace/Local_Name_Space_T.h:
+ * ace/Name_Space.cpp:
+ * ace/Name_Space.h:
+ * ace/Naming_Context.cpp:
+ * ace/Naming_Context.h:
+ * ace/Remote_Name_Space.cpp:
+ * ace/Remote_Name_Space.h:
+ * netsvcs/clients/Naming/Client/Client_Test.cpp:
+ * netsvcs/lib/Name_Handler.cpp:
+ * netsvcs/lib/Name_Handler.h: Changed the use of ACE_WString to
+ ACE_NS_WString.
+
+ * tests/SString_Test.cpp: Added ACE_TEXT_WIDE to convert char
+ strings to wchar strings for initializing ACE_WString as you can
+ no longer initialize a ACE_WString with a char string.
+
+ * ace/String_Base.h:
+ * ace/String_Base.i:
+ * ace/String_Base.cpp: Abstracted out ACE_CString and ACE_WString
+ into a templatized String_Base.
+
+ * ace/CDR_Stream.h: Removed forward declarating ACE_CString and
+ added inclusion of <SString.h>.
+
+ * ace/SString.h:
+ * ace/SString.i:
+ * ace/SString.cpp: Changed ACE_CString to be a typedef of
+ ACE_String_Base<char>.
+
+ * ace/ace_dll.dsp:
+ * ace/ace_lib.dsp: Added String_Base.* to appropriate folders.
+
Tue Dec 4 20:57:09 2001 Balachandran Natarajan <bala@cs.wustl.edu>
* performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
- * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
+ * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
Added a outgoing queue to the test. This should more or less
represent a simple CORBA invocation. Reduced a call to new to by
- using a shared data block with a lock.
-
+ using a shared data block with a lock.
+
Tue Dec 4 19:10:22 2001 Steve Huston <shuston@riverace.com>
* ace/config-sunos5.6.h: Removed the setting of _POSIX_C_SOURCE to
@@ -42,18 +125,18 @@ Tue Dec 4 10:07:31 2001 Steve Huston <shuston@riverace.com>
Tue Dec 4 06:59:09 2001 Balachandran Natarajan <bala@cs.wustl.edu>
- * performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp:
+ * performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.cpp:
* performance-tests/Server_Concurrency/Leader_Follower/RT_CORBA_Leader_Follower.h:
* performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.h:
- * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
-
+ * performance-tests/Server_Concurrency/Queue_Based_Workers/RT_CORBA_Workers.cpp:
+
New tests for measuring the throughput of two different server
concurrency architectures. The idea is to make it simpler than
what is already there and hence the tests. The old tests were a
bit confusing and very complicated. The old tests have been
retained. The tests are for getting some ball-park figures for
RT_CORBA and for TAO in general.
-
+
Tue Dec 4 10:00:04 2001 Johnny Willemsen <jwillemsen@remedy.nl>
* examples/Reactor/Multicast/client.cpp:
diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h
index 5eddc55fe4c..5769c7cae0a 100644
--- a/ace/Basic_Types.h
+++ b/ace/Basic_Types.h
@@ -204,6 +204,17 @@
typedef ACE_UINT16 ACE_USHORT16;
+// Define a pseudo wide character type when wchar is not supported so we
+// can support basic wide character string operations.
+
+# if defined (ACE_HAS_WCHAR)
+# define ACE_WINT_T wint_t
+# define ACE_WCHAR_T wchar_t
+# else
+# define ACE_WINT_T ACE_USHORT16
+# define ACE_WCHAR_T ACE_USHORT16
+# endif /* ACE_HAS_WCHAR */
+
# if ACE_SIZEOF_INT == 4
typedef int ACE_INT32;
typedef unsigned int ACE_UINT32;
diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h
index ad065753dc7..8b1ac7e9c0f 100644
--- a/ace/CDR_Stream.h
+++ b/ace/CDR_Stream.h
@@ -41,11 +41,11 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+#include "ace/SString.h"
#include "ace/Message_Block.h"
class ACE_Char_Codeset_Translator;
class ACE_WChar_Codeset_Translator;
-class ACE_CString;
class ACE_InputCDR;
@@ -89,7 +89,7 @@ public:
ACE_CDR_GIOP_MINOR_VERSION);
/// Build a CDR stream with an initial buffer, it will *not* remove
- /// <data>, since it did not allocated it. It's important to be careful
+ /// <data>, since it did not allocated it. It's important to be careful
/// with the alignment of <data>.
/**
* Create an output stream from an arbitrary buffer, care must be
@@ -97,7 +97,7 @@ public:
* needed. In this case <data> will not point to the start off the
* output stream. begin()->rd_prt() points to the start off the
* output stream. See ACE_ptr_align_binary() to properly align a
- * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment.
+ * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment.
*/
ACE_OutputCDR (char *data,
size_t size,
diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp
index 306f846848b..ae892b07f5b 100644
--- a/ace/Local_Name_Space.cpp
+++ b/ace/Local_Name_Space.cpp
@@ -23,11 +23,11 @@ ACE_NS_String::fast_rep (void) const
return this->rep_;
}
-ACE_NS_String::operator ACE_WString () const
+ACE_NS_String::operator ACE_NS_WString () const
{
- ACE_TRACE ("ACE_NS_String::operator ACE_WString");
- return ACE_WString (this->rep_,
- (this->len_ / sizeof (ACE_USHORT16)) - 1);
+ ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString");
+ return ACE_NS_WString (this->rep_,
+ (this->len_ / sizeof (ACE_USHORT16)) - 1);
}
size_t
@@ -41,8 +41,8 @@ char *
ACE_NS_String::char_rep (void) const
{
ACE_TRACE ("ACE_NS_String::char_rep");
- ACE_WString w_string (this->rep_,
- (this->len_ / sizeof (ACE_USHORT16)) - 1);
+ ACE_NS_WString w_string (this->rep_,
+ (this->len_ / sizeof (ACE_USHORT16)) - 1);
return w_string.char_rep ();
}
@@ -54,7 +54,7 @@ ACE_NS_String::ACE_NS_String (void)
ACE_TRACE ("ACE_NS_String::ACE_NS_String");
}
-ACE_NS_String::ACE_NS_String (const ACE_WString &s)
+ACE_NS_String::ACE_NS_String (const ACE_NS_WString &s)
: len_ ((s.length () + 1) * sizeof (ACE_USHORT16)),
rep_ (s.ushort_rep ()),
delete_rep_ (1)
@@ -185,9 +185,9 @@ template class ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mu
#endif
template class ACE_Unbounded_Set<ACE_Name_Binding>;
template class ACE_Unbounded_Set_Iterator<ACE_Name_Binding>;
-template class ACE_Unbounded_Set<ACE_WString>;
-template class ACE_Unbounded_Set_Iterator<ACE_WString>;
-template class ACE_Node<ACE_WString>;
+template class ACE_Unbounded_Set<ACE_NS_WString>;
+template class ACE_Unbounded_Set_Iterator<ACE_NS_WString>;
+template class ACE_Node<ACE_NS_WString>;
template class ACE_Node<ACE_Name_Binding>;
template class ACE_Guard<ACE_RW_Process_Mutex>;
template class ACE_Read_Guard<ACE_RW_Process_Mutex>;
@@ -213,9 +213,9 @@ template class ACE_Write_Guard<ACE_RW_Process_Mutex>;
#endif
#pragma instantiate ACE_Unbounded_Set<ACE_Name_Binding>
#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Name_Binding>
-#pragma instantiate ACE_Unbounded_Set<ACE_WString>
-#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_WString>
-#pragma instantiate ACE_Node<ACE_WString>
+#pragma instantiate ACE_Unbounded_Set<ACE_NS_WString>
+#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_NS_WString>
+#pragma instantiate ACE_Node<ACE_NS_WString>
#pragma instantiate ACE_Node<ACE_Name_Binding>
#pragma instantiate ACE_Guard<ACE_RW_Process_Mutex>
#pragma instantiate ACE_Read_Guard<ACE_RW_Process_Mutex>
diff --git a/ace/Local_Name_Space.h b/ace/Local_Name_Space.h
index 285c44a351b..9391cae4053 100644
--- a/ace/Local_Name_Space.h
+++ b/ace/Local_Name_Space.h
@@ -33,7 +33,7 @@
* with the Map_Manager.
*
* In order to work correctly, this class must be able to
- * convert back and forth with <ACE_WStrings>. Note that this
+ * convert back and forth with <ACE_NS_WStrings>. Note that this
* class must not have a destructor since otherwise we'll have
* problems...
*/
@@ -49,14 +49,14 @@ public:
const ACE_USHORT16 *src,
size_t len);
- /// Converts an ACE_WString to an ACE_NS_String;
- ACE_NS_String (const ACE_WString &);
+ /// Converts an ACE_NS_WString to an ACE_NS_String;
+ ACE_NS_String (const ACE_NS_WString &);
/// Destructor
~ACE_NS_String (void);
- /// Converts an ACE_NS_String to fresh copy of an ACE_WString;
- operator ACE_WString () const;
+ /// Converts an ACE_NS_String to fresh copy of an ACE_NS_WString;
+ operator ACE_NS_WString () const;
/// Return the ASCII character representation.
char *char_rep (void) const;
diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp
index 7f38466e3d5..8d81752fd51 100644
--- a/ace/Local_Name_Space_T.cpp
+++ b/ace/Local_Name_Space_T.cpp
@@ -105,10 +105,10 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::remap (EXCEPTION_POINTERS *ep)
#endif /* ACE_WIN32 */
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind (const ACE_WString &name,
- const ACE_WString &value,
- const char *type,
- int rebind)
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
+ const char *type,
+ int rebind)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
@@ -125,10 +125,10 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind (const ACE_WString &
}
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind_i (const ACE_WString &name,
- const ACE_WString &value,
- const char *type,
- int rebind)
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind_i (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
+ const char *type,
+ int rebind)
{
ACE_TRACE ("ACE_Local_Name_Space::shared_bind_i");
@@ -203,7 +203,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind_i (const ACE_WString
}
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const ACE_WString &name)
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const ACE_NS_WString &name)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
@@ -221,7 +221,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const ACE_WString &name)
}
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::unbind_i (const ACE_WString &name)
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::unbind_i (const ACE_NS_WString &name)
{
ACE_TRACE ("ACE_Local_Name_Space::unbind_i");
@@ -242,8 +242,8 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::unbind_i (const ACE_WString &nam
}
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::bind (const ACE_WString &name,
- const ACE_WString &value,
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::bind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type)
{
ACE_TRACE ("ACE_Local_Name_Space::bind");
@@ -253,8 +253,8 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::bind (const ACE_WString &name,
}
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::rebind (const ACE_WString &name,
- const ACE_WString &value,
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::rebind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type)
{
ACE_TRACE ("ACE_Local_Name_Space::rebind");
@@ -264,8 +264,8 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::rebind (const ACE_WString &name,
}
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve (const ACE_WString &name,
- ACE_WString &value,
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve (const ACE_NS_WString &name,
+ ACE_NS_WString &value,
char *&type)
{
// Note that we *must* use structured exception handling here
@@ -284,8 +284,8 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve (const ACE_WString &name
template <ACE_MEM_POOL_1, class ACE_LOCK> int
-ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i (const ACE_WString &name,
- ACE_WString &value,
+ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i (const ACE_NS_WString &name,
+ ACE_NS_WString &value,
char *&type)
{
ACE_TRACE ("ACE_Local_Name_Space::resolve_i");
@@ -300,7 +300,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i (const ACE_WString &na
this->allocator_) != 0)
return -1;
- // Calls conversion operator and then calls the ACE_WString
+ // Calls conversion operator and then calls the ACE_NS_WString
// assignment operator to get a fresh copy. (*#*(@#&!*@!!*@&( HP
// compiler causes us to add an extra copy explicitly !! :)
nbc_string = ns_internal.value ();
@@ -521,7 +521,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::create_manager_i (void)
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_names_i (ACE_PWSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Local_Name_Space::list_names_i");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
@@ -537,7 +537,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_names_i (ACE_PWSTRING_SET &
{
if (map_entry->ext_id_.strstr (pattern) != -1)
{
- ACE_WString entry (map_entry->ext_id_ );
+ ACE_NS_WString entry (map_entry->ext_id_ );
if (set.insert (entry) == -1)
{
@@ -554,7 +554,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_names_i (ACE_PWSTRING_SET &
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_values_i (ACE_PWSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Local_Name_Space::list_values_i");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
@@ -570,7 +570,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_values_i (ACE_PWSTRING_SET
{
if (map_entry->int_id_.value ().strstr (pattern) != -1)
{
- ACE_WString entry (map_entry->int_id_.value ());
+ ACE_NS_WString entry (map_entry->int_id_.value ());
if (set.insert (entry) == -1)
{
@@ -587,7 +587,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_values_i (ACE_PWSTRING_SET
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_types_i (ACE_PWSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Local_Name_Space::list_types_i");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
@@ -636,7 +636,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_types_i (ACE_PWSTRING_SET &
#endif /* ACE_HAS_REGEX */
{
- ACE_WString entry (type);
+ ACE_NS_WString entry (type);
if (set.insert (entry) == -1)
{
@@ -657,7 +657,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_types_i (ACE_PWSTRING_SET &
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space <ACE_MEM_POOL_2, ACE_LOCK>::list_name_entries_i (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Local_Name_Space::list_name_entries_i");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
@@ -685,7 +685,7 @@ ACE_Local_Name_Space <ACE_MEM_POOL_2, ACE_LOCK>::list_name_entries_i (ACE_BINDIN
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_value_entries_i (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Local_Name_Space::list_value_entries_i");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
@@ -712,7 +712,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_value_entries_i (ACE_BINDIN
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_type_entries_i (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Local_Name_Space::list_type_entries_i");
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
@@ -797,7 +797,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::dump_i (void) const
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_names (ACE_PWSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
@@ -815,7 +815,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_names (ACE_PWSTRING_SET &se
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_values (ACE_PWSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
@@ -833,7 +833,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_values (ACE_PWSTRING_SET &s
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_types (ACE_PWSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
@@ -851,7 +851,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_types (ACE_PWSTRING_SET &se
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space <ACE_MEM_POOL_2, ACE_LOCK>::list_name_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
@@ -869,7 +869,7 @@ ACE_Local_Name_Space <ACE_MEM_POOL_2, ACE_LOCK>::list_name_entries (ACE_BINDING_
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_value_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
@@ -887,7 +887,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_value_entries (ACE_BINDING_
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::list_type_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
// Note that we *must* use structured exception handling here
// because (1) we may need to commit virtual memory pages and (2)
diff --git a/ace/Local_Name_Space_T.h b/ace/Local_Name_Space_T.h
index c3891ec14b1..344e8a95511 100644
--- a/ace/Local_Name_Space_T.h
+++ b/ace/Local_Name_Space_T.h
@@ -28,7 +28,7 @@
// A short-hand name for our set of name/value/type tuples passed back
// to callers.
-typedef ACE_Unbounded_Set<ACE_WString> ACE_WSTRING_SET;
+typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET;
// Simplify later usage by defining typedefs.
#if (1)
@@ -129,8 +129,8 @@ public:
~ACE_Local_Name_Space (void);
/// Bind a new name to a naming context (Wide character strings).
- virtual int bind (const ACE_WString &name,
- const ACE_WString &value,
+ virtual int bind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type = "");
/**
@@ -138,44 +138,44 @@ public:
* ACE_Local_Name_Space or bind a new name to the context, if it
* didn't exist yet. (Wide charcter strings interface).
*/
- virtual int rebind (const ACE_WString &name,
- const ACE_WString &value,
+ virtual int rebind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type = "");
/// Delete a name from a ACE_Local_Name_Space (Wide charcter strings
/// Interface).
- virtual int unbind (const ACE_WString &name);
- virtual int unbind_i (const ACE_WString &name);
+ virtual int unbind (const ACE_NS_WString &name);
+ virtual int unbind_i (const ACE_NS_WString &name);
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting <type>!
- virtual int resolve (const ACE_WString &name,
- ACE_WString &value,
+ virtual int resolve (const ACE_NS_WString &name,
+ ACE_NS_WString &value,
char *&type);
- virtual int resolve_i (const ACE_WString &name,
- ACE_WString &value,
+ virtual int resolve_i (const ACE_NS_WString &name,
+ ACE_NS_WString &value,
char *&type);
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
virtual int list_names (ACE_WSTRING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
virtual int list_names_i (ACE_WSTRING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
virtual int list_values (ACE_WSTRING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
virtual int list_values_i (ACE_WSTRING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
virtual int list_types (ACE_WSTRING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
virtual int list_types_i (ACE_WSTRING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/**
* Get a set of names matching a specified pattern (wchars). Matching
@@ -183,9 +183,9 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_name_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
virtual int list_name_entries_i (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/**
* Get a set of values matching a specified pattern (wchars). Matching
@@ -193,9 +193,9 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_value_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
virtual int list_value_entries_i (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/**
* Get a set of types matching a specified pattern (wchars). Matching
@@ -203,16 +203,16 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_type_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
virtual int list_type_entries_i (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/// Dump the state of the object
virtual void dump (void) const;
virtual void dump_i (void) const;
// = I just know this is going to cause problems on some platform...
- typedef ACE_Allocator_Adapter <ACE_Malloc <ACE_MEM_POOL_2, ACE_LOCK> >
+ typedef ACE_Allocator_Adapter <ACE_Malloc <ACE_MEM_POOL_2, ACE_LOCK> >
ALLOCATOR;
private:
@@ -222,11 +222,11 @@ private:
#endif /* ACE_WIN32 */
/// Factor out code from <bind> and <rebind>.
- int shared_bind (const ACE_WString &name,
- const ACE_WString &value,
+ int shared_bind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type, int rebind);
- int shared_bind_i (const ACE_WString &name,
- const ACE_WString &value,
+ int shared_bind_i (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type, int rebind);
/// Allocate the appropriate type of map manager that stores the
diff --git a/ace/Makefile b/ace/Makefile
index b2b648316e3..949ba7bc13c 100644
--- a/ace/Makefile
+++ b/ace/Makefile
@@ -285,6 +285,7 @@ TEMPLATE_FILES = \
Strategies_T \
Stream \
Stream_Modules \
+ String_Base \
Svc_Handler \
Synch_T \
Task_T \
diff --git a/ace/Name_Space.cpp b/ace/Name_Space.cpp
index dbc3c392d6c..363790eac5a 100644
--- a/ace/Name_Space.cpp
+++ b/ace/Name_Space.cpp
@@ -18,9 +18,9 @@ ACE_Name_Binding::~ACE_Name_Binding (void)
ACE_OS::free ((void *) this->type_);
}
-ACE_Name_Binding::ACE_Name_Binding (const ACE_WString &name,
- const ACE_WString &value,
- const char *type)
+ACE_Name_Binding::ACE_Name_Binding (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
+ const char *type)
: name_ (name),
value_ (value),
type_ (type == 0 ? ACE_OS::strdup ("") : ACE_OS::strdup (type))
@@ -46,12 +46,12 @@ ACE_Name_Binding::operator = (const ACE_Name_Binding &s)
this->type_ = ACE_OS::strdup (s.type_);
}
-int
+int
ACE_Name_Binding::operator == (const ACE_Name_Binding &s) const
{
ACE_TRACE ("ACE_Name_Binding::operator ==");
- return this->name_ == s.name_
- && this->value_ == s.value_
+ return this->name_ == s.name_
+ && this->value_ == s.value_
&& ACE_OS::strcmp (this->type_, s.type_) == 0;
}
@@ -59,4 +59,3 @@ ACE_Name_Space::~ACE_Name_Space (void)
{
ACE_TRACE ("ACE_Name_Space::~ACE_Name_Space");
}
-
diff --git a/ace/Name_Space.h b/ace/Name_Space.h
index 839179af741..d4e461750a8 100644
--- a/ace/Name_Space.h
+++ b/ace/Name_Space.h
@@ -25,7 +25,7 @@
#include "ace/Unbounded_Set.h"
#include "ace/Name_Proxy.h"
-typedef ACE_Unbounded_Set<ACE_WString> ACE_WSTRING_SET;
+typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET;
/**
* @class ACE_Name_Binding
@@ -37,8 +37,8 @@ class ACE_Export ACE_Name_Binding
public:
// = Initialization and termination.
/// Main constructor that initializes all the fields.
- ACE_Name_Binding (const ACE_WString &n,
- const ACE_WString &v,
+ ACE_Name_Binding (const ACE_NS_WString &n,
+ const ACE_NS_WString &v,
const char *t);
/// Default constructor.
@@ -57,10 +57,10 @@ public:
int operator == (const ACE_Name_Binding &s) const;
/// Name of the binding.
- ACE_WString name_;
+ ACE_NS_WString name_;
/// Value of the binding.
- ACE_WString value_;
+ ACE_NS_WString value_;
/// Type of the binding.
char *type_;
@@ -69,8 +69,8 @@ public:
typedef ACE_Unbounded_Set<ACE_Name_Binding> ACE_BINDING_SET;
typedef ACE_Unbounded_Set_Iterator<ACE_Name_Binding> ACE_BINDING_ITERATOR;
-typedef ACE_Unbounded_Set<ACE_WString> ACE_PWSTRING_SET;
-typedef ACE_Unbounded_Set_Iterator<ACE_WString> ACE_PWSTRING_ITERATOR;
+typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_PWSTRING_SET;
+typedef ACE_Unbounded_Set_Iterator<ACE_NS_WString> ACE_PWSTRING_ITERATOR;
/**
* @class ACE_Name_Space
@@ -90,8 +90,8 @@ public:
virtual ~ACE_Name_Space (void);
/// Bind a new name to a naming context (Wide character strings).
- virtual int bind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ virtual int bind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in = "") = 0;
@@ -100,34 +100,34 @@ public:
* ACE_Name_Space or bind a new name to the context, if it didn't
* exist yet. (Wide charcter strings interface).
*/
- virtual int rebind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ virtual int rebind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in = "") = 0;
/// Delete a name from a ACE_Name_Space (Wide charcter strings
/// Interface).
- virtual int unbind (const ACE_WString &name_in) = 0;
+ virtual int unbind (const ACE_NS_WString &name_in) = 0;
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting both <value_out> and <type_out>!
- virtual int resolve (const ACE_WString &name_in,
- ACE_WString &value_out,
+ virtual int resolve (const ACE_NS_WString &name_in,
+ ACE_NS_WString &value_out,
char *&type_out) = 0;
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
virtual int list_names (ACE_WSTRING_SET &set_out,
- const ACE_WString &pattern_in) = 0;
+ const ACE_NS_WString &pattern_in) = 0;
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
virtual int list_values (ACE_WSTRING_SET &set_out,
- const ACE_WString &pattern_in) = 0;
+ const ACE_NS_WString &pattern_in) = 0;
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
virtual int list_types (ACE_WSTRING_SET &set_out,
- const ACE_WString &pattern_in) = 0;
+ const ACE_NS_WString &pattern_in) = 0;
/**
* Get a set of names matching a specified pattern (wchars). Matching
@@ -135,7 +135,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_name_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern) = 0;
+ const ACE_NS_WString &pattern) = 0;
/**
* Get a set of values matching a specified pattern (wchars). Matching
@@ -143,7 +143,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_value_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern) = 0;
+ const ACE_NS_WString &pattern) = 0;
/**
* Get a set of types matching a specified pattern (wchars). Matching
@@ -151,7 +151,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_type_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern) = 0;
+ const ACE_NS_WString &pattern) = 0;
/// Dump the state of the object
virtual void dump (void) const = 0;
diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp
index cf86fb0aff4..71f94fe15f9 100644
--- a/ace/Naming_Context.cpp
+++ b/ace/Naming_Context.cpp
@@ -40,7 +40,7 @@ ACE_Naming_Context::info (ACE_TCHAR **strp,
ACE_UNUSED_ARG (length);
ACE_TCHAR buf[BUFSIZ];
- ACE_OS::sprintf (buf,
+ ACE_OS::sprintf (buf,
ACE_LIB_TEXT ("%s\t#%s\n"),
ACE_LIB_TEXT ("ACE_Naming_Context"),
ACE_LIB_TEXT ("Proxy for making calls to a Name Server"));
@@ -172,8 +172,8 @@ ACE_Naming_Context::name_options (void)
}
int
-ACE_Naming_Context::bind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ACE_Naming_Context::bind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in)
{
ACE_TRACE ("ACE_Naming_Context::bind");
@@ -186,14 +186,14 @@ ACE_Naming_Context::bind (const char *name_in,
const char *type_in)
{
ACE_TRACE ("ACE_Naming_Context::bind");
- return this->bind (ACE_WString (name_in),
- ACE_WString (value_in),
+ return this->bind (ACE_NS_WString (name_in),
+ ACE_NS_WString (value_in),
type_in);
}
int
-ACE_Naming_Context::rebind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ACE_Naming_Context::rebind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in)
{
ACE_TRACE ("ACE_Naming_Context::rebind");
@@ -208,14 +208,14 @@ ACE_Naming_Context::rebind (const char *name_in,
const char *type_in)
{
ACE_TRACE ("ACE_Naming_Context::rebind");
- return rebind (ACE_WString (name_in),
- ACE_WString (value_in),
+ return rebind (ACE_NS_WString (name_in),
+ ACE_NS_WString (value_in),
type_in);
}
int
-ACE_Naming_Context::resolve (const ACE_WString &name_in,
- ACE_WString &value_out,
+ACE_Naming_Context::resolve (const ACE_NS_WString &name_in,
+ ACE_NS_WString &value_out,
char *&type_out)
{
ACE_TRACE ("ACE_Naming_Context::resolve");
@@ -226,11 +226,11 @@ ACE_Naming_Context::resolve (const ACE_WString &name_in,
int
ACE_Naming_Context::resolve (const char *name_in,
- ACE_WString &value_out,
+ ACE_NS_WString &value_out,
char *&type_out)
{
ACE_TRACE ("ACE_Naming_Context::resolve");
- return this->resolve (ACE_WString (name_in),
+ return this->resolve (ACE_NS_WString (name_in),
value_out,
type_out);
}
@@ -241,9 +241,9 @@ ACE_Naming_Context::resolve (const char *name_in,
char *&type_out)
{
ACE_TRACE ("ACE_Naming_Context::resolve");
- ACE_WString val_str;
+ ACE_NS_WString val_str;
- if (this->resolve (ACE_WString (name_in),
+ if (this->resolve (ACE_NS_WString (name_in),
val_str,
type_out) == -1)
return -1;
@@ -256,7 +256,7 @@ ACE_Naming_Context::resolve (const char *name_in,
}
int
-ACE_Naming_Context::unbind (const ACE_WString &name_in)
+ACE_Naming_Context::unbind (const ACE_NS_WString &name_in)
{
ACE_TRACE ("ACE_Naming_Context::unbind");
return this->name_space_->unbind (name_in);
@@ -266,12 +266,12 @@ int
ACE_Naming_Context::unbind (const char *name_in)
{
ACE_TRACE ("ACE_Naming_Context::unbind");
- return this->unbind (ACE_WString (name_in));
+ return this->unbind (ACE_NS_WString (name_in));
}
int
ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out,
- const ACE_WString &pattern_in)
+ const ACE_NS_WString &pattern_in)
{
ACE_TRACE ("ACE_Naming_Context::list_names");
return this->name_space_->list_names (set_out,
@@ -284,12 +284,12 @@ ACE_Naming_Context::list_names (ACE_PWSTRING_SET &set_out,
{
ACE_TRACE ("ACE_Naming_Context::list_names");
return this->list_names (set_out,
- ACE_WString (pattern_in));
+ ACE_NS_WString (pattern_in));
}
int
ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out,
- const ACE_WString &pattern_in)
+ const ACE_NS_WString &pattern_in)
{
ACE_TRACE ("ACE_Naming_Context::list_values");
return this->name_space_->list_values (set_out,
@@ -302,12 +302,12 @@ ACE_Naming_Context::list_values (ACE_PWSTRING_SET &set_out,
{
ACE_TRACE ("ACE_Naming_Context::list_values");
return this->list_values (set_out,
- ACE_WString (pattern_in));
+ ACE_NS_WString (pattern_in));
}
int
ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out,
- const ACE_WString &pattern_in)
+ const ACE_NS_WString &pattern_in)
{
ACE_TRACE ("ACE_Naming_Context::list_types");
return this->name_space_->list_types (set_out,
@@ -320,12 +320,12 @@ ACE_Naming_Context::list_types (ACE_PWSTRING_SET &set_out,
{
ACE_TRACE ("ACE_Naming_Context::list_types");
return this->list_types (set_out,
- ACE_WString (pattern_in));
+ ACE_NS_WString (pattern_in));
}
int
ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out,
- const ACE_WString &pattern_in)
+ const ACE_NS_WString &pattern_in)
{
ACE_TRACE ("ACE_Naming_Context::list_name_entries");
return this->name_space_->list_name_entries (set_out,
@@ -338,12 +338,12 @@ ACE_Naming_Context::list_name_entries (ACE_BINDING_SET &set_out,
{
ACE_TRACE ("ACE_Naming_Context::list_name_entries");
return this->list_name_entries (set_out,
- ACE_WString (pattern_in));
+ ACE_NS_WString (pattern_in));
}
int
ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out,
- const ACE_WString &pattern_in)
+ const ACE_NS_WString &pattern_in)
{
ACE_TRACE ("ACE_Naming_Context::list_value_entries");
return this->name_space_->list_value_entries (set_out,
@@ -356,12 +356,12 @@ ACE_Naming_Context::list_value_entries (ACE_BINDING_SET &set_out,
{
ACE_TRACE ("ACE_Naming_Context::list_value_entries");
return this->list_value_entries (set_out,
- ACE_WString (pattern_in));
+ ACE_NS_WString (pattern_in));
}
int
ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out,
- const ACE_WString &pattern_in)
+ const ACE_NS_WString &pattern_in)
{
ACE_TRACE ("ACE_Naming_Context::list_type_entries");
return this->name_space_->list_type_entries (set_out,
@@ -374,7 +374,7 @@ ACE_Naming_Context::list_type_entries (ACE_BINDING_SET &set_out,
{
ACE_TRACE ("ACE_Naming_Context::list_type_entries");
return this->list_type_entries (set_out,
- ACE_WString (pattern_in));
+ ACE_NS_WString (pattern_in));
}
ACE_Naming_Context::~ACE_Naming_Context (void)
diff --git a/ace/Naming_Context.h b/ace/Naming_Context.h
index dab44a13761..605eb7e8e9e 100644
--- a/ace/Naming_Context.h
+++ b/ace/Naming_Context.h
@@ -113,8 +113,8 @@ public:
ACE_Name_Options *name_options (void);
/// Bind a new name to a naming context (Wide character strings).
- int bind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ int bind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in = "");
/// Bind a new name to a naming context ( character strings).
@@ -127,8 +127,8 @@ public:
* ACE_Naming_Context or bind a new name to the context, if it
* didn't exist yet. (Wide charcter strings interface).
*/
- int rebind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ int rebind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in = "");
/**
@@ -142,7 +142,7 @@ public:
/// Delete a name from a ACE_Naming_Context (Wide charcter strings
/// Interface).
- int unbind (const ACE_WString &name_in);
+ int unbind (const ACE_NS_WString &name_in);
/// Delete a name from a ACE_Naming_Context (character strings
/// interface).
@@ -150,8 +150,8 @@ public:
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting both <value_out> and <type_out>!
- int resolve (const ACE_WString &name_in,
- ACE_WString &value_out,
+ int resolve (const ACE_NS_WString &name_in,
+ ACE_NS_WString &value_out,
char *&type_out);
/**
@@ -160,7 +160,7 @@ public:
* <type_out>!
*/
int resolve (const char *name_in,
- ACE_WString &value_out,
+ ACE_NS_WString &value_out,
char *&type_out);
/// Get value and type of a given name binding ( chars ). The caller
@@ -172,7 +172,7 @@ public:
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
int list_names (ACE_PWSTRING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/// Get a set of names matching a specified pattern (chars). Matching
/// means the names must begin with the pattern string.
@@ -182,7 +182,7 @@ public:
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
int list_values (ACE_PWSTRING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/// Get a set of values matching a specified pattern (chars). Matching
/// means the values must begin with the pattern string.
@@ -192,7 +192,7 @@ public:
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
int list_types (ACE_PWSTRING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/// Get a set of types matching a specified pattern (chars). Matching
/// means the types must begin with the pattern string.
@@ -205,7 +205,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_name_entries (ACE_BINDING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/**
* Get a set of names matching a specified pattern (wchars). Matching
@@ -221,7 +221,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_value_entries (ACE_BINDING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/**
* Get a set of values matching a specified pattern (wchars). Matching
@@ -237,7 +237,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_type_entries (ACE_BINDING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/**
* Get a set of types matching a specified pattern (wchars). Matching
diff --git a/ace/OS_String.cpp b/ace/OS_String.cpp
index 0a57afad809..8e00b619361 100644
--- a/ace/OS_String.cpp
+++ b/ace/OS_String.cpp
@@ -45,9 +45,8 @@ ACE_OS_String::strnstr (const char *s1, const char *s2, size_t len2)
return 0;
}
-#if defined (ACE_HAS_WCHAR)
-const wchar_t *
-ACE_OS_String::strnstr (const wchar_t *s1, const wchar_t *s2, size_t len2)
+const ACE_WCHAR_T *
+ACE_OS_String::strnstr (const ACE_WCHAR_T *s1, const ACE_WCHAR_T *s2, size_t len2)
{
// Substring length
size_t len1 = ACE_OS_String::strlen (s1);
@@ -61,14 +60,13 @@ ACE_OS_String::strnstr (const wchar_t *s1, const wchar_t *s2, size_t len2)
for (size_t i = 0; i <= len; i++)
{
- if (ACE_OS_String::memcmp (s1 + i, s2, len2 * sizeof (wchar_t)) == 0)
+ if (ACE_OS_String::memcmp (s1 + i, s2, len2 * sizeof (ACE_WCHAR_T)) == 0)
// Found a match! Return the index.
return s1 + i;
}
return 0;
}
-#endif /* ACE_HAS_WCHAR */
char *
ACE_OS_String::strdup (const char *s)
@@ -155,17 +153,15 @@ ACE_OS_String::strnchr (const char *s, int c, size_t len)
return 0;
}
-#if defined (ACE_HAS_WCHAR)
-const wchar_t *
-ACE_OS_String::strnchr (const wchar_t *s, wint_t c, size_t len)
+const ACE_WCHAR_T *
+ACE_OS_String::strnchr (const ACE_WCHAR_T *s, ACE_WINT_T c, size_t len)
{
for (size_t i = 0; i < len; i++)
- if (s[i] == ACE_static_cast(wchar_t, c))
+ if (s[i] == ACE_static_cast(ACE_WCHAR_T, c))
return s + i;
return 0;
}
-#endif /* ACE_HAS_WCHAR */
#if defined (ACE_LACKS_STRRCHR)
char *
@@ -691,27 +687,27 @@ ACE_OS_String::wcsstr_emulation (const wchar_t *string,
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSLEN)
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
size_t
-ACE_OS_String::wcslen_emulation (const wchar_t *string)
+ACE_OS_String::wcslen_emulation (const ACE_WCHAR_T *string)
{
- const wchar_t *s;
+ const ACE_WCHAR_T *s;
for (s = string; *s; ++s);
return s - string;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSLEN */
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCPY)
-wchar_t *
-ACE_OS_String::wcsncpy_emulation (wchar_t *destination,
- const wchar_t *source,
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
+ACE_WCHAR_T *
+ACE_OS_String::wcsncpy_emulation (ACE_WCHAR_T *destination,
+ const ACE_WCHAR_T *source,
size_t len)
{
if (len != 0)
{
- wchar_t *d = destination;
- const wchar_t *s = source;
+ ACE_WCHAR_T *d = destination;
+ const ACE_WCHAR_T *s = source;
do
{
@@ -727,19 +723,19 @@ ACE_OS_String::wcsncpy_emulation (wchar_t *destination,
return destination;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCPY */
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCMP)
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
int
-ACE_OS_String::wcscmp_emulation (const wchar_t *string1,
- const wchar_t *string2)
+ACE_OS_String::wcscmp_emulation (const ACE_WCHAR_T *string1,
+ const ACE_WCHAR_T *string2)
{
while (*string1 == *string2++)
if (*string1++ == 0)
return (0);
return (*string1 - *--string2);
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCMP */
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY)
wchar_t *
@@ -832,10 +828,10 @@ ACE_OS_String::wcschr_emulation (const wchar_t *string, wint_t c)
}
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCMP)
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
int
-ACE_OS_String::wcsncmp_emulation (const wchar_t *s1,
- const wchar_t *s2,
+ACE_OS_String::wcsncmp_emulation (const ACE_WCHAR_T *s1,
+ const ACE_WCHAR_T *s2,
size_t len)
{
if (len == 0)
@@ -851,7 +847,7 @@ ACE_OS_String::wcsncmp_emulation (const wchar_t *s1,
return 0;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCMP */
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
#if defined (ACE_LACKS_STRTOL)
long
diff --git a/ace/OS_String.h b/ace/OS_String.h
index 6d40c321a80..04baff54f40 100644
--- a/ace/OS_String.h
+++ b/ace/OS_String.h
@@ -23,7 +23,7 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/OS_Export.h"
+#include "ace/Basic_Types.h"
#include /**/ <stddef.h>
#if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
@@ -44,7 +44,7 @@ public:
*
* Included are the functions defined in <cstring> and their <cwchar>
* equivalents.
- *
+ *
* @todo To be complete, we should add strcoll, and strxfrm.
*/
//@{
@@ -96,10 +96,8 @@ public:
/// Compares two strings (char version).
static int strcmp (const char *s, const char *t);
-#if defined (ACE_HAS_WCHAR)
/// Compares two strings (wchar_t version).
- static int strcmp (const wchar_t *s, const wchar_t *t);
-#endif /* ACE_HAS_WCHAR */
+ static int strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t);
/// Copies a string (char version).
static char *strcpy (char *s, const char *t);
@@ -121,14 +119,12 @@ public:
/// Returns a system error message.
static char *strerror (int errnum);
-
+
/// Finds the length of a string (char version).
static size_t strlen (const char *s);
-#if defined (ACE_HAS_WCHAR)
- /// Finds the length of a string (wchar_t version).
- static size_t strlen (const wchar_t *s);
-#endif /* ACE_HAS_WCHAR */
+ /// Finds the length of a string (ACE_WCHAR_T version).
+ static size_t strlen (const ACE_WCHAR_T *s);
/// Appends part of a string to another string (char version).
static char *strncat (char *s, const char *t, size_t len);
@@ -141,18 +137,14 @@ public:
/// Compares two arrays (char version).
static int strncmp (const char *s, const char *t, size_t len);
-#if defined (ACE_HAS_WCHAR)
/// Compares two arrays (wchar_t version).
- static int strncmp (const wchar_t *s, const wchar_t *t, size_t len);
-#endif /* ACE_HAS_WCHAR */
+ static int strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
/// Copies an array (char version)
static char *strncpy (char *s, const char *t, size_t len);
-#if defined (ACE_HAS_WCHAR)
- /// Copies an array (wchar_t version)
- static wchar_t *strncpy (wchar_t *s, const wchar_t *t, size_t len);
-#endif /* ACE_HAS_WCHAR */
+ /// Copies an array (ACE_WCHAR_T version)
+ static ACE_WCHAR_T *strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
/// Searches for characters in a string (const char version).
static const char *strpbrk (const char *s1, const char *s2);
@@ -283,19 +275,15 @@ public:
/// version).
static const char *strnchr (const char *s, int c, size_t len);
-#if defined (ACE_HAS_WCHAR)
- /// Finds the first occurance of a character in an array (const wchar_t
+ /// Finds the first occurance of a character in an array (const ACE_WCHAR_T
/// version).
- static const wchar_t *strnchr (const wchar_t *s, wint_t c, size_t len);
-#endif /* ACE_HAS_WCHAR */
+ static const ACE_WCHAR_T *strnchr (const ACE_WCHAR_T *s, ACE_WINT_T c, size_t len);
/// Finds the first occurance of a character in an array (char version).
static char *strnchr (char *s, int c, size_t len);
-#if defined (ACE_HAS_WCHAR)
- /// Finds the first occurance of a character in an array (wchar_t version).
- static wchar_t *strnchr (wchar_t *s, wint_t c, size_t len);
-#endif /* ACE_HAS_WCHAR */
+ /// Finds the first occurance of a character in an array (ACE_WCHAR_T version).
+ static ACE_WCHAR_T *strnchr (ACE_WCHAR_T *s, ACE_WINT_T c, size_t len);
/// Compares two arrays (case insensitive const char version).
static int strncasecmp (const char *s, const char *t, size_t len);
@@ -355,27 +343,23 @@ public:
static wchar_t *strsncpy (wchar_t *dst,
const wchar_t *src,
size_t maxlen);
-#endif /* ACE_HAS_WCHAR */
+#endif /* ACE_HAS_WCHAR */
/// Finds the first occurance of a substring in an array (const char
/// version).
static const char *strnstr (const char *s, const char *t, size_t len);
-#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a substring in an array (const wchar_t
/// version).
- static const wchar_t *strnstr (const wchar_t *s,
- const wchar_t *t,
- size_t len);
-#endif /* ACE_HAS_WCHAR */
+ static const ACE_WCHAR_T *strnstr (const ACE_WCHAR_T *s,
+ const ACE_WCHAR_T *t,
+ size_t len);
/// Finds the first occurance of a substring in an array (char version).
static char *strnstr (char *s, const char *t, size_t len);
-#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a substring in an array (wchar_t version).
- static wchar_t *strnstr (wchar_t *s, const wchar_t *t, size_t len);
-#endif /* ACE_HAS_WCHAR */
+ static ACE_WCHAR_T *strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
/// Returns a malloced duplicated string (char version).
static char *strdup (const char *s);
@@ -491,7 +475,7 @@ private:
#if defined (ACE_LACKS_STRSPN)
/// Emulated wcsspn.
- static size_t strspn_emulation (const char *string,
+ static size_t strspn_emulation (const char *string,
const char *charset);
#endif /* ACE_LACKS_STRSPN */
@@ -500,8 +484,8 @@ private:
#endif /* ACE_LACKS_STRTOL */
#if defined (ACE_LACKS_STRTOUL)
- static unsigned long strtoul_emulation (const char *nptr,
- char **endptr,
+ static unsigned long strtoul_emulation (const char *nptr,
+ char **endptr,
int base);
#endif /* ACE_LACKS_STRTOUL */
@@ -516,10 +500,10 @@ private:
static wchar_t *wcschr_emulation (const wchar_t *string, wint_t c);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCMP)
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
/// Emulated wcscmp - Compares strings.
- static int wcscmp_emulation (const wchar_t *string1, const wchar_t *string2);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCMP */
+ static int wcscmp_emulation (const ACE_WCHAR_T *string1, const ACE_WCHAR_T *string2);
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY)
/// Emulated wcscpy - Copies a string.
@@ -533,10 +517,10 @@ private:
const wchar_t *string2);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSLEN)
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
/// Emulated wcslen - Returns the length of a string.
- static size_t wcslen_emulation (const wchar_t *string);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSLEN */
+ static size_t wcslen_emulation (const ACE_WCHAR_T *string);
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCAT)
/// Emulated wcscat - Appends a string.
@@ -545,19 +529,19 @@ private:
size_t count);
#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCMP)
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
/// Emulated wcsncmp - Compares two arrays.
- static int wcsncmp_emulation (const wchar_t *string1,
- const wchar_t *string2,
+ static int wcsncmp_emulation (const ACE_WCHAR_T *string1,
+ const ACE_WCHAR_T *string2,
size_t len);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCMP */
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCPY)
+#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
/// Emulated wcsncpy - Copies an array.
- static wchar_t *wcsncpy_emulation (wchar_t *destination,
- const wchar_t *source,
- size_t len);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCPY */
+ static ACE_WCHAR_T *wcsncpy_emulation (ACE_WCHAR_T *destination,
+ const ACE_WCHAR_T *source,
+ size_t len);
+#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP)
/// Emulated wcsnicmp - Performs a case insensitive comparison of two
diff --git a/ace/OS_String.inl b/ace/OS_String.inl
index 6f2e8e79583..fd77c417ea8 100644
--- a/ace/OS_String.inl
+++ b/ace/OS_String.inl
@@ -176,17 +176,15 @@ ACE_OS_String::strcmp (const char *s, const char *t)
#endif /* ACE_HAS_PACE */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
-ACE_OS_String::strcmp (const wchar_t *s, const wchar_t *t)
+ACE_OS_String::strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t)
{
-# if defined (ACE_LACKS_WCSCMP)
+# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
return ACE_OS_String::wcscmp_emulation (s, t);
-# else /* ACE_LACKS_WCSCMP */
+# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
return ::wcscmp (s, t);
-# endif /* ACE_LACKS_WCSCMP */
+# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS_String::strcpy (char *s, const char *t)
@@ -254,17 +252,15 @@ ACE_OS_String::strlen (const char *s)
#endif /* ACE_HAS_PACE */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE size_t
-ACE_OS_String::strlen (const wchar_t *s)
+ACE_OS_String::strlen (const ACE_WCHAR_T *s)
{
-# if defined (ACE_LACKS_WCSLEN)
+# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
return ACE_OS_String::wcslen_emulation (s);
-# else /* ACE_LACKS_WCSLEN */
+# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
return ::wcslen (s);
-# endif /* ACE_LACKS_WCSLEN */
+# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS_String::strncat (char *s, const char *t, size_t len)
@@ -298,17 +294,15 @@ ACE_OS_String::strncmp (const char *s, const char *t, size_t len)
#endif /* ACE_HAS_PACE */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
-ACE_OS_String::strncmp (const wchar_t *s, const wchar_t *t, size_t len)
+ACE_OS_String::strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
{
-# if defined (ACE_LACKS_WCSNCMP)
+# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
return ACE_OS_String::wcsncmp_emulation (s, t, len);
-# else /* ACE_LACKS_WCSNCMP */
+# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
return ::wcsncmp (s, t, len);
-# endif /* ACE_LACKS_WCSNCMP */
+# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS_String::strncpy (char *s, const char *t, size_t len)
@@ -320,17 +314,15 @@ ACE_OS_String::strncpy (char *s, const char *t, size_t len)
#endif /* ACE_HAS_PACE */
}
-#if defined (ACE_HAS_WCHAR)
-ACE_INLINE wchar_t *
-ACE_OS_String::strncpy (wchar_t *s, const wchar_t *t, size_t len)
+ACE_INLINE ACE_WCHAR_T *
+ACE_OS_String::strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
{
-# if defined (ACE_LACKS_WCSNCPY)
+# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
return ACE_OS_String::wcsncpy_emulation (s, t, len);
-# else /* ACE_LACKS_WCSNCPY */
+# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
return ::wcsncpy (s, t, len);
-# endif /* ACE_LACKS_WCSNCPY */
+# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE const char *
ACE_OS_String::strpbrk (const char *s1, const char *s2)
@@ -619,14 +611,12 @@ ACE_OS_String::strnchr (char *s, int c, size_t len)
#endif
}
-#if defined (ACE_HAS_WCHAR)
-ACE_INLINE wchar_t *
-ACE_OS_String::strnchr (wchar_t *s, wint_t c, size_t len)
+ACE_INLINE ACE_WCHAR_T *
+ACE_OS_String::strnchr (ACE_WCHAR_T *s, ACE_WINT_T c, size_t len)
{
- return ACE_const_cast (wchar_t *,
- ACE_OS_String::strnchr (ACE_static_cast (const wchar_t *, s), c, len));
+ return ACE_const_cast (ACE_WCHAR_T *,
+ ACE_OS_String::strnchr (ACE_static_cast (const ACE_WCHAR_T *, s), c, len));
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS_String::strncasecmp (const char *s, const char *t, size_t len)
@@ -663,14 +653,12 @@ ACE_OS_String::strnstr (char *s, const char *t, size_t len)
#endif
}
-#if defined (ACE_HAS_WCHAR)
-ACE_INLINE wchar_t *
-ACE_OS_String::strnstr (wchar_t *s, const wchar_t *t, size_t len)
+ACE_INLINE ACE_WCHAR_T *
+ACE_OS_String::strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
{
- return ACE_const_cast (wchar_t *,
- ACE_OS_String::strnstr (ACE_static_cast (const wchar_t *, s), t, len));
+ return ACE_const_cast (ACE_WCHAR_T *,
+ ACE_OS_String::strnstr (ACE_static_cast (const ACE_WCHAR_T *, s), t, len));
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS_String::strtok_r (char *s, const char *tokens, char **lasts)
diff --git a/ace/Remote_Name_Space.cpp b/ace/Remote_Name_Space.cpp
index d376729ff23..bc906f917a5 100644
--- a/ace/Remote_Name_Space.cpp
+++ b/ace/Remote_Name_Space.cpp
@@ -38,8 +38,8 @@ ACE_Remote_Name_Space::ACE_Remote_Name_Space (const ACE_TCHAR *hostname,
}
int
-ACE_Remote_Name_Space::bind (const ACE_WString &name,
- const ACE_WString &value,
+ACE_Remote_Name_Space::bind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type)
{
ACE_TRACE ("ACE_Remote_Name_Space::bind");
@@ -56,8 +56,8 @@ ACE_Remote_Name_Space::bind (const ACE_WString &name,
}
int
-ACE_Remote_Name_Space::rebind (const ACE_WString &name,
- const ACE_WString &value,
+ACE_Remote_Name_Space::rebind (const ACE_NS_WString &name,
+ const ACE_NS_WString &value,
const char *type)
{
ACE_TRACE ("ACE_Remote_Name_Space::rebind");
@@ -74,8 +74,8 @@ ACE_Remote_Name_Space::rebind (const ACE_WString &name,
}
int
-ACE_Remote_Name_Space::resolve (const ACE_WString &name,
- ACE_WString &value,
+ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name,
+ ACE_NS_WString &value,
char *&type)
{
ACE_TRACE ("ACE_Remote_Name_Space::resolve");
@@ -93,7 +93,7 @@ ACE_Remote_Name_Space::resolve (const ACE_WString &name,
if (this->ns_proxy_.recv_reply (reply) == -1)
return -1;
- ACE_WString temp (reply.value (), reply.value_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (ACE_USHORT16));
value = temp;
ACE_NEW_RETURN (type,
char[reply.type_len () + 1],
@@ -103,7 +103,7 @@ ACE_Remote_Name_Space::resolve (const ACE_WString &name,
}
int
-ACE_Remote_Name_Space::unbind (const ACE_WString &name)
+ACE_Remote_Name_Space::unbind (const ACE_NS_WString &name)
{
ACE_TRACE ("ACE_Remote_Name_Space::unbind");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> name_urep (name.ushort_rep ());
@@ -116,7 +116,7 @@ ACE_Remote_Name_Space::unbind (const ACE_WString &name)
int
ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_names");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> pattern_urep (pattern.ushort_rep ());
@@ -138,8 +138,8 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
-1);
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
- ACE_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString name (reply.name (),
+ reply.name_len () / sizeof (ACE_USHORT16));
set.insert (name);
}
}
@@ -148,7 +148,7 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
int
ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_values");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> pattern_urep (pattern.ushort_rep ());
@@ -170,8 +170,8 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
-1);
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
- ACE_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString value (reply.value (),
+ reply.value_len () / sizeof (ACE_USHORT16));
set.insert (value);
}
}
@@ -181,7 +181,7 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
int
ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_types");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> pattern_urep (pattern.ushort_rep ());
@@ -204,7 +204,7 @@ ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set,
-1);
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
- ACE_WString type (reply.type ());
+ ACE_NS_WString type (reply.type ());
set.insert (type);
}
}
@@ -214,7 +214,7 @@ ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set,
int
ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_name_entries");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> pattern_urep (pattern.ushort_rep ());
@@ -237,10 +237,10 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
-1);
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
- ACE_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_USHORT16));
- ACE_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString name (reply.name (),
+ reply.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString value (reply.value (),
+ reply.value_len () / sizeof (ACE_USHORT16));
ACE_Name_Binding entry (name,
value,
reply.type ());
@@ -253,7 +253,7 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
int
ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_value_entries");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> pattern_urep (pattern.ushort_rep ());
@@ -276,10 +276,10 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
-1);
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
- ACE_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_USHORT16));
- ACE_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString name (reply.name (),
+ reply.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString value (reply.value (),
+ reply.value_len () / sizeof (ACE_USHORT16));
ACE_Name_Binding entry (name,
value,
reply.type());
@@ -292,7 +292,7 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
int
ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern)
+ const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_type_entries");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> pattern_urep (pattern.ushort_rep ());
@@ -315,10 +315,10 @@ ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set,
-1);
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
- ACE_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_USHORT16));
- ACE_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString name (reply.name (),
+ reply.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString value (reply.value (),
+ reply.value_len () / sizeof (ACE_USHORT16));
ACE_Name_Binding entry (name,
value,
reply.type ());
@@ -347,6 +347,5 @@ ACE_Remote_Name_Space::dump (void) const
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Auto_Basic_Array_Ptr<ACE_USHORT16>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Auto_Basic_Array_Ptr<ACE_USHORT16>
+#pragma instantiate ACE_Auto_Basic_Array_Ptr<ACE_USHORT16>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
diff --git a/ace/Remote_Name_Space.h b/ace/Remote_Name_Space.h
index 6d5d8a5ab15..968278a74c5 100644
--- a/ace/Remote_Name_Space.h
+++ b/ace/Remote_Name_Space.h
@@ -25,7 +25,7 @@
#include "ace/Name_Proxy.h"
#include "ace/Name_Space.h"
-typedef ACE_Unbounded_Set<ACE_WString> ACE_WSTRING_SET;
+typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET;
/**
* @class ACE_Remote_Name_Space
@@ -66,8 +66,8 @@ public:
~ACE_Remote_Name_Space (void);
/// Bind a new name to a naming context (Wide character strings).
- virtual int bind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ virtual int bind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in = "");
/**
@@ -75,34 +75,34 @@ public:
* ACE_Remote_Name_Space or bind a new name to the context, if it
* didn't exist yet. (Wide charcter strings interface).
*/
- virtual int rebind (const ACE_WString &name_in,
- const ACE_WString &value_in,
+ virtual int rebind (const ACE_NS_WString &name_in,
+ const ACE_NS_WString &value_in,
const char *type_in = "");
/// Delete a name from a ACE_Remote_Name_Space (Wide charcter strings
/// Interface).
- virtual int unbind (const ACE_WString &name_in);
+ virtual int unbind (const ACE_NS_WString &name_in);
/// Get value and type of a given name binding (Wide chars). The
/// caller is responsible for deleting both <value_out> and <type_out>!
- virtual int resolve (const ACE_WString &name_in,
- ACE_WString &value_out,
+ virtual int resolve (const ACE_NS_WString &name_in,
+ ACE_NS_WString &value_out,
char *&type_out);
/// Get a set of names matching a specified pattern (wchars). Matching
/// means the names must begin with the pattern string.
virtual int list_names (ACE_WSTRING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/// Get a set of values matching a specified pattern (wchars). Matching
/// means the values must begin with the pattern string.
virtual int list_values (ACE_WSTRING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/// Get a set of types matching a specified pattern (wchars). Matching
/// means the types must begin with the pattern string.
virtual int list_types (ACE_WSTRING_SET &set_out,
- const ACE_WString &pattern_in);
+ const ACE_NS_WString &pattern_in);
/**
* Get a set of names matching a specified pattern (wchars). Matching
@@ -110,7 +110,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_name_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/**
* Get a set of values matching a specified pattern (wchars). Matching
@@ -118,7 +118,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_value_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/**
* Get a set of types matching a specified pattern (wchars). Matching
@@ -126,7 +126,7 @@ public:
* complete binding associated each pattern match.
*/
virtual int list_type_entries (ACE_BINDING_SET &set,
- const ACE_WString &pattern);
+ const ACE_NS_WString &pattern);
/// Dump the state of the object.
virtual void dump (void) const;
diff --git a/ace/SString.cpp b/ace/SString.cpp
index fd646bbf447..5129db623b1 100644
--- a/ace/SString.cpp
+++ b/ace/SString.cpp
@@ -223,14 +223,6 @@ EXIT_LABEL:
// ************************************************************
-ACE_ALLOC_HOOK_DEFINE(ACE_CString)
-
-char ACE_CString::NULL_CString_ = '\0';
-ACE_WSTRING_TYPE ACE_WString::NULL_WString_ = '\0';
-const int ACE_CString::npos = -1;
-const int ACE_SString::npos = -1;
-const int ACE_WString::npos = -1;
-
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_OSTREAM_TYPE &
operator<< (ACE_OSTREAM_TYPE &os, const ACE_CString &cs)
@@ -243,11 +235,14 @@ operator<< (ACE_OSTREAM_TYPE &os, const ACE_CString &cs)
ACE_OSTREAM_TYPE &
operator<< (ACE_OSTREAM_TYPE &os, const ACE_WString &ws)
{
- if (ws.fast_rep () != 0)
- {
- ACE_Auto_Basic_Array_Ptr<char> char_string(ws.char_rep ());
- os << char_string.get ();
- }
+ // @@ Need to figure out how to print the "wide" string
+ // on platforms that don't support "wide" strings.
+#if defined (ACE_HAS_WCHAR)
+ os << ACE_Wide_To_Ascii (ws.fast_rep ()).char_rep ();
+#else
+ ACE_UNUSED_ARG (ws);
+ os << "(*non-printable string*)";
+#endif
return os;
}
@@ -260,184 +255,102 @@ operator<< (ACE_OSTREAM_TYPE &os, const ACE_SString &ss)
}
#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
-// Constructor that copies <s> into dynamically allocated memory.
-// Probable loss of data. Please use with care.
-
-ACE_CString::ACE_CString (const ACE_WSTRING_TYPE *s,
- ACE_Allocator *alloc)
- : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
- len_ (0),
- buf_len_ (0),
- rep_ (0),
- release_ (0)
+char *
+ACE_NS_WString::char_rep (void) const
{
- ACE_TRACE ("ACE_CString::ACE_CString");
-
- if (s == 0 || s[0] == (ACE_WSTRING_TYPE) '\0')
- {
- this->release_ = 0;
- this->len_ = 0;
- this->rep_ = &ACE_CString::NULL_CString_;
- }
+ ACE_TRACE ("ACE_NS_WString::char_rep");
+ if (this->len_ <= 0)
+ return 0;
else
{
- this->release_ = 1;
+ char *t;
- size_t len = ACE_WString::strlen (s);
- ACE_ALLOCATOR (this->rep_,
- (char *) this->allocator_->malloc (len + 1));
- this->len_ = len;
- this->buf_len_ = len + 1;
+ ACE_NEW_RETURN (t,
+ char[this->len_ + 1],
+ 0);
- // Copy the ACE_WSTRING_TYPE * string byte-by-byte into the char *
- // string.
for (size_t i = 0; i < this->len_; i++)
- this->rep_[i] = char (s[i]);
+ // Note that this cast may lose data if wide chars are
+ // actually used!
+ t[i] = char (this->rep_[i]);
- this->rep_[this->len_] = '\0';
+ t[this->len_] = '\0';
+ return t;
}
}
-// this method might benefit from a little restructuring.
-void
-ACE_CString::set (const char *s,
- size_t len,
- int release)
+ACE_USHORT16 *
+ACE_NS_WString::ushort_rep (void) const
{
- // Case 1. Going from memory to more memory
- size_t new_buf_len = len + 1;
- if (s != 0 && len != 0 && release && this->buf_len_ < new_buf_len)
+ ACE_TRACE ("ACE_NS_WString::ushort_rep");
+ if (this->len_ <= 0)
+ return 0;
+ else
{
- char *temp;
- ACE_ALLOCATOR (temp,
- (char *) this->allocator_->malloc (new_buf_len));
-
- if (this->release_)
- this->allocator_->free (this->rep_);
+ ACE_USHORT16 *t;
- this->rep_ = temp;
- this->buf_len_ = new_buf_len;
- this->release_ = 1;
- this->len_ = len;
- ACE_OS::memcpy (this->rep_, s, len);
- // NUL terminate.
- this->rep_[len] = '\0';
- }
+ ACE_NEW_RETURN (t,
+ ACE_USHORT16[this->len_ + 1],
+ 0);
- // Case 2. No memory allocation is necessary.
- else
- {
- // Free memory if necessary and figure out future ownership
- if (!release || s == 0 || len == 0)
- if (this->release_)
- {
- this->allocator_->free (this->rep_);
- this->release_ = 0;
- }
- // else - stay with whatever value for release_ we have.
+ for (size_t i = 0; i < this->len_; i++)
+ // Note that this cast may lose data if wide chars are
+ // actually used!
+ t[i] = (ACE_USHORT16)this->rep_[i];
- // Populate data.
- if (s == 0 || len == 0)
- {
- this->buf_len_ = 0;
- this->len_ = 0;
- this->rep_ = &ACE_CString::NULL_CString_;
- }
- else if (!release)
- {
- this->buf_len_ = len;
- this->len_ = len;
- this->rep_ = (char *) s;
- }
- else
- {
- ACE_OS::memcpy (this->rep_, s, len);
- // NUL terminate.
- this->rep_[len] = 0;
- this->len_ = len;
- }
+ t[this->len_] = 0;
+ return t;
}
}
-// Return substring.
-ACE_CString
-ACE_CString::substring (size_t offset,
- ssize_t length) const
-{
- ACE_CString nil;
- size_t count = length;
-
- // case 1. empty string
- if (this->len_ == 0)
- return nil;
-
- // case 2. start pos past our end
- if (offset >= this->len_)
- return nil;
- // No length == empty string.
- else if (length == 0)
- return nil;
- // Get all remaining bytes.
- else if (length == -1 || count > (this->len_ - offset))
- count = this->len_ - offset;
-
- return ACE_CString (&this->rep_[offset],
- count,
- this->allocator_);
-}
+const int ACE_SString::npos = -1;
-// Concat operator (does copy memory).
+ACE_ALLOC_HOOK_DEFINE(ACE_SString)
-ACE_CString &
-ACE_CString::operator+= (const ACE_CString &s)
+ACE_NS_WString::ACE_NS_WString (const char *s,
+ ACE_Allocator *alloc)
+ : ACE_WString (alloc)
{
- ACE_TRACE ("ACE_CString::operator+=");
-
- if (s.len_ > 0)
- {
- size_t new_buf_len = this->len_ + s.len_ + 1;
-
- // case 1. No memory allocation needed.
- if (this->buf_len_ >= new_buf_len)
- // Copy in data from new string.
- ACE_OS::memcpy (this->rep_ + this->len_,
- s.rep_,
- s.len_);
-
- // case 2. Memory reallocation is needed
- else
- {
- char *t = 0;
+ if (s == 0)
+ return;
- ACE_ALLOCATOR_RETURN (t,
- (char *) this->allocator_->malloc (new_buf_len),
- *this);
+ this->buf_len_ = ACE_OS_String::strlen (s);
- // Copy memory from old string into new string.
- ACE_OS::memcpy (t,
- this->rep_,
- this->len_);
+ if (this->buf_len_ == 0)
+ return;
- ACE_OS::memcpy (t + this->len_,
- s.rep_,
- s.len_);
+ ACE_ALLOCATOR (this->rep_,
+ (ACE_WSTRING_TYPE *)
+ this->allocator_->malloc ((this->buf_len_ + 1) *
+ sizeof (ACE_WSTRING_TYPE)));
+ this->release_ = 1;
+ for (size_t i = 0; i <= this->buf_len_; i++)
+ this->rep_[i] = s[i];
+}
- if (this->release_)
- this->allocator_->free (this->rep_);
+#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
+ACE_NS_WString::ACE_NS_WString (const ACE_USHORT16 *s,
+ size_t len,
+ ACE_Allocator *alloc = 0)
+ : ACE_WString (alloc)
+{
+ if (s == 0)
+ return;
- this->release_ = 1;
- this->rep_ = t;
- this->buf_len_ = new_buf_len;
- }
+ this->buf_len_ = len;
- this->len_ += s.len_;
- this->rep_[this->len_] = '\0';
- }
+ if (this->buf_len_ == 0)
+ return;
- return *this;
+ ACE_ALLOCATOR (this->rep_,
+ (ACE_WSTRING_TYPE *)
+ this->allocator_->malloc ((this->buf_len_) *
+ sizeof (ACE_WSTRING_TYPE)));
+ this->release_ = 1;
+ for (int i = 0; i <= this->buf_len_; i++)
+ this->rep_[i] = s[i];
}
-
-ACE_ALLOC_HOOK_DEFINE(ACE_SString)
+#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
void
ACE_SString::dump (void) const
@@ -609,465 +522,10 @@ ACE_SString::substring (size_t offset,
return ACE_SString (&rep_[offset], count, this->allocator_);
}
-ACE_ALLOC_HOOK_DEFINE(ACE_WString)
-
-void
-ACE_WString::dump (void) const
-{
- ACE_TRACE ("ACE_WString::dump");
-}
-
-// Default constructor.
-
-ACE_WString::ACE_WString (ACE_Allocator *alloc)
- : allocator_ (alloc),
- buf_len_ (0),
- len_ (0),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-}
-
-/* static */
-size_t
-ACE_WString::strlen (const ACE_WSTRING_TYPE *s)
-{
- ACE_TRACE ("ACE_WString::strlen");
-
-#if defined (ACE_HAS_WCHAR)
- return ACE_OS::strlen (s);
-#else /* ACE_HAS_WCHAR */
- size_t len;
-
- for (len = 0;
- *s++ != 0;
- ++len)
- continue;
-
- return len;
-#endif /* ACE_HAS_WCHAR */
-}
-
-// Get the underlying pointer as an ASCII char.
-
-char *
-ACE_WString::char_rep (void) const
-{
- ACE_TRACE ("ACE_WString::char_rep");
- if (this->len_ <= 0)
- return 0;
- else
- {
- char *t;
-
- ACE_NEW_RETURN (t,
- char[this->len_ + 1],
- 0);
-
- for (size_t i = 0; i < this->len_; i++)
- // Note that this cast may lose data if wide chars are
- // actually used!
- t[i] = char (this->rep_[i]);
-
- t[this->len_] = '\0';
- return t;
- }
-}
-
-// Get the underlying pointer as an ASCII char.
-
-ACE_USHORT16 *
-ACE_WString::ushort_rep (void) const
-{
- ACE_TRACE ("ACE_WString::ushort_rep");
- if (this->len_ <= 0)
- return 0;
- else
- {
- ACE_USHORT16 *t;
-
- ACE_NEW_RETURN (t,
- ACE_USHORT16[this->len_ + 1],
- 0);
-
- for (size_t i = 0; i < this->len_; i++)
- // Note that this cast may lose data if wide chars are
- // actually used!
- t[i] = (ACE_USHORT16)this->rep_[i];
-
- t[this->len_] = 0;
- return t;
- }
-}
-
-// Constructor that actually copies memory.
-
-ACE_WString::ACE_WString (const char *s,
- ACE_Allocator *alloc)
- : allocator_ (alloc),
- buf_len_ (0),
- len_ (0),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- if (s != 0)
- {
- this->len_ = ACE_OS::strlen (s);
- this->check_allocate (this->len_ + 1);
-
- // Copy the char * string byte-by-byte into the ACE_WSTRING_TYPE
- // * string.
- for (size_t i = 0; i < this->len_; i++)
- this->rep_[i] = s[i];
-
- // null terminate
- this->rep_[this->len_] = 0;
- }
-}
-
-// Constructor that actually copies memory.
-
-ACE_WString::ACE_WString (const ACE_WSTRING_TYPE *s,
- ACE_Allocator *alloc)
- : allocator_ (alloc),
- buf_len_ (0),
- len_ (0),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- if (s != 0)
- {
- this->len_ = ACE_WString::strlen (s);
- this->check_allocate (this->len_ + 1);
-
- ACE_OS::memcpy (this->rep_,
- s,
- this->len_ * sizeof (ACE_WSTRING_TYPE));
-
- // null terminate
- this->rep_[this->len_] = 0;
- }
-}
-
-ACE_WString::ACE_WString (ACE_WSTRING_TYPE c,
- ACE_Allocator *alloc)
- : allocator_ (alloc),
- buf_len_ (0),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- this->len_ = 1;
- this->check_allocate (this->len_ + 1);
- this->rep_[0] = c;
- this->rep_[this->len_] = 0;
-}
-
-// Constructor that actually copies memory.
-
-ACE_WString::ACE_WString (const ACE_WSTRING_TYPE *s,
- size_t len,
- ACE_Allocator *alloc)
- : allocator_ (alloc),
- buf_len_ (0),
- len_ (0),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- if (s != 0)
- {
- this->len_ = len;
- this->check_allocate (this->len_ + 1);
-
- ACE_OS::memcpy (this->rep_,
- s,
- len * sizeof (ACE_WSTRING_TYPE));
-
- // null terminate
- this->rep_[this->len_] = 0;
- }
-}
-
-#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
-ACE_WString::ACE_WString (const ACE_USHORT16 *s,
- size_t len,
- ACE_Allocator *alloc)
- : allocator_ (alloc),
- buf_len_ (0),
- len_ (0),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- if (s != 0)
- {
- this->len_ = len;
- this->check_allocate (this->len_ + 1);
-
- for (size_t i = 0; i <= len; ++i)
- this->rep_[i] = (const ACE_WSTRING_TYPE) s[i];
-
- // null terminate
- this->rep_[this->len_] = 0;
- }
-}
-#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
-
-// Constructor that allocates empty memory
-
-ACE_WString::ACE_WString (size_t len,
- ACE_Allocator *alloc)
- : allocator_ (alloc),
- buf_len_ (0),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- this->resize (len);
-}
-
-// Copy constructor.
-
-ACE_WString::ACE_WString (const ACE_WString &s)
- : allocator_ (s.allocator_),
- buf_len_ (0),
- len_ (s.len_),
- rep_ (0)
-{
- ACE_TRACE ("ACE_WString::ACE_WString");
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- this->check_allocate (s.len_ + 1);
- ACE_OS::memcpy ((void *) this->rep_,
- (const void *) s.rep_,
- this->len_ * sizeof (ACE_WSTRING_TYPE));
- this->rep_[this->len_] = 0;
-}
-
-// Assignment operator (does copy memory).
-
-ACE_WString &
-ACE_WString::operator= (const ACE_WString &s)
-{
- ACE_TRACE ("ACE_WString::operator=");
- // Check for identify.
-
- if (this != &s)
- this->set (s.rep_, s.len_);
-
- return *this;
-}
-
-void
-ACE_WString::set (const ACE_WSTRING_TYPE *s)
-{
- this->set (s, ACE_WString::strlen (s));
-}
-
-void
-ACE_WString::set (const ACE_WSTRING_TYPE *s, size_t len)
-{
- // Only reallocate if we don't have enough space...
- this->check_allocate (len);
-
- this->len_ = len;
- ACE_OS::memcpy (this->rep_,
- s,
- len * sizeof (ACE_WSTRING_TYPE));
- // NUL terminate.
- this->rep_[len] = 0;
-}
-
-// return substring
-ACE_WString
-ACE_WString::substring (size_t offset,
- ssize_t length) const
-{
- ACE_WString nil;
- size_t count = length;
-
- // case 1. empty string
- if (len_ == 0)
- return nil;
-
- // case 2. start pos l
- if (offset >= len_)
- return nil;
-
- // get all remaining bytes
- if (length == -1)
- count = len_ - offset;
-
- return ACE_WString (&rep_[offset],
- count,
- this->allocator_);
-}
-
-void
-ACE_WString::resize (size_t len)
-{
- ACE_TRACE ("ACE_WString::resize");
-
- // Only reallocate if we don't have enough space...
- if (this->buf_len_ <= len)
- {
- if (this->buf_len_ != 0)
- this->allocator_->free (this->rep_);
- this->rep_ = (ACE_WSTRING_TYPE *)
- this->allocator_->malloc ((len + 1) * sizeof (ACE_WSTRING_TYPE));
- this->buf_len_ = len + 1;
- }
-
- this->len_ = 0;
- ACE_OS::memset (this->rep_,
- 0,
- this->buf_len_ * sizeof (ACE_WSTRING_TYPE));
-}
-
-// Concat operator (does copy memory).
-
-ACE_WString &
-ACE_WString::operator+= (const ACE_WString &s)
-{
- ACE_TRACE ("ACE_WString::operator+=");
-
- this->check_allocate (len_ + s.len_);
-
- ACE_OS::memcpy ((void *) (this->rep_ + this->len_),
- (const void *) s.rep_,
- s.len_ * sizeof (ACE_WSTRING_TYPE));
- this->len_ += s.len_;
-
- // NUL terminate.
- this->rep_[this->len_] = 0;
-
- return *this;
-}
-
-// Concat operator (does copy memory)
-
-ACE_WString &
-ACE_WString::operator += (const ACE_WSTRING_TYPE *s)
-{
- ACE_TRACE ("ACE_WString::operator +=");
-
- size_t len = ACE_WString::strlen(s);
-
- this->check_allocate (len_ + len);
-
- ACE_OS::memcpy ((void *) (this->rep_ + this->len_),
- (const void *) s,
- len * sizeof (ACE_WSTRING_TYPE));
- this->len_ += len;
-
- this->rep_[this->len_] = 0;
-
- return *this;
-}
-
-ACE_WString::~ACE_WString (void)
-{
- ACE_TRACE ("ACE_WString::~ACE_WString");
-
- if (this->buf_len_ != 0)
- this->allocator_->free (this->rep_);
-}
-
-/* static */
-const ACE_WSTRING_TYPE *
-ACE_WString::strstr (const ACE_WSTRING_TYPE *s1,
- const ACE_WSTRING_TYPE *s2)
-{
- ACE_TRACE ("ACE_WString::strstr");
-
- // Original string length
- size_t len1 = ACE_WString::strlen (s1);
- // Substring length
- size_t len2 = ACE_WString::strlen (s2);
-
- // Check if the substring is longer than the string being searched.
- if (len2 > len1)
- return 0;
-
- // Go upto <len>
- size_t len = len1 - len2;
-
- for (size_t i = 0; i <= len; i++)
- if (ACE_OS::memcmp (s1 + i,
- s2,
- len2 * sizeof (ACE_WSTRING_TYPE)) == 0)
- // Found a match! Return the index.
- return s1 + i;
-
- return 0;
-}
-
-void
-ACE_WString::check_allocate (size_t len)
-{
- ACE_TRACE ("ACE_WString::check_allocate");
-
- size_t tempbuflen = this->buf_len_;
-
- // Check if the buffer is large enough
- while (tempbuflen <= len)
- if (tempbuflen == 0)
- tempbuflen = ACE_DEFAULT_GROWSIZE;
- else
-#if defined (ACE_GROW_LINEAR)
- tempbuflen += ACE_DEFAULT_GROWSIZE;
-#else
- tempbuflen *= 2;
-#endif /* ACE_GROW_LINEAR */
-
- if (tempbuflen != this->buf_len_)
- {
- if (this->buf_len_ != 0)
- {
- ACE_WSTRING_TYPE *t = (ACE_WSTRING_TYPE *)
- this->allocator_->malloc ((tempbuflen) * sizeof (ACE_WSTRING_TYPE));
-
- ACE_OS::memcpy ((void *) t,
- (const void *) this->rep_,
- this->len_ * sizeof (ACE_WSTRING_TYPE));
-
- this->allocator_->free (this->rep_);
- this->rep_ = t;
- }
- else
- this->rep_ = (ACE_WSTRING_TYPE *)
- this->allocator_->malloc ((tempbuflen) * sizeof (ACE_WSTRING_TYPE));
-
- ACE_OS::memset (this->rep_ + this->len_,
- 0,
- (tempbuflen - this->len_) * sizeof (ACE_WSTRING_TYPE));
-
- this->buf_len_ = tempbuflen;
- }
-}
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_String_Base<char>;
+template class ACE_String_Base<ACE_WSTRING_TYPE>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_String_Base<char>
+#pragma instantiate ACE_String_Base<ACE_WSTRING_TYPE>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/ace/SString.h b/ace/SString.h
index 9327b386b8b..afd9347a9f8 100644
--- a/ace/SString.h
+++ b/ace/SString.h
@@ -14,314 +14,69 @@
#define ACE_SSTRING_H
#include "ace/pre.h"
-#include "ace/ACE.h"
+#include "ace/String_Base.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#if defined (ACE_HAS_WCHAR)
-typedef wchar_t ACE_WSTRING_TYPE;
-#else /* ACE_HAS_WCHAR */
-typedef ACE_USHORT16 ACE_WSTRING_TYPE;
-#endif /* ACE_HAS_WCHAR */
+typedef ACE_WCHAR_T ACE_WSTRING_TYPE;
#if !defined (ACE_DEFAULT_GROWSIZE)
#define ACE_DEFAULT_GROWSIZE 32
#endif /* ACE_DEFAULT_GROWSIZE */
-// Forward decl.
-class ACE_Allocator;
+typedef ACE_String_Base<char> ACE_CString;
-/**
- * @class ACE_CString
- *
- * @brief This class provides a wrapper facade for C strings.
- *
- * This class uses an <ACE_Allocator> to allocate memory. The
- * user can make this a persistant class by providing an
- * ACE_Allocator with a persistable memory pool. This class is
- * optimized for efficiency, so it doesn't provide any internal
- * locking.
- * NOTE: if an instance of this class is constructed from or
- * assigned an empty string (with first element of '\0'), then it
- * is _not_ allocated new space. Instead, its internal
- * representation is set equal to a global empty string.
- * CAUTION: in cases when ACE_CString is constructed from a
- * provided buffer with the release parameter set to 0,
- * ACE_CString is not guaranteed to be '\0' terminated.
- */
-class ACE_Export ACE_CString
-{
-public:
- /// No position constant
- static const int npos;
-
- /// Default constructor.
- ACE_CString (ACE_Allocator *alloc = 0);
-
- /**
- * Constructor that copies <s> into dynamically allocated memory.
- * If <release> is non-0 then the <ACE_allocator> is responsible for
- * freeing this memory. Memory is _not_ allocated/freed if <release>
- * is 0.
- */
- ACE_CString (const char *s,
- ACE_Allocator *alloc = 0,
- int release = 1);
-
- /**
- * Constructor that copies <len> chars of <s> into dynamically
- * allocated memory (will NUL terminate the result). If <release>
- * is non-0 then the <ACE_allocator> is responsible for freeing this
- * memory. Memory is _not_ allocated/freed if <release> is 0.
- */
- ACE_CString (const char *s,
- size_t len,
- ACE_Allocator *alloc = 0,
- int release = 1);
-
- /// Copy constructor.
- ACE_CString (const ACE_CString &);
-
- /// Constructor that copies <s> into dynamically allocated memory.
- /// Probable loss of data. Please use with care.
- ACE_CString (const ACE_WSTRING_TYPE *s,
- ACE_Allocator *alloc = 0);
-
- /// Constructor that copies <c> into dynamically allocated memory.
- ACE_CString (char c, ACE_Allocator *alloc = 0);
-
- /// Deletes the memory...
- ~ACE_CString (void);
-
- /// Return the <slot'th> character in the string (doesn't perform
- /// bounds checking).
- const char &operator [] (size_t slot) const;
-
- /// Return the <slot'th> character by reference in the string
- /// (doesn't perform bounds checking).
- char &operator [] (size_t slot);
-
- /// Assignment operator (does copy memory).
- ACE_CString &operator = (const ACE_CString &);
-
- /// Copy <s> into this <ACE_CString>. Memory is _not_
- /// allocated/freed if <release> is 0.
- void set (const char *s, int release = 1);
-
- /// Copy <len> bytes of <s> (will NUL terminate the result).
- /// Memory is _not_ allocated/freed if <release> is 0.
- void set (const char *s,
- size_t len,
- int release);
-
- /// Clear this string. Memory is _not_ freed is <release> is 0.
- void clear (int release = 0);
-
- /**
- * Return a substring given an offset and length, if length == -1
- * use rest of str. Return empty substring if offset or
- * offset/length are invalid.
- */
- ACE_CString substring (size_t offset, ssize_t length = -1) const;
-
- /// Same as <substring>.
- ACE_CString substr (size_t offset, ssize_t length = -1) const;
-
- /// Concat operator (copies memory).
- ACE_CString &operator += (const ACE_CString &);
-
- /// Returns a hash value for this string.
- u_long hash (void) const;
-
- /// Return the length of the string.
- size_t length (void) const;
-
- /// Get a copy of the underlying pointer.
- char *rep (void) const;
-
- /**
- * Get at the underlying representation directly!
- * _Don't_ even think about casting the result to (char *) and modifying it,
- * if it has length 0!
- */
- const char *fast_rep (void) const;
-
- /// Same as STL String's <c_str> and <fast_rep>.
- const char *c_str (void) const;
-
- /// Comparison operator that will match substrings. Returns the
- /// slot of the first location that matches, else -1.
- int strstr (const ACE_CString &s) const;
-
- /// Find <str> starting at pos. Returns the slot of the first
- /// location that matches (will be >= pos), else npos.
- int find (const ACE_CString &str, int pos = 0) const;
-
- /// Find <s> starting at pos. Returns the slot of the first
- /// location that matches (will be >= pos), else npos.
- int find (const char *s, int pos = 0) const;
-
- /// Find <c> starting at pos. Returns the slot of the first
- /// location that matches (will be >= pos), else npos.
- int find (char c, int pos = 0) const;
-
- /// Find <c> starting at pos (counting from the end). Returns the
- /// slot of the first location that matches, else npos.
- int rfind (char c, int pos = npos) const;
-
- /// Equality comparison operator (must match entire string).
- int operator == (const ACE_CString &s) const;
-
- /// Less than comparison operator.
- int operator < (const ACE_CString &s) const;
-
- /// Greater than comparison operator.
- int operator > (const ACE_CString &s) const;
-
- /// Inequality comparison operator.
- int operator != (const ACE_CString &s) const;
-
- /// Performs a <strcmp>-style comparison.
- int compare (const ACE_CString &s) const;
-
- /// Dump the state of an object.
- void dump (void) const;
-
- /// Declare the dynamic allocation hooks.
- ACE_ALLOC_HOOK_DECLARE;
-
-private:
- /// Pointer to a memory allocator.
- ACE_Allocator *allocator_;
-
- /// Length of the ACE_CString data (not counting the trailing '\0').
- size_t len_;
-
- /// Length of the ACE_CString data buffer. Keeping track of the
- /// length allows to avoid unnecessary dynamic allocations.
- size_t buf_len_;
-
- /// Pointer to data.
- char *rep_;
-
- /// Flag that indicates if we own the memory
- int release_;
-
- /// Represents the "NULL" string to simplify the internal logic.
- static char NULL_CString_;
-};
+typedef ACE_String_Base<ACE_WSTRING_TYPE> ACE_WString;
-ACE_Export ACE_INLINE ACE_CString operator + (const ACE_CString &,
- const ACE_CString &);
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_CString &);
+ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
/**
- * @class ACE_WString
- *
- * @brief This class provides a wrapper facade for C wide strings.
- *
- * This class uses an <ACE_Allocator> to allocate memory. The
- * user can make this a persistant class by providing an
- * <ACE_Allocator> with a persistable memory pool. This class is
- * optimized for efficiency, so it doesn't provide any internal
- * locking.
+ * @brief This class retain the backward compatibility for
+ * Naming_Conext and related classes. The only addition to
+ * ACE_WString is a very naive "wchar" to "char" conversion function.
*/
-class ACE_Export ACE_WString
+class ACE_Export ACE_NS_WString : public ACE_WString
{
public:
- /// No position constant
- static const int npos;
-
/// Default constructor.
- ACE_WString (ACE_Allocator *alloc = 0);
+ ACE_NS_WString (ACE_Allocator *alloc = 0);
/// Constructor that copies <s> into dynamically allocated memory.
- ACE_WString (const char *s,
- ACE_Allocator *alloc = 0);
+ ACE_NS_WString (const char *s,
+ ACE_Allocator *alloc = 0);
/// Constructor that copies <s> into dynamically allocated memory.
- ACE_WString (const ACE_WSTRING_TYPE *s,
- ACE_Allocator *alloc = 0);
+ ACE_NS_WString (const ACE_WSTRING_TYPE *s,
+ ACE_Allocator *alloc = 0);
#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
/// Constructor that takes in a ushort16 string (mainly used by the
/// ACE Name_Space classes)
- ACE_WString (const ACE_USHORT16 *s,
- size_t len,
- ACE_Allocator *alloc = 0);
+ ACE_NS_WString (const ACE_USHORT16 *s,
+ size_t len,
+ ACE_Allocator *alloc = 0);
#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
/// Constructor that copies <len> ACE_WSTRING_TYPE's of <s> into dynamically
/// allocated memory (will NUL terminate the result).
- ACE_WString (const ACE_WSTRING_TYPE *s,
- size_t len,
- ACE_Allocator *alloc = 0);
+ ACE_NS_WString (const ACE_WSTRING_TYPE *s,
+ size_t len,
+ ACE_Allocator *alloc = 0);
/// Constructor that dynamically allocates memory for <len> + 1
/// ACE_WSTRING_TYPE characters. The newly created memory is set memset to 0.
- ACE_WString (size_t len, ACE_Allocator *alloc = 0);
+ ACE_NS_WString (size_t len, ACE_Allocator *alloc = 0);
/// Copy constructor.
- ACE_WString (const ACE_WString &s);
+ ACE_NS_WString (const ACE_NS_WString &s);
/// Constructor that copies <c> into dynamically allocated memory.
- ACE_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc = 0);
-
- /// Deletes the memory...
- ~ACE_WString (void);
-
- /// Return the <slot'th> character in the string (doesn't perform
- /// bounds checking).
- ACE_WSTRING_TYPE operator [] (size_t slot) const;
-
- /// Return the <slot'th> character by reference in the string
- /// (doesn't perform bounds checking).
- ACE_WSTRING_TYPE &operator [] (size_t slot);
-
- /// Assignment operator (does copy memory).
- ACE_WString &operator = (const ACE_WString &);
-
- /// Copy <s>
- void set (const ACE_WSTRING_TYPE *s);
-
- /// Copy <len> bytes of <s> (will NUL terminate the result)
- void set (const ACE_WSTRING_TYPE *s,
- size_t len);
-
- /// Clear this string.
- void clear ();
-
- /**
- * Return a substring given an offset and length, if length == -1
- * use rest of str return empty substring if offset or offset/length
- * are invalid.
- */
- ACE_WString substring (size_t offset, ssize_t length = -1) const;
-
- /// Same as substring
- ACE_WString substr (size_t offset, ssize_t length = -1) const;
-
- /// Concat operator (does copy memory).
- ACE_WString &operator += (const ACE_WString &);
-
- /// Concat operator (does copy memory)
- ACE_WString &operator += (const ACE_WSTRING_TYPE *);
-
- /// Returns a hash value for this string.
- u_long hash (void) const;
-
- /// Return the length of the string.
- size_t length (void) const;
-
- /// Return the size of the buffer.
- size_t buffer_size(void) const;
-
- /// Gets a copy of the underlying pointer.
- ACE_WSTRING_TYPE *rep (void) const;
+ ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc = 0);
/// Transform into a copy of the ASCII character representation.
/// (caller must delete)
@@ -330,99 +85,8 @@ public:
/// Transform into a copy of a USHORT16 representation (caller must
/// delete). Note, behavior is undefined when sizeof (wchar_t) != 2.
ACE_USHORT16 *ushort_rep (void) const;
-
- /// Get at the underlying representation directly!
- const ACE_WSTRING_TYPE *fast_rep (void) const;
-
- /// Same as STL String's <c_str> and <fast_rep>.
- const ACE_WSTRING_TYPE *c_str (void) const;
-
- /// Comparison operator that will match substrings. Returns the
- /// slot of the first location that matches, else -1.
- int strstr (const ACE_WString &s) const;
-
- /// Find <str> starting at pos. Returns the slot of the first
- /// location that matches (will be >= pos), else npos.
- int find (const ACE_WString &str, int pos = 0) const;
-
- /// Find <s> starting at pos. Returns the slot of the first
- /// location that matches (will be >= pos), else npos.
- int find (const ACE_WSTRING_TYPE *s, int pos = 0) const;
-
- /// Find <c> starting at pos. Returns the slot of the first
- /// location that matches (will be >= pos), else npos.
- int find (ACE_WSTRING_TYPE c, int pos = 0) const;
-
- /// Find <c> starting at pos (counting from the end). Returns the
- /// slot of the first location that matches, else npos.
- int rfind (ACE_WSTRING_TYPE c, int pos = npos) const;
-
- /// Equality comparison operator (must match entire string).
- int operator == (const ACE_WString &s) const;
-
- /// Less than comparison operator.
- int operator < (const ACE_WString &s) const;
-
- /// Greater than comparison operator.
- int operator > (const ACE_WString &s) const;
-
- /// Inequality comparison operator.
- int operator != (const ACE_WString &s) const;
-
- /// Performs a <strcmp>-style comparison.
- int compare (const ACE_WString &s) const;
-
- /// Dump the state of an object.
- void dump (void) const;
-
- /// Declare the dynamic allocation hooks.
- ACE_ALLOC_HOOK_DECLARE;
-
- /// Computes the length of a "0" terminated ACE_WSTRING_TYPE *.
- static size_t strlen (const ACE_WSTRING_TYPE *);
-
- /// Traditional style strstr
- static const ACE_WSTRING_TYPE *strstr (const ACE_WSTRING_TYPE *s1,
- const ACE_WSTRING_TYPE *s2);
-
- /**
- * This method is designed for high-performance. Please use with
- * care ;-) If the current size of the string is less than <len>,
- * the string is resized to the new length. The data is zero'd
- * out after this operation.
- */
- void resize (size_t len);
-
-private:
- /**
- * This method checks the size of the buffer. If the size of the
- * buffer is not large enough the buffer will be resized. All new
- * allocated space is zero'd out after this operation.
- */
- void check_allocate (size_t len);
-
- /// Pointer to a memory allocator.
- ACE_Allocator *allocator_;
-
- /// Size of the buffer of the ACE_WString
- size_t buf_len_;
-
- /// Length of the ACE_WString.
- size_t len_;
-
- /// Pointer to data.
- ACE_WSTRING_TYPE *rep_;
-
- /// Represents the "NULL" string to simplify the internal logic.
- static ACE_WSTRING_TYPE NULL_WString_;
};
-ACE_Export ACE_INLINE ACE_WString operator+ (const ACE_WString &,
- const ACE_WString &);
-#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
-ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &);
-#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
-
/**
* @class ACE_SString
*
@@ -566,9 +230,9 @@ ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_SString
// This allows one to use W or C String based on the Unicode
// setting
#if defined (ACE_USES_WCHAR)
-# define ACE_TString ACE_WString
+typedef ACE_WString ACE_TString;
#else /* ACE_USES_WCHAR */
-# define ACE_TString ACE_CString
+typedef ACE_CString ACE_TString;
#endif /* ACE_USES_WCHAR */
@@ -628,7 +292,10 @@ public:
*
* <B>Example:</B>
* \verbatim
- ACE_Tokenizer tok ("William/Joseph/Hagins");
+ char buf[30];
+ ACE_OS::strcpy(buf, "William/Joseph/Hagins");
+
+ ACE_Tokenizer tok (buf);
tok.delimiter_replace ('/', 0);
for (char *p = tok.next (); p; p = tok.next ())
cout << p << endl;
@@ -653,7 +320,10 @@ public:
*
* <B>Example with strip = 0:</B>
* \verbatim
- ACE_Tokenizer tok ("William(Joseph)Hagins");
+ char buf[30];
+ ACE_OS::strcpy(buf, "William(Joseph)Hagins");
+
+ ACE_Tokenizer tok (buf);
tok.preserve_designators ('(', ')', 0);
for (char *p = tok.next (); p; p = tok.next ())
cout << p << endl;
@@ -667,7 +337,10 @@ public:
*
* <B>Example with strip = 1:</B>
* \verbatim
- ACE_Tokenizer tok ("William(Joseph)Hagins");
+ char buf[30];
+ ACE_OS::strcpy(buf, "William(Joseph)Hagins");
+
+ ACE_Tokenizer tok (buf);
tok.preserve_designators ('(', ')', 1);
for (char *p = tok.next (); p; p = tok.next ())
cout << p << endl;
diff --git a/ace/SString.i b/ace/SString.i
index 6cc6b0af816..b2bfe39e32d 100644
--- a/ace/SString.i
+++ b/ace/SString.i
@@ -3,326 +3,36 @@
#include "ace/Malloc_Base.h"
-// Default constructor.
-
ACE_INLINE
-ACE_CString::ACE_CString (ACE_Allocator *alloc)
- : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
- len_ (0),
- buf_len_ (0),
- rep_ (&ACE_CString::NULL_CString_),
- release_ (0)
+ACE_NS_WString::ACE_NS_WString (ACE_Allocator *alloc)
+ : ACE_WString (alloc)
{
- ACE_TRACE ("ACE_CString::ACE_CString");
}
-// Constructor that actually copies memory.
-
ACE_INLINE
-ACE_CString::ACE_CString (const char *s,
- ACE_Allocator *alloc,
- int release)
- : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
- len_ (0),
- buf_len_ (0),
- rep_ (0),
- release_ (0)
-{
- ACE_TRACE ("ACE_CString::ACE_CString");
-
- size_t length;
- if (s != 0)
- length = ACE_OS::strlen (s);
- else
- length = 0;
-
- this->set (s, length, release);
-}
-
-ACE_INLINE
-ACE_CString::ACE_CString (char c,
- ACE_Allocator *alloc)
- : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
- len_ (0),
- buf_len_ (0),
- rep_ (0),
- release_ (0)
+ACE_NS_WString::ACE_NS_WString (const ACE_WSTRING_TYPE *s,
+ size_t len,
+ ACE_Allocator *alloc)
+ : ACE_WString (s, len, alloc)
{
- ACE_TRACE ("ACE_CString::ACE_CString");
-
- this->set (&c, 1, 1);
}
-// Constructor that actually copies memory.
-
ACE_INLINE
-ACE_CString::ACE_CString (const char *s,
- size_t len,
- ACE_Allocator *alloc,
- int release)
- : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
- len_ (0),
- buf_len_ (0),
- rep_ (0),
- release_ (0)
+ACE_NS_WString::ACE_NS_WString (size_t len, ACE_Allocator *alloc)
+ : ACE_WString (len, alloc)
{
- ACE_TRACE ("ACE_CString::ACE_CString");
-
- this->set (s, len, release);
}
-// Copy constructor.
-
ACE_INLINE
-ACE_CString::ACE_CString (const ACE_CString &s)
- : allocator_ (s.allocator_ ? s.allocator_ : ACE_Allocator::instance ()),
- len_ (0),
- buf_len_ (0),
- rep_ (0),
- release_ (0)
+ACE_NS_WString::ACE_NS_WString (const ACE_NS_WString &s)
+ : ACE_WString (s)
{
- ACE_TRACE ("ACE_CString::ACE_CString");
-
- this->set (s.rep_, s.len_, 1);
}
ACE_INLINE
-ACE_CString::~ACE_CString (void)
-{
- ACE_TRACE ("ACE_CString::~ACE_CString");
-
- this->set (0, 0, 0);
-}
-
-ACE_INLINE void
-ACE_CString::dump (void) const
-{
- ACE_TRACE ("ACE_CString::dump");
-}
-
-// Assignment operator (does copy memory).
-
-ACE_INLINE ACE_CString &
-ACE_CString::operator= (const ACE_CString &s)
-{
- ACE_TRACE ("ACE_CString::operator=");
-
- // Check for identify.
- if (this != &s)
- this->set (s.rep_, s.len_, 1);
-
- return *this;
-}
-
-ACE_INLINE void
-ACE_CString::set (const char *s, int release)
-{
- size_t length;
- if (s != 0)
- length = ACE_OS::strlen (s);
- else
- length = 0;
-
- this->set (s, length, release);
-}
-
-ACE_INLINE void
-ACE_CString::clear (int release)
-{
- this->set(0, 0, release);
-}
-
-ACE_INLINE size_t
-ACE_CString::length (void) const
-{
- ACE_TRACE ("ACE_CString::length");
- return this->len_;
-}
-
-ACE_INLINE ACE_CString
-ACE_CString::substr (size_t offset,
- ssize_t length) const
-{
- return this->substring (offset, length);
-}
-
-// Return the <slot'th> character in the string.
-
-ACE_INLINE const char &
-ACE_CString::operator[] (size_t slot) const
-{
- ACE_TRACE ("ACE_CString::operator[]");
- return this->rep_[slot];
-}
-
-// Return the <slot'th> character in the string by reference.
-
-ACE_INLINE char &
-ACE_CString::operator[] (size_t slot)
-{
- ACE_TRACE ("ACE_CString::operator[]");
- return this->rep_[slot];
-}
-
-// Get a copy of the underlying representation.
-
-ACE_INLINE char *
-ACE_CString::rep (void) const
-{
- ACE_TRACE ("ACE_CString::rep");
-
- char *new_string;
- ACE_NEW_RETURN (new_string, char[this->len_ + 1], 0);
- ACE_OS::strsncpy (new_string, this->rep_, this->len_ + 1);
-
- return new_string;
-}
-
-ACE_INLINE const char *
-ACE_CString::fast_rep (void) const
-{
- return this->rep_;
-}
-
-ACE_INLINE const char *
-ACE_CString::c_str (void) const
-{
- return this->rep_;
-}
-
-// Comparison operator.
-
-ACE_INLINE int
-ACE_CString::operator== (const ACE_CString &s) const
-{
- ACE_TRACE ("ACE_CString::operator==");
-
- return this->len_ == s.len_
- && ACE_OS::strncmp (this->rep_, s.rep_, this->len_) == 0;
-}
-
-// Less than comparison operator.
-
-ACE_INLINE int
-ACE_CString::operator < (const ACE_CString &s) const
-{
- ACE_TRACE ("ACE_CString::operator <");
-
- return (this->rep_ && s.rep_)
- ? ACE_OS::strcmp (this->rep_, s.rep_) < 0
- : ((s.rep_) ? 1 : 0 );
-}
-
-// Greater than comparison operator.
-
-ACE_INLINE int
-ACE_CString::operator > (const ACE_CString &s) const
-{
- ACE_TRACE ("ACE_CString::operator >");
-
- return (this->rep_ && s.rep_)
- ? ACE_OS::strcmp (this->rep_, s.rep_) > 0
- : ((this->rep_) ? 1 : 0 );
-}
-
-
-// Comparison operator.
-
-ACE_INLINE int
-ACE_CString::operator!= (const ACE_CString &s) const
-{
- ACE_TRACE ("ACE_CString::operator!=");
- return !(*this == s);
-}
-
-ACE_INLINE int
-ACE_CString::compare (const ACE_CString &s) const
-{
- ACE_TRACE ("ACE_CString::compare");
-
- // We can't just pass both strings to strcmp, since they are not
- // guaranteed to be null-terminated.
-
- // Pick smaller of the two lengths and perform the comparison.
- int smaller_length = (this->len_ < s.len_) ? this->len_ : s.len_;
- int result = ACE_OS::strncmp (this->rep_,
- s.rep_,
- smaller_length);
-
- if (result != 0 || s.len_ == this->len_)
- return result;
-
- else
- // we need to differentiate based on length
- if (this->len_ > s.len_)
- return (this->rep_[smaller_length] - '\0');
-
- else
- return ('\0' - s.rep_[smaller_length]);
-}
-
-ACE_INLINE int
-ACE_CString::find (const char *s, int pos) const
-{
- char *substr = this->rep_ + pos;
- size_t len = ACE_OS::strlen (s);
- char *pointer = ACE_OS::strnstr (substr, s, len);
- if (pointer == 0)
- return ACE_CString::npos;
- else
- return pointer - this->rep_;
-}
-
-ACE_INLINE int
-ACE_CString::find (char c, int pos) const
-{
- char *substr = this->rep_ + pos;
- char *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos);
- if (pointer == 0)
- return ACE_CString::npos;
- else
- return pointer - this->rep_;
-}
-
-ACE_INLINE int
-ACE_CString::find (const ACE_CString &str, int pos) const
-{
- return this->find (str.rep_, pos);
-}
-
-ACE_INLINE int
-ACE_CString::strstr (const ACE_CString &s) const
-{
- ACE_TRACE ("ACE_CString::strstr");
-
- return this->find (s.rep_);
-}
-
-ACE_INLINE int
-ACE_CString::rfind (char c, int pos) const
-{
- if (pos == ACE_CString::npos)
- pos = this->len_;
-
- for (int i = pos - 1; i >= 0; i--)
- if (this->rep_[i] == c)
- return i;
-
- return ACE_CString::npos;
-}
-
-ACE_INLINE u_long
-ACE_CString::hash (void) const
+ACE_NS_WString::ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc)
+ : ACE_WString (c, alloc)
{
- return ACE::hash_pjw (this->rep_, this->len_);
-}
-
-ACE_INLINE ACE_CString
-operator+ (const ACE_CString &s, const ACE_CString &t)
-{
- ACE_CString temp (s);
- temp += t;
- return temp;
}
ACE_INLINE
@@ -494,224 +204,6 @@ ACE_SString::length (void) const
return this->len_;
}
-ACE_INLINE size_t
-ACE_WString::length (void) const
-{
- ACE_TRACE ("ACE_WString::length");
- return this->len_;
-}
-
-ACE_INLINE ACE_WString
-operator+ (const ACE_WString &s,
- const ACE_WString &t)
-{
- ACE_WString temp (s.length () + t.length ());
- temp = s;
- temp += t;
- return temp;
-}
-
-ACE_INLINE void
-ACE_WString::clear()
-{
- this->set (0,0);
-}
-
-ACE_INLINE ACE_WString
-ACE_WString::substr (size_t offset,
- ssize_t length) const
-{
- return this->substring (offset, length);
-}
-
-// Get a copy of the underlying representation.
-
-ACE_INLINE ACE_WSTRING_TYPE *
-ACE_WString::rep (void) const
-{
- ACE_TRACE ("ACE_WString::rep");
-
- ACE_WSTRING_TYPE *t;
- ACE_NEW_RETURN (t,
- ACE_WSTRING_TYPE[this->len_ + 1],
- 0);
- ACE_OS::memcpy (t,
- this->rep_,
- this->len_ * sizeof (ACE_WSTRING_TYPE));
-
- // 0 terminate
- t[this->len_] = 0;
-
- return t;
-}
-
-// Get at the underlying representation directly!
-
-ACE_INLINE const ACE_WSTRING_TYPE *
-ACE_WString::fast_rep (void) const
-{
- if (this->rep_ == 0)
- return &ACE_WString::NULL_WString_;
- else
- return this->rep_;
-}
-
-ACE_INLINE const ACE_WSTRING_TYPE *
-ACE_WString::c_str (void) const
-{
- if (this->rep_ == 0)
- return &ACE_WString::NULL_WString_;
- else
- return this->rep_;
-}
-
-// Comparison operator.
-
-ACE_INLINE int
-ACE_WString::operator== (const ACE_WString &s) const
-{
- ACE_TRACE ("ACE_WString::operator==");
- return this->len_ == s.len_
- && ACE_OS::memcmp ((const void *) this->rep_,
- (const void *) s.rep_,
- this->len_ * sizeof (ACE_WSTRING_TYPE)) == 0;
-}
-
-// Less than comparison operator.
-
-ACE_INLINE int
-ACE_WString::operator < (const ACE_WString &s) const
-{
- ACE_TRACE ("ACE_WString::operator <");
- return this->len_ < s.len_
- ? ACE_OS::memcmp ((const void *) this->rep_,
- (const void *) s.rep_,
- this->len_ * sizeof (ACE_WSTRING_TYPE)) <= 0
- : ACE_OS::memcmp ((const void *) this->rep_,
- (const void *) s.rep_,
- s.len_ * sizeof (ACE_WSTRING_TYPE)) < 0;
-}
-
-// Greater than comparison operator.
-
-ACE_INLINE int
-ACE_WString::operator > (const ACE_WString &s) const
-{
- ACE_TRACE ("ACE_WString::operator >");
- return this->len_ <= s.len_
- ? ACE_OS::memcmp ((const void *) this->rep_,
- (const void *) s.rep_,
- this->len_ * sizeof (ACE_WSTRING_TYPE)) > 0
- : ACE_OS::memcmp ((const void *) this->rep_,
- (const void *) s.rep_,
- s.len_ * sizeof (ACE_WSTRING_TYPE)) >= 0;
-}
-
-// Comparison operator.
-
-ACE_INLINE int
-ACE_WString::operator!= (const ACE_WString &s) const
-{
- ACE_TRACE ("ACE_WString::operator!=");
- return !(*this == s);
-}
-
-ACE_INLINE int
-ACE_WString::compare (const ACE_WString &s) const
-{
- ACE_TRACE ("ACE_WString::compare");
-
- return ACE_OS::memcmp ((const void *) this->rep_,
- (const void *) s.rep_,
- this->len_ * sizeof (ACE_WSTRING_TYPE));
-}
-
-// Return the <slot'th> character in the string.
-
-ACE_INLINE ACE_WSTRING_TYPE
-ACE_WString::operator[] (size_t slot) const
-{
- ACE_TRACE ("ACE_WString::operator[]");
- return this->rep_[slot];
-}
-
-// Return the <slot'th> character in the string.
-
-ACE_INLINE ACE_WSTRING_TYPE &
-ACE_WString::operator[] (size_t slot)
-{
- ACE_TRACE ("ACE_WString::operator[]");
- return this->rep_[slot];
-}
-
-ACE_INLINE int
-ACE_WString::find (const ACE_WSTRING_TYPE *s, int pos) const
-{
- ACE_WSTRING_TYPE *substr = this->rep_ + pos;
- const ACE_WSTRING_TYPE *pointer = ACE_WString::strstr (substr, s);
- if (pointer == 0)
- return ACE_WString::npos;
- else
- return pointer - this->rep_;
-}
-
-ACE_INLINE int
-ACE_WString::find (ACE_WSTRING_TYPE c, int pos) const
-{
- if (pos == ACE_WString::npos)
- pos = this->len_;
-
- for (size_t i = pos; i < this->len_; i++)
- if (this->rep_[i] == c)
- return ACE_static_cast (int, i);
-
- return ACE_WString::npos;
-}
-
-ACE_INLINE int
-ACE_WString::strstr (const ACE_WString &s) const
-{
- ACE_TRACE ("ACE_WString::strstr");
-
- return this->find (s.rep_);
-}
-
-ACE_INLINE int
-ACE_WString::find (const ACE_WString &str, int pos) const
-{
- return this->find (str.rep_, pos);
-}
-
-ACE_INLINE int
-ACE_WString::rfind (ACE_WSTRING_TYPE c, int pos) const
-{
- if (pos == ACE_WString::npos)
- pos = this->len_;
-
- for (int i = pos - 1; i >= 0; i--)
- if (this->rep_[i] == c)
- return i;
-
- return ACE_WString::npos;
-}
-
-ACE_INLINE size_t
-ACE_WString::buffer_size(void) const
-{
- ACE_TRACE ("ACE_WString::buffer_size");
- return this->buf_len_;
-}
-
-ACE_INLINE u_long
-ACE_WString::hash (void) const
-{
- return ACE::hash_pjw
- (ACE_reinterpret_cast (char *, ACE_const_cast (ACE_WSTRING_TYPE *,
- this->rep_)),
- this->len_ * sizeof (ACE_WSTRING_TYPE));
-}
-
-
ACE_INLINE
ACE_Auto_String_Free::ACE_Auto_String_Free (char* p)
: p_ (p)
diff --git a/ace/String_Base.cpp b/ace/String_Base.cpp
new file mode 100644
index 00000000000..a7d45ebd7ad
--- /dev/null
+++ b/ace/String_Base.cpp
@@ -0,0 +1,183 @@
+// $Id$
+
+#include "ace/Malloc.h"
+#include "ace/String_Base.h"
+#include "ace/Auto_Ptr.h"
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+# include "ace/streams.h"
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+
+#if !defined (__ACE_INLINE__)
+#include "ace/String_Base.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(ace, String_Base, "String_Base.cpp,v 4.61 2001/03/04 00:55:30 brunsch Exp")
+
+ACE_ALLOC_HOOK_DEFINE(ACE_String_Base)
+
+template <class CHAR>
+CHAR ACE_String_Base<CHAR>::NULL_String_ = '\0';
+template <class CHAR>
+const int ACE_String_Base<CHAR>::npos = -1;
+
+// this method might benefit from a little restructuring.
+template <class CHAR> void
+ACE_String_Base<CHAR>::set (const CHAR *s,
+ size_t len,
+ int release)
+{
+ // Case 1. Going from memory to more memory
+ size_t new_buf_len = len + 1;
+ if (s != 0 && len != 0 && release && this->buf_len_ < new_buf_len)
+ {
+ CHAR *temp;
+ ACE_ALLOCATOR (temp,
+ (CHAR *) this->allocator_->malloc (new_buf_len * sizeof (CHAR)));
+
+ if (this->release_)
+ this->allocator_->free (this->rep_);
+
+ this->rep_ = temp;
+ this->buf_len_ = new_buf_len;
+ this->release_ = 1;
+ this->len_ = len;
+ ACE_OS::memcpy (this->rep_, s, len * sizeof (CHAR));
+ // NUL terminate.
+ this->rep_[len] = '\0';
+ }
+
+ // Case 2. No memory allocation is necessary.
+ else
+ {
+ // Free memory if necessary and figure out future ownership
+ if (!release || s == 0 || len == 0)
+ if (this->release_)
+ {
+ this->allocator_->free (this->rep_);
+ this->release_ = 0;
+ }
+ // else - stay with whatever value for release_ we have.
+
+ // Populate data.
+ if (s == 0 || len == 0)
+ {
+ this->buf_len_ = 0;
+ this->len_ = 0;
+ this->rep_ = &ACE_String_Base<CHAR>::NULL_String_;
+ }
+ else if (!release)
+ {
+ this->buf_len_ = len;
+ this->len_ = len;
+ this->rep_ = (CHAR *) s;
+ }
+ else
+ {
+ ACE_OS::memcpy (this->rep_, s, len * sizeof (CHAR));
+ // NUL terminate.
+ this->rep_[len] = 0;
+ this->len_ = len;
+ }
+ }
+}
+
+// Return substring.
+template <class CHAR> ACE_String_Base<CHAR>
+ACE_String_Base<CHAR>::substring (size_t offset,
+ ssize_t length) const
+{
+ ACE_String_Base<CHAR> nil;
+ size_t count = length;
+
+ // case 1. empty string
+ if (this->len_ == 0)
+ return nil;
+
+ // case 2. start pos past our end
+ if (offset >= this->len_)
+ return nil;
+ // No length == empty string.
+ else if (length == 0)
+ return nil;
+ // Get all remaining bytes.
+ else if (length == -1 || count > (this->len_ - offset))
+ count = this->len_ - offset;
+
+ return ACE_String_Base<CHAR> (&this->rep_[offset],
+ count,
+ this->allocator_);
+}
+
+// Concat operator (does copy memory).
+
+template <class CHAR> ACE_String_Base<CHAR> &
+ACE_String_Base<CHAR>::operator+= (const ACE_String_Base<CHAR> &s)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator+=");
+
+ if (s.len_ > 0)
+ {
+ size_t new_buf_len = this->len_ + s.len_ + 1;
+
+ // case 1. No memory allocation needed.
+ if (this->buf_len_ >= new_buf_len)
+ // Copy in data from new string.
+ ACE_OS::memcpy (this->rep_ + this->len_,
+ s.rep_,
+ s.len_ * sizeof (CHAR));
+
+ // case 2. Memory reallocation is needed
+ else
+ {
+ CHAR *t = 0;
+
+ ACE_ALLOCATOR_RETURN (t,
+ (CHAR *) this->allocator_->malloc (new_buf_len *
+ sizeof (CHAR)),
+ *this);
+
+ // Copy memory from old string into new string.
+ ACE_OS::memcpy (t,
+ this->rep_,
+ this->len_ * sizeof (CHAR));
+
+ ACE_OS::memcpy (t + this->len_,
+ s.rep_,
+ s.len_ * sizeof (CHAR));
+
+ if (this->release_)
+ this->allocator_->free (this->rep_);
+
+ this->release_ = 1;
+ this->rep_ = t;
+ this->buf_len_ = new_buf_len;
+ }
+
+ this->len_ += s.len_;
+ this->rep_[this->len_] = '\0';
+ }
+
+ return *this;
+}
+
+template <class CHAR> void
+ACE_String_Base<CHAR>::resize (size_t len, CHAR c)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::resize");
+
+ // Only reallocate if we don't have enough space...
+ if (this->buf_len_ <= len)
+ {
+ if (this->buf_len_ != 0)
+ this->allocator_->free (this->rep_);
+ this->rep_ = (CHAR *)
+ this->allocator_->malloc ((len + 1) * sizeof (CHAR));
+ this->buf_len_ = len + 1;
+ }
+
+ this->len_ = 0;
+ ACE_OS::memset (this->rep_,
+ c,
+ this->buf_len_ * sizeof (CHAR));
+}
diff --git a/ace/String_Base.h b/ace/String_Base.h
new file mode 100644
index 00000000000..127b7358adc
--- /dev/null
+++ b/ace/String_Base.h
@@ -0,0 +1,237 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file String_Base.h
+ *
+ * $Id$
+ *
+ * @author Douglas C. Schmidt (schmidt@cs.wustl.edu)
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef ACE_STRING_BASE_H
+#define ACE_STRING_BASE_H
+#include "ace/pre.h"
+
+#include "ace/ACE.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+// Forward decl.
+class ACE_Allocator;
+
+/**
+ * @class ACE_String_Base
+ *
+ * @brief This class provides a wrapper facade for C strings.
+ *
+ * This class uses an <ACE_Allocator> to allocate memory. The
+ * user can make this a persistant class by providing an
+ * ACE_Allocator with a persistable memory pool. This class is
+ * optimized for efficiency, so it doesn't provide any internal
+ * locking.
+ * NOTE: if an instance of this class is constructed from or
+ * assigned an empty string (with first element of '\0'), then it
+ * is _not_ allocated new space. Instead, its internal
+ * representation is set equal to a global empty string.
+ * CAUTION: in cases when ACE_String_Base is constructed from a
+ * provided buffer with the release parameter set to 0,
+ * ACE_String_Base is not guaranteed to be '\0' terminated.
+ */
+template <class CHAR>
+class ACE_Export ACE_String_Base
+{
+public:
+ /// No position constant
+ static const int npos;
+
+ /// Default constructor.
+ ACE_String_Base (ACE_Allocator *alloc = 0);
+
+ /**
+ * Constructor that copies @a s into dynamically allocated memory.
+ * If @a release is non-0 then the @a ACE_allocator is responsible for
+ * freeing this memory. Memory is _not_ allocated/freed if @a release
+ * is 0.
+ */
+ ACE_String_Base (const CHAR *s,
+ ACE_Allocator *alloc = 0,
+ int release = 1);
+
+ /**
+ * Constructor that copies <len> CHARs of <s> into dynamically
+ * allocated memory (will NUL terminate the result). If <release>
+ * is non-0 then the <ACE_allocator> is responsible for freeing this
+ * memory. Memory is _not_ allocated/freed if <release> is 0.
+ */
+ ACE_String_Base (const CHAR *s,
+ size_t len,
+ ACE_Allocator *alloc = 0,
+ int release = 1);
+
+ /// Copy constructor.
+ ACE_String_Base (const ACE_String_Base<CHAR> &);
+
+ /// Constructor that copies @a c into dynamically allocated memory.
+ ACE_String_Base (CHAR c, ACE_Allocator *alloc = 0);
+
+ /// Constructor that dynamically allocate @a len long of char array
+ /// and initialize it to @a c using @a alloc to allocate the memory.
+ ACE_String_Base (size_t len, CHAR c = 0, ACE_Allocator *alloc = 0);
+
+ /// Deletes the memory...
+ ~ACE_String_Base (void);
+
+ /// Return the <slot'th> character in the string (doesn't perform
+ /// bounds checking).
+ const CHAR &operator [] (size_t slot) const;
+
+ /// Return the <slot'th> character by reference in the string
+ /// (doesn't perform bounds checking).
+ CHAR &operator [] (size_t slot);
+
+ /// Assignment operator (does copy memory).
+ ACE_String_Base &operator = (const ACE_String_Base<CHAR> &);
+
+ /// Copy @a s into this @a ACE_String_Base. Memory is _not_
+ /// allocated/freed if @a release is 0.
+ void set (const CHAR *s, int release = 1);
+
+ /// Copy @a len bytes of @a s (will NUL terminate the result).
+ /// Memory is _not_ allocated/freed if @a release is 0.
+ void set (const CHAR *s,
+ size_t len,
+ int release);
+
+ /// Clear this string. Memory is _not_ freed is <release> is 0.
+ void clear (int release = 0);
+
+ /**
+ * Return a substring given an offset and length, if length == -1
+ * use rest of str. Return empty substring if offset or
+ * offset/length are invalid.
+ */
+ ACE_String_Base<CHAR> substring (size_t offset, ssize_t length = -1) const;
+
+ /// Same as <substring>.
+ ACE_String_Base<CHAR> substr (size_t offset, ssize_t length = -1) const;
+
+ /// Concat operator (copies memory).
+ ACE_String_Base<CHAR> &operator += (const ACE_String_Base<CHAR> &);
+
+ /// Returns a hash value for this string.
+ u_long hash (void) const;
+
+ /// Return the length of the string.
+ size_t length (void) const;
+
+ /// Get a copy of the underlying pointer.
+ CHAR *rep (void) const;
+
+ /**
+ * Get at the underlying representation directly!
+ * _Don't_ even think about casting the result to (char *) and modifying it,
+ * if it has length 0!
+ */
+ const CHAR *fast_rep (void) const;
+
+ /// Same as STL String's <c_str> and <fast_rep>.
+ const CHAR *c_str (void) const;
+
+ /// Comparison operator that will match substrings. Returns the
+ /// slot of the first location that matches, else -1.
+ int strstr (const ACE_String_Base<CHAR> &s) const;
+
+ /// Find <str> starting at pos. Returns the slot of the first
+ /// location that matches (will be >= pos), else npos.
+ int find (const ACE_String_Base<CHAR> &str, int pos = 0) const;
+
+ /// Find <s> starting at pos. Returns the slot of the first
+ /// location that matches (will be >= pos), else npos.
+ int find (const CHAR *s, int pos = 0) const;
+
+ /// Find <c> starting at pos. Returns the slot of the first
+ /// location that matches (will be >= pos), else npos.
+ int find (CHAR c, int pos = 0) const;
+
+ /// Find <c> starting at pos (counting from the end). Returns the
+ /// slot of the first location that matches, else npos.
+ int rfind (CHAR c, int pos = npos) const;
+
+ /// Equality comparison operator (must match entire string).
+ int operator == (const ACE_String_Base<CHAR> &s) const;
+
+ /// Less than comparison operator.
+ int operator < (const ACE_String_Base<CHAR> &s) const;
+
+ /// Greater than comparison operator.
+ int operator > (const ACE_String_Base<CHAR> &s) const;
+
+ /// Inequality comparison operator.
+ int operator != (const ACE_String_Base<CHAR> &s) const;
+
+ /// Performs a <strcmp>-style comparison.
+ int compare (const ACE_String_Base<CHAR> &s) const;
+
+ /// Dump the state of an object.
+ void dump (void) const;
+
+ /**
+ * This method is designed for high-performance. Please use with
+ * care ;-) If the current size of the string is less than <len>,
+ * the string is resized to the new length. The data is zero'd
+ * out after this operation.
+ */
+ void resize (size_t len, CHAR c = 0);
+
+ /// Declare the dynamic allocation hooks.
+ ACE_ALLOC_HOOK_DECLARE;
+
+protected:
+ /// Pointer to a memory allocator.
+ ACE_Allocator *allocator_;
+
+ /// Length of the ACE_String_Base data (not counting the trailing '\0').
+ size_t len_;
+
+ /// Length of the ACE_String_Base data buffer. Keeping track of the
+ /// length allows to avoid unnecessary dynamic allocations.
+ size_t buf_len_;
+
+ /// Pointer to data.
+ CHAR *rep_;
+
+ /// Flag that indicates if we own the memory
+ int release_;
+
+ /// Represents the "NULL" string to simplify the internal logic.
+ static CHAR NULL_String_;
+};
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR> operator + (const ACE_String_Base<CHAR> &,
+ const ACE_String_Base<CHAR> &);
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR> operator + (const ACE_String_Base<CHAR> &,
+ const CHAR *);
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR> operator + (const CHAR* ,
+ const ACE_String_Base<CHAR> &);
+#if defined (__ACE_INLINE__)
+#include "ace/String_Base.i"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "ace/String_Base.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("String_Base.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include "ace/post.h"
+#endif /* ACE_STRING_BASE_H */
diff --git a/ace/String_Base.i b/ace/String_Base.i
new file mode 100644
index 00000000000..63691853cf5
--- /dev/null
+++ b/ace/String_Base.i
@@ -0,0 +1,358 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ace/Malloc_Base.h"
+
+// Default constructor.
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR>::ACE_String_Base (ACE_Allocator *alloc)
+ : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
+ len_ (0),
+ buf_len_ (0),
+ rep_ (&ACE_String_Base<CHAR>::NULL_String_),
+ release_ (0)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base");
+}
+
+// Constructor that actually copies memory.
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR>::ACE_String_Base (const CHAR *s,
+ ACE_Allocator *alloc,
+ int release)
+ : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
+ len_ (0),
+ buf_len_ (0),
+ rep_ (0),
+ release_ (0)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base");
+
+ size_t length;
+ if (s != 0)
+ length = ACE_OS::strlen (s);
+ else
+ length = 0;
+
+ this->set (s, length, release);
+}
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR>::ACE_String_Base (CHAR c,
+ ACE_Allocator *alloc)
+ : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
+ len_ (0),
+ buf_len_ (0),
+ rep_ (0),
+ release_ (0)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base");
+
+ this->set (&c, 1, 1);
+}
+
+// Constructor that actually copies memory.
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR>::ACE_String_Base (const CHAR *s,
+ size_t len,
+ ACE_Allocator *alloc,
+ int release)
+ : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
+ len_ (0),
+ buf_len_ (0),
+ rep_ (0),
+ release_ (0)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base");
+
+ this->set (s, len, release);
+}
+
+// Copy constructor.
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR>::ACE_String_Base (const ACE_String_Base<CHAR> &s)
+ : allocator_ (s.allocator_ ? s.allocator_ : ACE_Allocator::instance ()),
+ len_ (0),
+ buf_len_ (0),
+ rep_ (0),
+ release_ (0)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base");
+
+ this->set (s.rep_, s.len_, 1);
+}
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR>::ACE_String_Base (size_t len, CHAR c, ACE_Allocator *alloc)
+ : allocator_ (alloc ? alloc : ACE_Allocator::instance ()),
+ len_ (0),
+ buf_len_ (0),
+ rep_ (0),
+ release_ (0)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base");
+
+ this->resize (len, c);
+}
+
+template <class CHAR> ACE_INLINE
+ACE_String_Base<CHAR>::~ACE_String_Base (void)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::~ACE_String_Base");
+
+ this->set (0, 0, 0);
+}
+
+template <class CHAR> ACE_INLINE void
+ACE_String_Base<CHAR>::dump (void) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::dump");
+}
+
+// Assignment operator (does copy memory).
+
+template <class CHAR> ACE_INLINE ACE_String_Base<CHAR> &
+ACE_String_Base<CHAR>::operator= (const ACE_String_Base<CHAR> &s)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator=");
+
+ // Check for identify.
+ if (this != &s)
+ this->set (s.rep_, s.len_, 1);
+
+ return *this;
+}
+
+template <class CHAR> ACE_INLINE void
+ACE_String_Base<CHAR>::set (const CHAR *s, int release)
+{
+ size_t length;
+ if (s != 0)
+ length = ACE_OS::strlen (s);
+ else
+ length = 0;
+
+ this->set (s, length, release);
+}
+
+template <class CHAR> ACE_INLINE size_t
+ACE_String_Base<CHAR>::length (void) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::length");
+ return this->len_;
+}
+
+template <class CHAR> ACE_INLINE void
+ACE_String_Base<CHAR>::clear (int release)
+{
+ this->set(0, 0, release);
+}
+
+template <class CHAR> ACE_INLINE ACE_String_Base<CHAR>
+ACE_String_Base<CHAR>::substr (size_t offset,
+ ssize_t length) const
+{
+ return this->substring (offset, length);
+}
+
+// Return the <slot'th> character in the string.
+
+template <class CHAR> ACE_INLINE const CHAR &
+ACE_String_Base<CHAR>::operator[] (size_t slot) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator[]");
+ return this->rep_[slot];
+}
+
+// Return the <slot'th> character in the string by reference.
+
+template <class CHAR> ACE_INLINE CHAR &
+ACE_String_Base<CHAR>::operator[] (size_t slot)
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator[]");
+ return this->rep_[slot];
+}
+
+// Get a copy of the underlying representation.
+
+template <class CHAR> ACE_INLINE CHAR *
+ACE_String_Base<CHAR>::rep (void) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::rep");
+
+ CHAR *new_string;
+ ACE_NEW_RETURN (new_string, CHAR[this->len_ + 1], 0);
+ ACE_OS::strsncpy (new_string, this->rep_, this->len_+1);
+
+ return new_string;
+}
+
+template <class CHAR> ACE_INLINE const CHAR *
+ACE_String_Base<CHAR>::fast_rep (void) const
+{
+ return this->rep_;
+}
+
+template <class CHAR> ACE_INLINE const CHAR *
+ACE_String_Base<CHAR>::c_str (void) const
+{
+ return this->rep_;
+}
+
+// Comparison operator.
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::operator== (const ACE_String_Base<CHAR> &s) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator==");
+
+ return this->len_ == s.len_
+ && ACE_OS::strncmp (this->rep_, s.rep_, this->len_) == 0;
+}
+
+// Less than comparison operator.
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::operator < (const ACE_String_Base<CHAR> &s) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator <");
+
+ return (this->rep_ && s.rep_)
+ ? ACE_OS::strcmp (this->rep_, s.rep_) < 0
+ : ((s.rep_) ? 1 : 0 );
+}
+
+// Greater than comparison operator.
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::operator > (const ACE_String_Base &s) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator >");
+
+ return (this->rep_ && s.rep_)
+ ? ACE_OS::strcmp (this->rep_, s.rep_) > 0
+ : ((this->rep_) ? 1 : 0 );
+}
+
+
+// Comparison operator.
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::operator!= (const ACE_String_Base<CHAR> &s) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::operator!=");
+ return !(*this == s);
+}
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::compare");
+
+ // We can't just pass both strings to strcmp, since they are not
+ // guaranteed to be null-terminated.
+
+ // Pick smaller of the two lengths and perform the comparison.
+ int smaller_length = (this->len_ < s.len_) ? this->len_ : s.len_;
+ int result = ACE_OS::strncmp (this->rep_,
+ s.rep_,
+ smaller_length);
+
+ if (result != 0 || s.len_ == this->len_)
+ return result;
+
+ else
+ // we need to differentiate based on length
+ if (this->len_ > s.len_)
+ return (this->rep_[smaller_length] - '\0');
+
+ else
+ return ('\0' - s.rep_[smaller_length]);
+}
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::find (const CHAR *s, int pos) const
+{
+ CHAR *substr = this->rep_ + pos;
+ size_t len = ACE_OS::strlen (s);
+ CHAR *pointer = ACE_OS::strnstr (substr, s, len);
+ if (pointer == 0)
+ return ACE_String_Base<CHAR>::npos;
+ else
+ return pointer - this->rep_;
+}
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::find (CHAR c, int pos) const
+{
+ CHAR *substr = this->rep_ + pos;
+ CHAR *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos);
+ if (pointer == 0)
+ return ACE_String_Base<CHAR>::npos;
+ else
+ return pointer - this->rep_;
+}
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::find (const ACE_String_Base<CHAR> &str, int pos) const
+{
+ return this->find (str.rep_, pos);
+}
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::strstr (const ACE_String_Base<CHAR> &s) const
+{
+ ACE_TRACE ("ACE_String_Base<CHAR>::strstr");
+
+ return this->find (s.rep_);
+}
+
+template <class CHAR> ACE_INLINE int
+ACE_String_Base<CHAR>::rfind (CHAR c, int pos) const
+{
+ if (pos == ACE_String_Base<CHAR>::npos)
+ pos = this->len_;
+
+ for (int i = pos - 1; i >= 0; i--)
+ if (this->rep_[i] == c)
+ return i;
+
+ return ACE_String_Base<CHAR>::npos;
+}
+
+template <class CHAR> ACE_INLINE u_long
+ACE_String_Base<CHAR>::hash (void) const
+{
+ return ACE::hash_pjw (
+ (ACE_reinterpret_cast (char *, ACE_const_cast (CHAR *,
+ this->rep_))),
+ this->len_ * sizeof (CHAR));
+}
+
+template <class CHAR> ACE_INLINE ACE_String_Base<CHAR>
+operator+ (const ACE_String_Base<CHAR> &s, const ACE_String_Base<CHAR> &t)
+{
+ ACE_String_Base<CHAR> temp (s);
+ temp += t;
+ return temp;
+}
+
+template <class CHAR> ACE_INLINE ACE_String_Base<CHAR>
+operator+ (const CHAR *s, const ACE_String_Base<CHAR> &t)
+{
+ ACE_String_Base<CHAR> temp (s);
+ temp += t;
+ return temp;
+}
+
+template <class CHAR> ACE_INLINE ACE_String_Base<CHAR>
+operator+ (const ACE_String_Base<CHAR> &s, const CHAR *t)
+{
+ ACE_String_Base<CHAR> temp (s);
+ temp += t;
+ return temp;
+}
diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp
index ce23b17e66a..ea07b8bd775 100644
--- a/ace/ace_dll.dsp
+++ b/ace/ace_dll.dsp
@@ -1938,6 +1938,10 @@ SOURCE=.\streams.h
# End Source File
# Begin Source File
+SOURCE=.\String_Base.h
+# End Source File
+# Begin Source File
+
SOURCE=.\SV_Message.h
# End Source File
# Begin Source File
@@ -2866,6 +2870,10 @@ SOURCE=.\Stream_Modules.i
# End Source File
# Begin Source File
+SOURCE=.\String_Base.i
+# End Source File
+# Begin Source File
+
SOURCE=.\SV_Message.i
# End Source File
# Begin Source File
@@ -3190,6 +3198,11 @@ SOURCE=.\Stream_Modules.cpp
# End Source File
# Begin Source File
+SOURCE=.\String_Base.cpp
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
SOURCE=.\Synch_T.cpp
# PROP Exclude_From_Build 1
# End Source File
diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp
index cc1f87df134..a72cbdcf614 100644
--- a/ace/ace_lib.dsp
+++ b/ace/ace_lib.dsp
@@ -42,8 +42,8 @@ RSC=rc.exe
# PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Release"
# PROP Target_Dir ""
-LINK32=link.exe -lib
MTL=midl.exe
+LINK32=link.exe -lib
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /I "../" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MT /W3 /GX /O1 /I "../" /I "../PACE" /D ACE_OS_HAS_DLL=0 /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
@@ -69,8 +69,8 @@ LIB32=link.exe -lib
# PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Debug"
# PROP Target_Dir ""
-LINK32=link.exe -lib
MTL=midl.exe
+LINK32=link.exe -lib
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /Gy /I "../" /I "../PACE" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D ACE_OS_HAS_DLL=0 /FD /c
@@ -96,8 +96,8 @@ LIB32=link.exe -lib
# PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Release"
# PROP Target_Dir ""
-LINK32=link.exe -lib
MTL=midl.exe
+LINK32=link.exe -lib
# ADD BASE CPP /nologo /G5 /MT /W3 /GX /O1 /I "../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /I "../" /I "../PACE" /D "_WINDOWS" /D "NDEBUG" /D "ACE_AS_STATIC_LIBS" /D "WIN32" /FD /c
# SUBTRACT CPP /YX
@@ -122,8 +122,8 @@ LIB32=link.exe -lib
# PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Debug"
# PROP Target_Dir ""
-LINK32=link.exe -lib
MTL=midl.exe
+LINK32=link.exe -lib
# ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../" /I "../PACE" /D "_WINDOWS" /D "_DEBUG" /D "ACE_AS_STATIC_LIBS" /D "WIN32" /FD /c
# SUBTRACT CPP /YX
@@ -1933,6 +1933,10 @@ SOURCE=.\streams.h
# End Source File
# Begin Source File
+SOURCE=.\String_Base.h
+# End Source File
+# Begin Source File
+
SOURCE=.\SV_Message.h
# End Source File
# Begin Source File
@@ -2861,6 +2865,10 @@ SOURCE=.\Stream_Modules.i
# End Source File
# Begin Source File
+SOURCE=.\String_Base.i
+# End Source File
+# Begin Source File
+
SOURCE=.\SV_Message.i
# End Source File
# Begin Source File
@@ -3185,6 +3193,11 @@ SOURCE=.\Stream_Modules.cpp
# End Source File
# Begin Source File
+SOURCE=.\String_Base.cpp
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
SOURCE=.\Synch_T.cpp
# PROP Exclude_From_Build 1
# End Source File
diff --git a/netsvcs/clients/Naming/Client/Client_Test.cpp b/netsvcs/clients/Naming/Client/Client_Test.cpp
index 2df1e540275..72c7e9b8494 100644
--- a/netsvcs/clients/Naming/Client/Client_Test.cpp
+++ b/netsvcs/clients/Naming/Client/Client_Test.cpp
@@ -34,7 +34,7 @@ public:
void list_options (void);
// Print name options
- int bind (const char *key,
+ int bind (const char *key,
const char *value,
const char *type = "");
// Bind a key to a value
@@ -129,8 +129,8 @@ Client_Test::open (void)
this->display_menu ();
if (ACE_Event_Handler::register_stdin_handler (this,
- ACE_Reactor::instance (),
- ACE_Thread_Manager::instance ()) == -1)
+ ACE_Reactor::instance (),
+ ACE_Thread_Manager::instance ()) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"%p\n",
"register_stdin_handler"),
@@ -438,7 +438,7 @@ Client_Test::unbind (const char *key)
}
int
-Client_Test::rebind (const char *key,
+Client_Test::rebind (const char *key,
const char *value,
const char *type)
{
@@ -460,7 +460,7 @@ Client_Test::list_names (const char *pattern)
{
ACE_PWSTRING_ITERATOR set_iterator (set);
- for (ACE_WString *name = 0;
+ for (ACE_NS_WString *name = 0;
set_iterator.next (name) !=0;
set_iterator.advance())
ACE_DEBUG ((LM_DEBUG,
@@ -484,7 +484,7 @@ Client_Test::list_values (const char *pattern)
{
ACE_PWSTRING_ITERATOR set_iterator (set);
- for (ACE_WString *value = 0;
+ for (ACE_NS_WString *value = 0;
set_iterator.next (value) !=0;
set_iterator.advance())
ACE_DEBUG ((LM_DEBUG,
@@ -508,7 +508,7 @@ Client_Test::list_types (const char *pattern)
{
ACE_PWSTRING_ITERATOR set_iterator (set);
- for (ACE_WString *type = 0;
+ for (ACE_NS_WString *type = 0;
set_iterator.next (type) !=0;
set_iterator.advance())
ACE_DEBUG ((LM_DEBUG,
diff --git a/netsvcs/lib/Name_Handler.cpp b/netsvcs/lib/Name_Handler.cpp
index e8d50e221e4..bfa2eb7c591 100644
--- a/netsvcs/lib/Name_Handler.cpp
+++ b/netsvcs/lib/Name_Handler.cpp
@@ -374,10 +374,10 @@ int
ACE_Name_Handler::shared_bind (int rebind)
{
ACE_TRACE ("ACE_Name_Handler::shared_bind");
- ACE_WString a_name (this->name_request_.name (),
- this->name_request_.name_len () / sizeof (ACE_USHORT16));
- ACE_WString a_value (this->name_request_.value (),
- this->name_request_.value_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString a_name (this->name_request_.name (),
+ this->name_request_.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString a_value (this->name_request_.value (),
+ this->name_request_.value_len () / sizeof (ACE_USHORT16));
int result;
if (rebind == 0)
{
@@ -414,13 +414,13 @@ ACE_Name_Handler::resolve (void)
#if 0
ACE_DEBUG ((LM_DEBUG, "request for RESOLVE \n"));
#endif /* 0 */
- ACE_WString a_name (this->name_request_.name (),
- this->name_request_.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString a_name (this->name_request_.name (),
+ this->name_request_.name_len () / sizeof (ACE_USHORT16));
// The following will deliver our reply back to client we
// pre-suppose success (indicated by type RESOLVE).
- ACE_WString avalue;
+ ACE_NS_WString avalue;
char *atype;
if (NAMING_CONTEXT::instance ()->resolve (a_name, avalue, atype) == 0)
{
@@ -447,8 +447,8 @@ ACE_Name_Handler::unbind (void)
#if 0
ACE_DEBUG ((LM_DEBUG, "request for UNBIND \n"));
#endif /* 0 */
- ACE_WString a_name (this->name_request_.name (),
- this->name_request_.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString a_name (this->name_request_.name (),
+ this->name_request_.name_len () / sizeof (ACE_USHORT16));
if (NAMING_CONTEXT::instance ()->unbind (a_name) == 0)
return this->send_reply (0);
@@ -457,7 +457,7 @@ ACE_Name_Handler::unbind (void)
}
ACE_Name_Request
-ACE_Name_Handler::name_request (ACE_WString *one_name)
+ACE_Name_Handler::name_request (ACE_NS_WString *one_name)
{
ACE_TRACE ("ACE_Name_Handler::name_request");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> one_name_urep (one_name->ushort_rep ());
@@ -469,7 +469,7 @@ ACE_Name_Handler::name_request (ACE_WString *one_name)
}
ACE_Name_Request
-ACE_Name_Handler::value_request (ACE_WString *one_value)
+ACE_Name_Handler::value_request (ACE_NS_WString *one_value)
{
ACE_TRACE ("ACE_Name_Handler::value_request");
ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> one_value_urep (one_value->ushort_rep ());
@@ -481,7 +481,7 @@ ACE_Name_Handler::value_request (ACE_WString *one_value)
}
ACE_Name_Request
-ACE_Name_Handler::type_request (ACE_WString *one_type)
+ACE_Name_Handler::type_request (ACE_NS_WString *one_type)
{
ACE_TRACE ("ACE_Name_Handler::type_request");
return ACE_Name_Request (ACE_Name_Request::LIST_TYPES,
@@ -497,8 +497,8 @@ ACE_Name_Handler::lists (void)
ACE_TRACE ("ACE_Name_Handler::lists");
ACE_PWSTRING_SET set;
- ACE_WString pattern (this->name_request_.name (),
- this->name_request_.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString pattern (this->name_request_.name (),
+ this->name_request_.name_len () / sizeof (ACE_USHORT16));
// Get the index into the list table
int index = ACE_LIST_MAP (this->name_request_.msg_type (),
@@ -518,9 +518,9 @@ ACE_Name_Handler::lists (void)
}
else
{
- ACE_WString *one_entry = 0;
+ ACE_NS_WString *one_entry = 0;
- for (ACE_Unbounded_Set_Iterator<ACE_WString> set_iterator (set);
+ for (ACE_Unbounded_Set_Iterator<ACE_NS_WString> set_iterator (set);
set_iterator.next (one_entry) !=0;
set_iterator.advance())
{
@@ -547,8 +547,8 @@ ACE_Name_Handler::lists_entries (void)
{
ACE_TRACE ("ACE_Name_Handler::lists_entries");
ACE_BINDING_SET set;
- ACE_WString pattern (this->name_request_.name (),
- this->name_request_.name_len () / sizeof (ACE_USHORT16));
+ ACE_NS_WString pattern (this->name_request_.name (),
+ this->name_request_.name_len () / sizeof (ACE_USHORT16));
int result = -1;
@@ -598,9 +598,9 @@ ACE_Name_Handler::lists_entries (void)
set_iterator.next (one_entry) !=0;
set_iterator.advance())
{
- ACE_Auto_Basic_Array_Ptr<ACE_USHORT16>
+ ACE_Auto_Basic_Array_Ptr<ACE_USHORT16>
name_urep (one_entry->name_.ushort_rep ());
- ACE_Auto_Basic_Array_Ptr<ACE_USHORT16>
+ ACE_Auto_Basic_Array_Ptr<ACE_USHORT16>
value_urep (one_entry->value_.ushort_rep ());
ACE_Name_Request mynrq (this->name_request_.msg_type (),
name_urep.get (),
diff --git a/netsvcs/lib/Name_Handler.h b/netsvcs/lib/Name_Handler.h
index e1ec4b9ee5b..cf01cd98a38 100644
--- a/netsvcs/lib/Name_Handler.h
+++ b/netsvcs/lib/Name_Handler.h
@@ -32,7 +32,7 @@
class Naming_Context : public ACE_Naming_Context
{
// = TITLE
- //
+ //
// This helper class adds the correct default constructor to the
// <ACE_Naming_Context> class so that we can use it in
// <ACE_Singleton>.
@@ -62,10 +62,10 @@ public:
typedef int (ACE_Name_Handler::*OPERATION) (void);
// Pointer to a member function of ACE_Name_Handler returning int
- typedef int (ACE_Naming_Context::*LIST_OP) (ACE_PWSTRING_SET &, const ACE_WString &);
+ typedef int (ACE_Naming_Context::*LIST_OP) (ACE_PWSTRING_SET &, const ACE_NS_WString &);
// Pointer to a member function of ACE_Naming_Context returning int
- typedef ACE_Name_Request (ACE_Name_Handler::*REQUEST) (ACE_WString *);
+ typedef ACE_Name_Request (ACE_Name_Handler::*REQUEST) (ACE_NS_WString *);
// Pointer to a member function of ACE_Name_Handler returning ACE_Name_Request
// = Initialization and termination.
@@ -173,13 +173,13 @@ private:
// Handle LIST_NAME_ENTRIES, LIST_VALUE_ENTRIES, and
// LIST_TYPE_ENTRIES requests.
- ACE_Name_Request name_request (ACE_WString *one_name);
+ ACE_Name_Request name_request (ACE_NS_WString *one_name);
// Create a name request.
- ACE_Name_Request value_request (ACE_WString *one_name);
+ ACE_Name_Request value_request (ACE_NS_WString *one_name);
// Create a value request.
- ACE_Name_Request type_request (ACE_WString *one_name);
+ ACE_Name_Request type_request (ACE_NS_WString *one_name);
// Create a type request.
};
diff --git a/tests/Naming_Test.cpp b/tests/Naming_Test.cpp
index b763564772d..9acab24452c 100644
--- a/tests/Naming_Test.cpp
+++ b/tests/Naming_Test.cpp
@@ -31,7 +31,7 @@ static char type[BUFSIZ];
static void
print_time (ACE_Profile_Timer &timer,
- const char *test)
+ const char *test)
{
ACE_Profile_Timer::ACE_Elapsed_Time et;
timer.stop ();
@@ -40,9 +40,9 @@ print_time (ACE_Profile_Timer &timer,
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n ***** %s ***** \n"), test));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("real time = %f secs, user time = %f secs, system time = %f secs\n"),
- et.real_time, et.user_time, et.system_time));
+ et.real_time, et.user_time, et.system_time));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time per call = %f usecs\n\n"),
- (et.real_time / double (ACE_NS_MAX_ENTRIES)) * 1000000));
+ (et.real_time / double (ACE_NS_MAX_ENTRIES)) * 1000000));
}
static void
@@ -55,10 +55,10 @@ test_bind (ACE_Naming_Context &ns_context)
for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++)
{
ACE_OS::sprintf (name, "%s%d", "name", array[i]);
- ACE_WString w_name (name);
+ ACE_NS_WString w_name (name);
ACE_OS::sprintf (value, "%s%d", "value", array[i]);
- ACE_WString w_value (value);
+ ACE_NS_WString w_value (value);
ACE_OS::sprintf (type, "%s%d", "type", array [i]);
ACE_ASSERT (ns_context.bind (w_name, w_value, type) != -1);
@@ -69,8 +69,8 @@ static void
test_find_failure (ACE_Naming_Context &ns_context)
{
ACE_OS::sprintf (name, "%s", "foo-bar");
- ACE_WString w_name (name);
- ACE_WString w_value;
+ ACE_NS_WString w_name (name);
+ ACE_NS_WString w_value;
char *l_type = 0;
// Do the finds.
@@ -88,10 +88,10 @@ test_rebind (ACE_Naming_Context &ns_context)
for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++)
{
ACE_OS::sprintf (name, "%s%d", "name", array[i]);
- ACE_WString w_name (name);
+ ACE_NS_WString w_name (name);
ACE_OS::sprintf (value, "%s%d", "value", -array[i]);
- ACE_WString w_value (value);
+ ACE_NS_WString w_value (value);
ACE_OS::sprintf (type, "%s%d", "type", -array[i]);
ACE_ASSERT (ns_context.rebind (w_name, w_value, type) != -1);
@@ -108,7 +108,7 @@ test_unbind (ACE_Naming_Context &ns_context)
for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++)
{
ACE_OS::sprintf (name, "%s%d", "name", array[i]);
- ACE_WString w_name (name);
+ ACE_NS_WString w_name (name);
ACE_ASSERT (ns_context.unbind (w_name) != -1);
}
}
@@ -126,47 +126,47 @@ test_find (ACE_Naming_Context &ns_context, int sign, int result)
for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++)
{
if (sign == 1)
- {
- ACE_OS::sprintf (temp_val, "%s%d", "value", array[i]);
- ACE_OS::sprintf (temp_type, "%s%d", "type", array[i]);
- }
+ {
+ ACE_OS::sprintf (temp_val, "%s%d", "value", array[i]);
+ ACE_OS::sprintf (temp_type, "%s%d", "type", array[i]);
+ }
else
- {
- ACE_OS::sprintf (temp_val, "%s%d", "value", -array[i]);
- ACE_OS::sprintf (temp_type, "%s%d", "type", -array[i]);
- }
+ {
+ ACE_OS::sprintf (temp_val, "%s%d", "value", -array[i]);
+ ACE_OS::sprintf (temp_type, "%s%d", "type", -array[i]);
+ }
ACE_OS::sprintf (name, "%s%d", "name", array[i]);
- ACE_WString w_name (name);
- ACE_WString w_value;
+ ACE_NS_WString w_name (name);
+ ACE_NS_WString w_value;
char *type_out = 0;
- ACE_WString val (temp_val);
+ ACE_NS_WString val (temp_val);
ACE_ASSERT (ns_context.resolve (w_name, w_value, type_out) == result);
char *l_value = w_value.char_rep ();
if (l_value)
- {
- ACE_ASSERT (w_value == val);
- if (ns_context.name_options ()->debug ())
- {
- if (type_out)
- ACE_DEBUG ((LM_DEBUG,
+ {
+ ACE_ASSERT (w_value == val);
+ if (ns_context.name_options ()->debug ())
+ {
+ if (type_out)
+ ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Name: %s\tValue: %s\tType: %s\n"),
- name, l_value, type_out));
- else
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name: %s\tValue: %s\n"),
- name, l_value));
- }
-
- if (type_out)
- {
- ACE_ASSERT (ACE_OS::strcmp (type_out, temp_type) == 0);
- delete[] type_out;
- }
- }
+ name, l_value, type_out));
+ else
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name: %s\tValue: %s\n"),
+ name, l_value));
+ }
+
+ if (type_out)
+ {
+ ACE_ASSERT (ACE_OS::strcmp (type_out, temp_type) == 0);
+ delete[] type_out;
+ }
+ }
delete[] l_value;
}
@@ -197,7 +197,7 @@ main (int argc, ACE_TCHAR *argv[])
else
{
ACE_OS::strcpy (temp_file, ACE::basename (name_options->process_name (),
- ACE_DIRECTORY_SEPARATOR_CHAR));
+ ACE_DIRECTORY_SEPARATOR_CHAR));
ACE_OS_String::strcat (temp_file, ACE_TEXT ("XXXXXX"));
// Set the database name using mktemp to generate a unique file name
@@ -207,7 +207,7 @@ main (int argc, ACE_TCHAR *argv[])
ACE_ASSERT (ns_context->open (ACE_Naming_Context::PROC_LOCAL, 1) != -1);
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time to test %d iterations using %s\n"),
- ACE_NS_MAX_ENTRIES, name_options->use_registry () ?
+ ACE_NS_MAX_ENTRIES, name_options->use_registry () ?
ACE_TEXT ("Registry") : ACE_TEXT ("ACE")));
ACE_Profile_Timer timer;
@@ -243,9 +243,9 @@ main (int argc, ACE_TCHAR *argv[])
print_time (timer, "Unbinds");
ACE_OS::sprintf (temp_file, ACE_TEXT ("%s%s%s"),
- name_options->namespace_dir (),
- ACE_DIRECTORY_SEPARATOR_STR,
- name_options->database ());
+ name_options->namespace_dir (),
+ ACE_DIRECTORY_SEPARATOR_STR,
+ name_options->database ());
delete ns_context;
diff --git a/tests/SString_Test.cpp b/tests/SString_Test.cpp
index d2290faefd3..d21d0ca727a 100644
--- a/tests/SString_Test.cpp
+++ b/tests/SString_Test.cpp
@@ -154,12 +154,12 @@ main (int, ACE_TCHAR *[])
}
{
- ACE_WString s0 ("hello");
- ACE_WString s1 ("hello");
- ACE_WString s2 ("world");
- ACE_WString s3 ("ll");
- ACE_WString s4 ("ello");
- ACE_WString s5 = s1 + " " + s2;
+ ACE_WString s0 (ACE_TEXT_WIDE ("hello"));
+ ACE_WString s1 (ACE_TEXT_WIDE ("hello"));
+ ACE_WString s2 (ACE_TEXT_WIDE ("world"));
+ ACE_WString s3 (ACE_TEXT_WIDE ("ll"));
+ ACE_WString s4 (ACE_TEXT_WIDE ("ello"));
+ ACE_WString s5 = s1 + ACE_TEXT_WIDE (" ") + s2;
ACE_WSTRING_TYPE single_character = 'z';
ACE_WString single_character_string (single_character);