summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/IdentityUtil.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-05-09 13:07:41 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-05-09 13:07:41 +0000
commit197b6de9281b52d0b53c4b3fa3312e371b4469a9 (patch)
treebae93f8155da0770f5dd45d12ef1160ee99aed54 /cpp/src/Ice/IdentityUtil.cpp
parentAdded identityToString and stringToIdentity to Communicator (diff)
downloadice-197b6de9281b52d0b53c4b3fa3312e371b4469a9.tar.bz2
ice-197b6de9281b52d0b53c4b3fa3312e371b4469a9.tar.xz
ice-197b6de9281b52d0b53c4b3fa3312e371b4469a9.zip
Fixed proxy and identity t/from string functions to use string converters
Diffstat (limited to 'cpp/src/Ice/IdentityUtil.cpp')
-rw-r--r--cpp/src/Ice/IdentityUtil.cpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/cpp/src/Ice/IdentityUtil.cpp b/cpp/src/Ice/IdentityUtil.cpp
deleted file mode 100644
index c994b37f50a..00000000000
--- a/cpp/src/Ice/IdentityUtil.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#include <Ice/IdentityUtil.h>
-#include <Ice/LocalException.h>
-#include <IceUtil/StringUtil.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;
-
- //
- // Find unescaped separator.
- //
- string::size_type slash = string::npos, pos = 0;
- while((pos = s.find('/', pos)) != string::npos)
- {
- if(pos == 0 || s[pos - 1] != '\\')
- {
- if(slash == string::npos)
- {
- slash = pos;
- }
- else
- {
- //
- // Extra unescaped slash found.
- //
- IdentityParseException ex(__FILE__, __LINE__);
- ex.str = s;
- throw ex;
- }
- }
- pos++;
- }
-
- if(slash == string::npos)
- {
- if(!IceUtil::unescapeString(s, 0, s.size(), ident.name))
- {
- IdentityParseException ex(__FILE__, __LINE__);
- ex.str = s;
- throw ex;
- }
- }
- else
- {
- if(!IceUtil::unescapeString(s, 0, slash, ident.category))
- {
- IdentityParseException ex(__FILE__, __LINE__);
- ex.str = s;
- throw ex;
- }
- if(slash + 1 < s.size())
- {
- if(!IceUtil::unescapeString(s, slash + 1, s.size(), ident.name))
- {
- IdentityParseException ex(__FILE__, __LINE__);
- ex.str = s;
- throw ex;
- }
- }
- }
-
- return ident;
-}
-
-string
-Ice::identityToString(const Identity& ident)
-{
- if(ident.category.empty())
- {
- return IceUtil::escapeString(ident.name, "/");
- }
- else
- {
- return IceUtil::escapeString(ident.category, "/") + '/' + IceUtil::escapeString(ident.name, "/");
- }
-}