diff options
author | Joe George <joe@zeroc.com> | 2019-04-08 14:50:41 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2019-04-08 14:51:10 -0400 |
commit | 488464295ab86a20f382bce9a53518a7d4f3d098 (patch) | |
tree | 1f488084f0ad1b4532f2c089c258406dc1d90f52 /cpp/src/slice2swift/Gen.cpp | |
parent | More LocalObject fixes (diff) | |
download | ice-488464295ab86a20f382bce9a53518a7d4f3d098.tar.bz2 ice-488464295ab86a20f382bce9a53518a7d4f3d098.tar.xz ice-488464295ab86a20f382bce9a53518a7d4f3d098.zip |
Add missing servant functions
Diffstat (limited to 'cpp/src/slice2swift/Gen.cpp')
-rw-r--r-- | cpp/src/slice2swift/Gen.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index be173732f74..c9ee78f2091 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -1375,11 +1375,50 @@ Gen::ObjectExtVisitor::visitClassDefStart(const ClassDefPtr& p) const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); const string name = getUnqualified(getAbsolute(p), swiftModule) + (!p->isInterface() ? "Disp" : ""); + ClassList allBases = p->allBases(); + StringList allIds; + transform(allBases.begin(), allBases.end(), back_inserter(allIds), ::IceUtil::constMemFun(&Contained::scoped)); + allIds.push_back(p->scoped()); + allIds.push_back("::Ice::Object"); + allIds.sort(); + allIds.unique(); + out << sp; out << nl << "public extension " << name; out << sb; + out << sp; + out << nl; + out << nl << "func ice_id(current _: Current) throws -> String"; + out << sb; + out << nl << "return \"" << p->scoped() << "\""; + out << eb; + + out << sp; + out << nl; + out << nl << "func ice_ids(current _: Current) throws -> [String]"; + out << sb; + out << nl << "return ["; + for(StringList::const_iterator r = allIds.begin(); r != allIds.end(); ++r) + { + if(r != allIds.begin()) + { + out << ", "; + } + out << "\"" << (*r) << "\""; + + } + out << "]"; + out << eb; + + out << sp; + out << nl; + out << nl << "func ice_isA(s: String, current _: Current) throws -> Bool"; + out << sb; + out << nl << "return s == \"" << p->scoped() << "\""; + out << eb; + return true; } |