diff options
author | Jose <jose@zeroc.com> | 2019-03-09 21:13:01 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-03-09 21:13:01 +0100 |
commit | 32047cdd87984b54e1ac80b161e288f32f93d51a (patch) | |
tree | b6089bbd57e900188e069330187e67da7face46a /cpp/src/slice2swift/Gen.cpp | |
parent | Value marshalling fixes (diff) | |
download | ice-32047cdd87984b54e1ac80b161e288f32f93d51a.tar.bz2 ice-32047cdd87984b54e1ac80b161e288f32f93d51a.tar.xz ice-32047cdd87984b54e1ac80b161e288f32f93d51a.zip |
Swift class resolver updates
Diffstat (limited to 'cpp/src/slice2swift/Gen.cpp')
-rw-r--r-- | cpp/src/slice2swift/Gen.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index d3d05567e8e..11dfe2da2ba 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -841,6 +841,38 @@ Gen::ValueVisitor::visitClassDefStart(const ClassDefPtr& p) base = bases.front(); } + // + // For each Value class we generate a extension in ClassResolver + // + ostringstream factory; + StringList parts = splitScopedName(p->scoped()); + for(StringList::const_iterator it = parts.begin(); it != parts.end();) + { + factory << (*it); + if(++it != parts.end()) + { + factory << "_"; + } + } + + out << sp; + out << nl << "public class " << name << "_TypeResolver: Ice.ValueTypeResolver"; + out << sb; + out << nl << "public override func type() -> Ice.Value.Type"; + out << sb; + out << nl << "return " << name << ".self"; + out << eb; + out << eb; + + out << sp; + out << nl << "public extension Ice.ClassResolver"; + out << sb; + out << nl << "@objc public static func " << factory.str() << "() -> Ice.ValueTypeResolver"; + out << sb; + out << nl << "return " << name << "_TypeResolver()"; + out << eb; + out << eb; + out << sp; out << nl << "public class " << name << ": "; if(base) |