summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-05 16:52:34 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-05 16:52:34 +0000
commit9a9b879140f8898e114afaaa1d420fa933d4c72a (patch)
tree6a544900f39b5f3cbb5d0c89b8f71123793d582b
parentAdd missing override markers (diff)
downloadslicer-9a9b879140f8898e114afaaa1d420fa933d4c72a.tar.bz2
slicer-9a9b879140f8898e114afaaa1d420fa933d4c72a.tar.xz
slicer-9a9b879140f8898e114afaaa1d420fa933d4c72a.zip
Add missing support for optional roots
-rw-r--r--slicer/slicer/modelParts.cpp9
-rw-r--r--slicer/slicer/modelParts.h4
-rw-r--r--slicer/slicer/slicer.cpp2
3 files changed, 15 insertions, 0 deletions
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<Ice::Short>::rootName = "Short";
template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<Ice::Int>::rootName = "Int";
template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<Ice::Long>::rootName = "Long";
+
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<std::string>>::rootName = "OptionalString";
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<bool>>::rootName = "OptionalBoolean";
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<Ice::Float>>::rootName = "OptionalFloat";
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<Ice::Double>>::rootName = "OptionalDouble";
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<Ice::Byte>>::rootName = "OptionalByte";
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<Ice::Short>>::rootName = "OptionalShort";
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<Ice::Int>>::rootName = "OptionalInt";
+ template<> DLL_PUBLIC std::string Slicer::ModelPartForRoot<IceUtil::Optional<Ice::Long>>::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 <class T> ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional<Type> & t); \
+ template <class T> ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional<Type> * t); \
template <class T> ModelPartPtr DLL_PUBLIC ModelPartFor(Type & t); \
template <class T> ModelPartPtr DLL_PUBLIC ModelPartFor(Type * t);
#define MODELPARTFOR(Type) \
+ ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional<Type> & t); \
+ ModelPartPtr DLL_PUBLIC ModelPartFor(IceUtil::Optional<Type> * t); \
ModelPartPtr DLL_PUBLIC ModelPartFor(Type & t); \
ModelPartPtr DLL_PUBLIC ModelPartFor(Type * t);
templateMODELPARTFOR(IceInternal::Handle<T>);
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<Type> & t) { return new ModelPartForOptional< ModelPart<Type> >(t); } \
+ ModelPartPtr ModelPartFor(IceUtil::Optional<Type> * t) { return new ModelPartForOptional< ModelPart<Type> >(t); } \
ModelPartPtr ModelPartFor(Type & t) { return new ModelPart< Type >(t); } \
ModelPartPtr ModelPartFor(Type * t) { return new ModelPart< Type >(t); }
MODELPARTFOR(std::string, ModelPartForSimple);