From 3c91f4dcc4281659f23b7597e5abff6b97b58f03 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Fri, 30 Nov 2018 16:22:38 -0600 Subject: [PATCH] tao_idl: Add some functionality to string --- TAO/TAO_IDL/include/utl_identifier.h | 11 ++++++++++- TAO/TAO_IDL/util/utl_identifier.cpp | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/TAO/TAO_IDL/include/utl_identifier.h b/TAO/TAO_IDL/include/utl_identifier.h index 999e1636c1f..209807e168b 100644 --- a/TAO/TAO_IDL/include/utl_identifier.h +++ b/TAO/TAO_IDL/include/utl_identifier.h @@ -78,13 +78,20 @@ public: Identifier (const char *s); // Constructor. + Identifier (const Identifier &other); + virtual ~Identifier (void); // Destructor. // Operations + /** + * Get the underlying string. + */ + ///{ char *get_string (void); - // Get the underlying string. + const char *get_string () const; + ///} void replace_string (const char * s); // Replace the underlying string and free the old one. @@ -110,6 +117,8 @@ public: virtual void destroy (void); // Cleanup function. + bool operator== (const Identifier &other) const; + private: // Storage for data. char *pv_string; diff --git a/TAO/TAO_IDL/util/utl_identifier.cpp b/TAO/TAO_IDL/util/utl_identifier.cpp index 67c7d715957..6fd20d68458 100644 --- a/TAO/TAO_IDL/util/utl_identifier.cpp +++ b/TAO/TAO_IDL/util/utl_identifier.cpp @@ -70,6 +70,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // FUZZ: disable check_for_streams_include #include "ace/streams.h" +#include "ace/OS_NS_string.h" Identifier::Identifier (void) : pv_string (0), @@ -137,6 +138,11 @@ Identifier::Identifier (const char *s) } } +Identifier::Identifier (const Identifier &other) + : Identifier (other.get_string ()) +{ +} + Identifier::~Identifier (void) { if (this->pv_string != 0) @@ -154,6 +160,12 @@ Identifier::get_string (void) return this->pv_string; } +const char * +Identifier::get_string (void) const +{ + return this->pv_string; +} + void Identifier::replace_string (const char * s) { @@ -229,3 +241,9 @@ void Identifier::destroy (void) { } + +bool +Identifier::operator== (const Identifier &other) const +{ + return !ACE_OS::strcmp (pv_string, other.get_string ()); +} -- 2.11.4.GIT