diff options
author | Marc Laukien <marc@zeroc.com> | 2004-04-07 00:13:35 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-04-07 00:13:35 +0000 |
commit | d702a6bd170669e2b959ae49b24224c72ab8f367 (patch) | |
tree | 0109385349191c72a45cb2c3860ace90f0702d18 /cpp/src/Ice/Reference.cpp | |
parent | facet changes (diff) | |
download | ice-d702a6bd170669e2b959ae49b24224c72ab8f367.tar.bz2 ice-d702a6bd170669e2b959ae49b24224c72ab8f367.tar.xz ice-d702a6bd170669e2b959ae49b24224c72ab8f367.zip |
facet changes
Diffstat (limited to 'cpp/src/Ice/Reference.cpp')
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index f76be8ff9a2..82b926d575d 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -228,7 +228,19 @@ IceInternal::Reference::streamWrite(BasicStream* s) const // write the identity. // - s->write(facet); + // + // For compatibility with the old FacetPath. + // + if(facet.empty()) + { + s->write(vector<string>()); + } + else + { + vector<string> facetPath; + facetPath.push_back(facet); + s->write(facetPath); + } s->write(static_cast<Byte>(mode)); @@ -275,32 +287,22 @@ IceInternal::Reference::toString() const if(!facet.empty()) { - ostringstream f; - FacetPath::const_iterator p = facet.begin(); - while(p != facet.end()) - { - f << encodeString(*p++, "/"); - if(p != facet.end()) - { - f << '/'; - } - } - - // - // If the encoded facet string contains characters which - // the reference parser uses as separators, then we enclose - // the facet string in quotes. - // s << " -f "; - const string& fs = f.str(); - if(fs.find_first_of(" \t\n\r:@") != string::npos) - { - s << '"' << fs << '"'; - } - else - { - s << fs; - } + + // + // If the encoded facet string contains characters which + // the reference parser uses as separators, then we enclose + // the facet string in quotes. + // + string fs = encodeString(facet, ""); + if(fs.find_first_of(" \t\n\r:@") != string::npos) + { + s << '"' << fs << '"'; + } + else + { + s << fs; + } } switch(mode) @@ -408,7 +410,7 @@ IceInternal::Reference::changeContext(const Context& newContext) const } ReferencePtr -IceInternal::Reference::changeFacet(const FacetPath& newFacet) const +IceInternal::Reference::changeFacet(const string& newFacet) const { if(newFacet == facet) { @@ -639,7 +641,7 @@ IceInternal::Reference::changeDefault() const LocatorInfoPtr defaultLocatorInfo = instance->locatorManager()-> get(instance->referenceFactory()->getDefaultLocator()); - return instance->referenceFactory()->create(identity, context, FacetPath(), ModeTwoway, false, adapterId, + return instance->referenceFactory()->create(identity, context, "", ModeTwoway, false, adapterId, endpoints, defaultRouterInfo, defaultLocatorInfo, 0, true); } @@ -836,7 +838,7 @@ IceInternal::Reference::filterEndpoints(const vector<EndpointPtr>& allEndpoints) IceInternal::Reference::Reference(const InstancePtr& inst, const Identity& ident, const Context& ctx, - const FacetPath& facPath, + const string& fs, Mode md, bool sec, const string& adptid, @@ -848,7 +850,7 @@ IceInternal::Reference::Reference(const InstancePtr& inst, instance(inst), identity(ident), context(ctx), - facet(facPath), + facet(fs), mode(md), secure(sec), adapterId(adptid), @@ -868,7 +870,6 @@ IceInternal::Reference::Reference(const InstancePtr& inst, string::const_iterator p; Context::const_iterator q; - FacetPath::const_iterator r; for(p = identity.name.begin(); p != identity.name.end(); ++p) { @@ -892,12 +893,9 @@ IceInternal::Reference::Reference(const InstancePtr& inst, } } - for(r = facet.begin(); r != facet.end(); ++r) + for(p = facet.begin(); p != facet.end(); ++p) { - for(p = r->begin(); p != r->end(); ++p) - { - h = 5 * h + *p; - } + h = 5 * h + *p; } h = 5 * h + static_cast<Int>(mode); |