diff options
author | Marc Laukien <marc@zeroc.com> | 2001-12-05 19:13:16 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-12-05 19:13:16 +0000 |
commit | 29f5d8c468d89715be66f3f99c0f444452a14176 (patch) | |
tree | 69dd25f91b7b73cc0ff48d7ceec0f89efe875926 /cpp/src/Ice/IdentityUtil.cpp | |
parent | bug fixes (diff) | |
download | ice-29f5d8c468d89715be66f3f99c0f444452a14176.tar.bz2 ice-29f5d8c468d89715be66f3f99c0f444452a14176.tar.xz ice-29f5d8c468d89715be66f3f99c0f444452a14176.zip |
Ice::Identity
Diffstat (limited to 'cpp/src/Ice/IdentityUtil.cpp')
-rw-r--r-- | cpp/src/Ice/IdentityUtil.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cpp/src/Ice/IdentityUtil.cpp b/cpp/src/Ice/IdentityUtil.cpp new file mode 100644 index 00000000000..06ae1b821e5 --- /dev/null +++ b/cpp/src/Ice/IdentityUtil.cpp @@ -0,0 +1,51 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/IdentityUtil.h> + +using namespace std; +using namespace Ice; +using namespace IceInternal; + +ostream& +Ice::operator<<(ostream& out, const Identity& ident) +{ + return out << identityToString(ident); +} + +Identity +Ice::stringToIdentity(const string& s) +{ + Identity ident; + string::size_type pos = s.find('#'); + if (pos != string::npos) + { + ident.category = s.substr(0, pos); + ident.name = s.substr(pos); + } + else + { + ident.name = s; + } + return ident; +} + +string +Ice::identityToString(const Identity& ident) +{ + if (ident.category.empty()) + { + return ident.name; + } + else + { + return ident.category + '#' + ident.name; + } +} |