From 9c12992889598ce3fadeb3d7dde36dba732d6fed Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 22 Jul 2017 00:21:44 +0100 Subject: Move some generated enum code into impl.h --- slicer/slicer/modelPartsTypes.impl.h | 16 ++++++++++++++++ slicer/tool/parser.cpp | 11 ----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 76b71dc..71ad746 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -368,6 +368,22 @@ namespace Slicer { return i->second; } + template + void ModelPartForEnum::SetValue(ValueSourcePtr s) + { + BOOST_ASSERT(this->Model); + std::string val; + s->set(val); + *this->Model = lookup(val); + } + + template + void ModelPartForEnum::GetValue(ValueTargetPtr s) + { + BOOST_ASSERT(this->Model); + s->get(lookup(*this->Model)); + } + // ModelPartForSequence template ModelPartForSequence::ModelPartForSequence(T * s) : diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index a2fc81b..d9a7a2b 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -329,17 +329,6 @@ namespace Slicer { } fprintbf(cpp, "\treturn e;\n}());\n\n"); - fprintbf(cpp, "template<> DLL_PUBLIC\nvoid ModelPartForEnum< %s >::SetValue(ValueSourcePtr s) {\n\ - std::string val;\n\ - s->set(val);\n\ - *this->Model = lookup(val);\n\ -}\n\n", - e->scoped()); - fprintbf(cpp, "template<> DLL_PUBLIC\nvoid ModelPartForEnum< %s >::GetValue(ValueTargetPtr s) {\n\ - s->get(lookup(*this->Model));\n\ -}\n\n", - e->scoped()); - auto name = metaDataValue("slicer:root:", e->getMetaData()); defineRoot(e->scoped(), name ? *name : e->name(), e); -- cgit v1.2.3