From 2ac73347b605101e38500ca1030c14497dc0806b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 6 Dec 2015 23:07:12 +0000 Subject: Add missing support for optional roots in user types --- slicer/slicer/parser.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slicer/slicer/parser.cpp b/slicer/slicer/parser.cpp index 9c8e28e..607ff36 100644 --- a/slicer/slicer/parser.cpp +++ b/slicer/slicer/parser.cpp @@ -91,6 +91,8 @@ namespace Slicer { fprintbf(cpp, "#include <%s>\n\n", fs::change_extension(topLevelFile.filename(), ".h").string()); fprintbf(cpp, "#include \n\n"); fprintbf(cpp, "#define templateMODELPARTFOR(Type, ModelPart) \\\n"); + fprintbf(cpp, "template <> ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional & t) { return new ModelPartForOptional< ModelPart< Type > >(t); } \\\n"); + fprintbf(cpp, "template <> ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional * t) { return new ModelPartForOptional< ModelPart< Type > >(t); } \\\n"); fprintbf(cpp, "template <> ModelPartPtr DLL_PUBLIC ModelPartFor(Type & t) { return new ModelPart< Type >(t); } \\\n"); fprintbf(cpp, "template <> ModelPartPtr DLL_PUBLIC ModelPartFor(Type * t) { return new ModelPart< Type >(t); }\n\n"); fprintbf(cpp, "namespace Slicer {\n"); @@ -132,6 +134,9 @@ namespace Slicer { fprintbf(cpp, "template<>\n"); fprintbf(cpp, "DLL_PUBLIC std::string ModelPartForRoot< %s >::rootName(\"%s\");\n\n", type, name); + fprintbf(cpp, "template<>\n"); + fprintbf(cpp, "DLL_PUBLIC std::string ModelPartForRoot< IceUtil::Optional< %s > >::rootName(\"Optional%s\");\n\n", + type, name); } bool -- cgit v1.2.3