From 9a9b879140f8898e114afaaa1d420fa933d4c72a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 5 Dec 2015 16:52:34 +0000 Subject: Add missing support for optional roots --- slicer/slicer/modelParts.cpp | 9 +++++++++ slicer/slicer/modelParts.h | 4 ++++ slicer/slicer/slicer.cpp | 2 ++ 3 files changed, 15 insertions(+) diff --git a/slicer/slicer/modelParts.cpp b/slicer/slicer/modelParts.cpp index d8662e4..722417d 100644 --- a/slicer/slicer/modelParts.cpp +++ b/slicer/slicer/modelParts.cpp @@ -119,5 +119,14 @@ namespace Slicer { template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot::rootName = "Short"; template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot::rootName = "Int"; template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot::rootName = "Long"; + + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalString"; + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalBoolean"; + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalFloat"; + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalDouble"; + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalByte"; + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalShort"; + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalInt"; + template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot>::rootName = "OptionalLong"; } diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h index f914678..fa365ce 100644 --- a/slicer/slicer/modelParts.h +++ b/slicer/slicer/modelParts.h @@ -122,9 +122,13 @@ namespace Slicer { }; #define templateMODELPARTFOR(Type) \ + template ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional & t); \ + template ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional * t); \ template ModelPartPtr DLL_PUBLIC ModelPartFor(Type & t); \ template ModelPartPtr DLL_PUBLIC ModelPartFor(Type * t); #define MODELPARTFOR(Type) \ + ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional & t); \ + ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional * t); \ ModelPartPtr DLL_PUBLIC ModelPartFor(Type & t); \ ModelPartPtr DLL_PUBLIC ModelPartFor(Type * t); templateMODELPARTFOR(IceInternal::Handle); diff --git a/slicer/slicer/slicer.cpp b/slicer/slicer/slicer.cpp index a060956..b2a531e 100644 --- a/slicer/slicer/slicer.cpp +++ b/slicer/slicer/slicer.cpp @@ -3,6 +3,8 @@ namespace Slicer { const Metadata emptyMetadata; #define MODELPARTFOR(Type, ModelPart) \ + ModelPartPtr ModelPartFor(IceUtil::Optional & t) { return new ModelPartForOptional< ModelPart >(t); } \ + ModelPartPtr ModelPartFor(IceUtil::Optional * t) { return new ModelPartForOptional< ModelPart >(t); } \ ModelPartPtr ModelPartFor(Type & t) { return new ModelPart< Type >(t); } \ ModelPartPtr ModelPartFor(Type * t) { return new ModelPart< Type >(t); } MODELPARTFOR(std::string, ModelPartForSimple); -- cgit v1.2.3