diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-09 21:39:39 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-09 21:39:39 +0000 |
commit | 97186e5b9835abdca969c085df9edeb90b23f15a (patch) | |
tree | ab1889fa3c28434f54a83926f5b520054687597b | |
parent | 61e045eadb352a7a1dc0b4859ae0e6ff0c50c981 (diff) | |
download | ATCD-97186e5b9835abdca969c085df9edeb90b23f15a.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog-98b | 19 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | ace/Registry.cpp | 35 | ||||
-rw-r--r-- | ace/Registry.h | 76 | ||||
-rw-r--r-- | ace/SString.cpp | 8 | ||||
-rw-r--r-- | ace/SString.h | 7 | ||||
-rw-r--r-- | examples/Registry/test_registry_iterator.cpp | 2 | ||||
-rw-r--r-- | examples/Registry/test_registry_update.cpp | 12 |
8 files changed, 84 insertions, 77 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b index c8d7be978a1..4003035271c 100644 --- a/ChangeLog-98b +++ b/ChangeLog-98b @@ -1,3 +1,22 @@ +Thu Jul 09 16:23:34 1998 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/Registry.h (ACE_Registry): Changed the Registry class so + that it does not use STL containers and the string classes + anymore. It now uses ACE containers and string classes. There + should be no dependency on STL in ACE anymore. + + * STL: Removed this directory since ACE is no longer dependent on + STL. If you still need these STL files, please refer to: + http://www.rahul.net/terris/. + + * examples/Registry/test_registry_{update,iterator}.cpp (main): + Updated files to work with modified Registry. + + * ace/SString.cpp (ACE_WString::operator<<): Added new operator. + + * Makefile: Updated Makefile so that STL is no longer released + with ACE. + Thu Jul 09 09:37:43 1998 David L. Levine <levine@cs.wustl.edu> * ace/Basic_Types: for LONG_LONG size determination, don't use @@ -86,7 +86,6 @@ CONTROLLED_FILES = ACE-INSTALL.html \ FAQ \ Makefile \ README \ - STL \ VERSION \ ace \ apps \ @@ -108,7 +107,6 @@ ALL_RELEASE_FILES = $(RELEASE_FILES) \ ACE_wrappers/TAO RELEASE_LIB_FILES = \ - ACE_wrappers/STL \ ACE_wrappers/VERSION \ ACE_wrappers/ace \ ACE_wrappers/include \ diff --git a/ace/Registry.cpp b/ace/Registry.cpp index 6b8519699a2..637231bc06b 100644 --- a/ace/Registry.cpp +++ b/ace/Registry.cpp @@ -24,6 +24,14 @@ /* static */ LPCTSTR ACE_Registry::STRING_SEPARATOR = __TEXT ("\\"); +int +ACE_Registry::Name_Component::operator== (const Name_Component &rhs) +{ + return + rhs.id_ == this->id_ && + rhs.kind_ == this->kind_; +} + // Simple binding constructor ACE_Registry::Binding::Binding () : name_ (), @@ -52,6 +60,14 @@ ACE_Registry::Binding::Binding (const Istring &name, } +int +ACE_Registry::Binding::operator== (const Binding &rhs) +{ + return + rhs.name_ == this->name_ && + rhs.type_ == this->type_; +} + // Name accessor // (Name version) void @@ -578,12 +594,13 @@ ACE_Registry::Naming_Context::close (void) // Convert a <name> to a <string> ACE_Registry::Istring -ACE_Registry::make_string (const Name &name) +ACE_Registry::make_string (const Name &const_name) { Istring string; + Name &name = ACE_const_cast (Name &, const_name); // Iterator through the components of name - for (Name::const_iterator iterator = name.begin (); + for (Name::iterator iterator = name.begin (); iterator != name.end (); iterator++) { @@ -603,8 +620,8 @@ ACE_Registry::make_string (const Name &name) ACE_Registry::Name ACE_Registry::make_name (const Istring &string) { - size_t new_position = 0; - size_t last_position = 0; + int new_position = 0; + int last_position = 0; Name name; // Rememeber: NPOS is -1 @@ -630,7 +647,7 @@ ACE_Registry::make_name (const Istring &string) // Update positions last_position = new_position; // Insert component into name - name.push_back (component); + name.insert (component); } return name; @@ -769,7 +786,7 @@ ACE_Registry::Naming_Context::list (Binding_List &list) ACE_Registry::Binding binding; result = iterator.next_one (binding); if (result == 0) - list.push_back (binding); + list.insert (binding); else break; } @@ -841,7 +858,7 @@ ACE_Registry::Binding_Iterator::next_one (Binding &binding) if (result == 0) // Success - binding = list[0]; + binding = (*list.begin ()); return result; } @@ -933,7 +950,7 @@ ACE_Registry::Binding_Iterator::Object_Iteration::next_n (u_long how_many, // Create binding Binding binding (string, OBJECT); // Add to binding list - list.push_back (binding); + list.insert (binding); } // Continue to add to list break; @@ -1003,7 +1020,7 @@ ACE_Registry::Binding_Iterator::Context_Iteration::next_n (u_long how_many, // Create binding Binding binding (string, CONTEXT); // Add to binding list - list.push_back (binding); + list.insert (binding); } // Continue to add to list break; diff --git a/ace/Registry.h b/ace/Registry.h index 2889e71489c..b19170ca843 100644 --- a/ace/Registry.h +++ b/ace/Registry.h @@ -23,15 +23,8 @@ #if defined (ACE_WIN32) // This only works on Win32 platforms -#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ - (ACE_HAS_STANDARD_CPP_LIBRARY != 0) -#include <vector> -#include <string> -#else -#include "vector.h" -#include "bstring.h" -#endif -// You must configure the STL components in order to use this wrapper. +#include "ace/Containers.h" +#include "ace/SString.h" class ACE_Export ACE_Registry { @@ -48,48 +41,25 @@ class ACE_Export ACE_Registry public: // International string -#if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) -#if defined (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER) && \ - (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER != 0) - typedef std::basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > Istring; -#else /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ - typedef std::basic_string<TCHAR> Istring; -#endif /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ -#else /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ -#if defined (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER) && \ - (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER != 0) - typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > Istring; -#else /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ - typedef basic_string<TCHAR> Istring; -#endif /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ -#endif /* ACE_HAS_STD_NAMESPACE_FOR_STDCPP_LIB */ +#if defined (UNICODE) + typedef ACE_WString Istring; +#else + typedef ACE_CString Istring; +#endif /* UNICODE */ struct ACE_Export Name_Component { Istring id_; Istring kind_; + + int operator== (const Name_Component &rhs); + // Comparison }; // The <id_> field is used, // but the <kind_> field is currently ignored -// A Name is an ordered collections of components (ids) -#if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) -#if defined (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER) && \ - (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER != 0) - typedef std::vector<Name_Component, allocator<Name_Component> > Name; -#else /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ - typedef std::vector<Name_Component> Name; -#endif /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ -#else /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ -#if defined (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER) && \ - (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER != 0) - typedef vector<Name_Component, allocator<Name_Component> > Name; -#else /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ - typedef vector<Name_Component> Name; -#endif /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ -#endif /* ACE_HAS_STD_NAMESPACE_FOR_STDCPP_LIB */ + // A Name is an ordered collections of components (ids) + typedef ACE_Unbounded_Set<Name_Component> Name; static LPCTSTR STRING_SEPARATOR; // Separator for components in a name @@ -118,6 +88,9 @@ public: // Constructor // (String version) + int operator== (const Binding &rhs); + // Comparison + void name (Name &name); // Name accessor // (Name version) @@ -136,23 +109,8 @@ public: // A binding has a name and a type }; -// A list of bindings -#if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ - (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) -#if defined (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER) && \ - (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER != 0) - typedef std::vector<Binding, allocator<Binding> > Binding_List; -#else /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ - typedef std::vector<Binding> Binding_List; -#endif /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ -#else /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ -#if defined (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER) && \ - (ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER != 0) - typedef vector<Binding, allocator<Binding> > Binding_List; -#else /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ - typedef vector<Binding> Binding_List; -#endif /* ACE_LACKS_STL_DEFAULT_TEMPLATE_PARAMETER */ -#endif /* ACE_HAS_STD_NAMESPACE_FOR_STDCPP_LIB */ + // A list of bindings + typedef ACE_Unbounded_Set<Binding> Binding_List; class Binding_Iterator; // Forward declaration of iterator diff --git a/ace/SString.cpp b/ace/SString.cpp index 0afe3565cc1..64c4fecf48a 100644 --- a/ace/SString.cpp +++ b/ace/SString.cpp @@ -212,6 +212,14 @@ operator<< (ostream &os, const ACE_CString &cs) } ostream & +operator<< (ostream &os, const ACE_WString &ws) +{ + if (ws.length () > 0) + os << ACE_MULTIBYTE_STRING (ws); + return os; +} + +ostream & operator<< (ostream &os, const ACE_SString &ss) { os << ss.fast_rep (); diff --git a/ace/SString.h b/ace/SString.h index ed12cbd4c73..4164c63bb39 100644 --- a/ace/SString.h +++ b/ace/SString.h @@ -316,6 +316,10 @@ class ACE_Export ACE_WString // an ACE_Allocator with a persistable memory pool { friend ACE_Export ACE_WString operator+ (const ACE_WString &, const ACE_WString &); +#if !defined (ACE_HAS_WINCE) + friend ACE_Export ostream &operator<< (ostream &, const ACE_WString &); +#endif /* ! ACE_HAS_WINCE */ + public: static const int npos; // No position constant @@ -455,6 +459,9 @@ private: }; ACE_Export ACE_WString operator+ (const ACE_WString &, const ACE_WString &); +#if !defined (ACE_HAS_WINCE) +ACE_Export ostream &operator<< (ostream &, const ACE_WString &); +#endif /* ! ACE_HAS_WINCE */ // ************************************************************ diff --git a/examples/Registry/test_registry_iterator.cpp b/examples/Registry/test_registry_iterator.cpp index 9b4bc9b4ea2..da3e89344e7 100644 --- a/examples/Registry/test_registry_iterator.cpp +++ b/examples/Registry/test_registry_iterator.cpp @@ -9,7 +9,7 @@ #include "ace/Registry.h" - +#include "ace/streams.h" // Indentation while printing names static const u_long INDENTATION_LEVEL = 3; diff --git a/examples/Registry/test_registry_update.cpp b/examples/Registry/test_registry_update.cpp index f8f21ab7451..e45a2e7f051 100644 --- a/examples/Registry/test_registry_update.cpp +++ b/examples/Registry/test_registry_update.cpp @@ -14,7 +14,7 @@ // if used with the CURRENT_USER predefined registry. #include "ace/Registry.h" - +#include "ace/streams.h" // Name for application's naming context static ACE_Registry::Name application_context_name; @@ -137,11 +137,11 @@ setup_names () ACE_Registry::Name_Component component; - component.id_ = __TEXT ("Software"), ::application_context_name.push_back (component); - component.id_ = __TEXT ("AcmeSoft"), ::application_context_name.push_back (component); - component.id_ = __TEXT ("AcmeApplication"), ::application_context_name.push_back (component); - component.id_ = __TEXT ("1.0"), ::application_context_name.push_back (component); + component.id_ = __TEXT ("Software"), ::application_context_name.insert (component); + component.id_ = __TEXT ("AcmeSoft"), ::application_context_name.insert (component); + component.id_ = __TEXT ("AcmeApplication"), ::application_context_name.insert (component); + component.id_ = __TEXT ("1.0"), ::application_context_name.insert (component); - component.id_ = __TEXT ("Instance Counter"), ::counter_name.push_back (component); + component.id_ = __TEXT ("Instance Counter"), ::counter_name.insert (component); } |