diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2018-11-30 16:22:38 -0600 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2018-11-30 16:22:38 -0600 |
commit | 3c91f4dcc4281659f23b7597e5abff6b97b58f03 (patch) | |
tree | 759e435c8d7c8c50c89241a7a4dc0028a61be902 | |
parent | 1647e63b93d70567dfb0f4662c49824d9a365ef8 (diff) | |
download | ATCD-3c91f4dcc4281659f23b7597e5abff6b97b58f03.tar.gz |
tao_idl: Add some functionality to string
-rw-r--r-- | TAO/TAO_IDL/include/utl_identifier.h | 11 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_identifier.cpp | 18 |
2 files changed, 28 insertions, 1 deletions
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 ()); +} |