summaryrefslogtreecommitdiff
path: root/cpp/src/slice2swift/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2swift/Gen.cpp')
-rw-r--r--cpp/src/slice2swift/Gen.cpp32
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)