From ce87f52fa9976b2d9633be9c25ef4321c56eb2e6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 14 Apr 2018 14:09:59 +0100 Subject: Ice 3.7 Remove straggling references to IceUtil::Optional --- slicer/db/sqlSelectDeserializer.cpp | 2 +- slicer/db/sqlSelectDeserializer.h | 6 ++--- slicer/db/testInsert.cpp | 2 +- slicer/db/testSelect.cpp | 10 ++++---- slicer/db/testUpdate.cpp | 10 ++++---- slicer/ice/testSpecifics.cpp | 6 ++--- slicer/slicer/modelParts.cpp | 4 ++-- slicer/slicer/modelParts.h | 6 ++--- slicer/slicer/modelPartsTypes.cpp | 16 ++++++------- slicer/slicer/modelPartsTypes.h | 14 +++++------ slicer/slicer/modelPartsTypes.impl.h | 46 ++++++++++++++++++------------------ slicer/test/conversions.cpp | 4 ++-- slicer/test/conversions.h | 4 ++-- slicer/test/serializers.cpp | 2 +- slicer/tool/parser.cpp | 4 ++-- 15 files changed, 68 insertions(+), 68 deletions(-) diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp index 0fa9892..f150bde 100644 --- a/slicer/db/sqlSelectDeserializer.cpp +++ b/slicer/db/sqlSelectDeserializer.cpp @@ -4,7 +4,7 @@ #include namespace Slicer { - SqlSelectDeserializer::SqlSelectDeserializer(DB::SelectCommand * c, IceUtil::Optional tc) : + SqlSelectDeserializer::SqlSelectDeserializer(DB::SelectCommand * c, Ice::optional tc) : cmd(c), typeIdColName(tc) { diff --git a/slicer/db/sqlSelectDeserializer.h b/slicer/db/sqlSelectDeserializer.h index af39039..96c7334 100644 --- a/slicer/db/sqlSelectDeserializer.h +++ b/slicer/db/sqlSelectDeserializer.h @@ -8,7 +8,7 @@ namespace Slicer { class DLL_PUBLIC SqlSelectDeserializer : public Slicer::Deserializer { public: - SqlSelectDeserializer(DB::SelectCommand *, IceUtil::Optional typeIdCol = IceUtil::Optional()); + SqlSelectDeserializer(DB::SelectCommand *, Ice::optional typeIdCol = Ice::optional()); virtual void Deserialize(Slicer::ModelPartForRootPtr) override; @@ -20,8 +20,8 @@ namespace Slicer { DB::SelectCommand * cmd; unsigned int columnCount; - IceUtil::Optional typeIdColName; - IceUtil::Optional typeIdColIdx; + Ice::optional typeIdColName; + Ice::optional typeIdColIdx; }; } diff --git a/slicer/db/testInsert.cpp b/slicer/db/testInsert.cpp index 7dbb6b7..3724679 100644 --- a/slicer/db/testInsert.cpp +++ b/slicer/db/testInsert.cpp @@ -19,7 +19,7 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(TestDatabase::Timespan); namespace std { template - ostream & operator<<(ostream & s, const IceUtil::Optional &) { + ostream & operator<<(ostream & s, const Ice::optional &) { return s; } } diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp index afcd3f2..d2c9b24 100644 --- a/slicer/db/testSelect.cpp +++ b/slicer/db/testSelect.cpp @@ -174,20 +174,20 @@ BOOST_AUTO_TEST_CASE( select_noRowsSimple ) BOOST_AUTO_TEST_CASE( select_noRowsSimpleOptional ) { auto sel = db->select("SELECT id FROM test WHERE false"); - auto v = Slicer::DeserializeAny>(sel.get()); + auto v = Slicer::DeserializeAny>(sel.get()); BOOST_REQUIRE(!v); } BOOST_AUTO_TEST_CASE( select_tooManyRowsSimpleOptional ) { auto sel = db->select("SELECT id FROM test"); - BOOST_REQUIRE_THROW(BoostThrowWrapperHelper>(sel.get()), Slicer::TooManyRowsReturned); + BOOST_REQUIRE_THROW(BoostThrowWrapperHelper>(sel.get()), Slicer::TooManyRowsReturned); } BOOST_AUTO_TEST_CASE( select_simpleOptional ) { auto sel = db->select("SELECT MAX(id) FROM test"); - auto v = Slicer::DeserializeAny>(sel.get()); + auto v = Slicer::DeserializeAny>(sel.get()); BOOST_REQUIRE(v); BOOST_REQUIRE_EQUAL(4, *v); } @@ -201,7 +201,7 @@ BOOST_AUTO_TEST_CASE( select_noRowsComplexOptional ) string mstring \ FROM test \ WHERE false"); - auto v = Slicer::DeserializeAny>(sel.get()); + auto v = Slicer::DeserializeAny>(sel.get()); BOOST_REQUIRE(!v); } @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE( select_null ) BOOST_REQUIRE_EQUAL(*oi->optSimple, 4); sel = db->select("SELECT MAX(id) FROM test WHERE false"); - auto v = Slicer::DeserializeAny>(sel.get()); + auto v = Slicer::DeserializeAny>(sel.get()); BOOST_REQUIRE(!v); } diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp index a76b9a1..48ea903 100644 --- a/slicer/db/testUpdate.cpp +++ b/slicer/db/testUpdate.cpp @@ -91,11 +91,11 @@ BOOST_AUTO_TEST_CASE( update_withNulls ) BOOST_REQUIRE_EQUAL("string updated", *bis[0]->mstring); BOOST_REQUIRE_EQUAL("string", *bis[1]->mstring); bis[0]->mstring = "not null"s; - bis[1]->mstring = IceUtil::Optional(); - bis[0]->mfloat = IceUtil::Optional(); - bis[1]->mbyte = IceUtil::Optional(); - bis[0]->mshort = IceUtil::Optional(); - bis[1]->mdouble = IceUtil::Optional(); + bis[1]->mstring = Ice::optional(); + bis[0]->mfloat = Ice::optional(); + bis[1]->mbyte = Ice::optional(); + bis[0]->mshort = Ice::optional(); + bis[1]->mdouble = Ice::optional(); BOOST_TEST_CHECKPOINT("Do update"); Slicer::SerializeAny(bis, db, "builtins"); auto bis2 = Slicer::DeserializeAny(sel.get()); diff --git a/slicer/ice/testSpecifics.cpp b/slicer/ice/testSpecifics.cpp index 1689ed0..d45cf2c 100644 --- a/slicer/ice/testSpecifics.cpp +++ b/slicer/ice/testSpecifics.cpp @@ -55,13 +55,13 @@ testCompareOptional(const X & d) { BOOST_TEST_CHECKPOINT(typeid(X).name()); std::stringstream strm; - IceUtil::Optional x; + Ice::optional x; Slicer::SerializeAny(x, strm); - auto x2 = Slicer::DeserializeAny>(strm); + auto x2 = Slicer::DeserializeAny>(strm); BOOST_REQUIRE(!x2); x = d; Slicer::SerializeAny(x, strm); - auto x3 = Slicer::DeserializeAny>(strm); + auto x3 = Slicer::DeserializeAny>(strm); BOOST_REQUIRE_EQUAL(d, *x3); } diff --git a/slicer/slicer/modelParts.cpp b/slicer/slicer/modelParts.cpp index 83d7833..3736156 100644 --- a/slicer/slicer/modelParts.cpp +++ b/slicer/slicer/modelParts.cpp @@ -25,10 +25,10 @@ namespace Slicer { return TypeId(); } - IceUtil::Optional + Ice::optional ModelPart::GetTypeIdProperty() const { - return IceUtil::Optional(); + return Ice::optional(); } void diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h index 08c1e0d..4994c68 100644 --- a/slicer/slicer/modelParts.h +++ b/slicer/slicer/modelParts.h @@ -1,7 +1,7 @@ #ifndef SLICER_MODELPARTS_H #define SLICER_MODELPARTS_H -#include +#include #include #include #include @@ -68,7 +68,7 @@ namespace Slicer { typedef std::shared_ptr ModelPartPtr; typedef std::shared_ptr ModelPartForRootPtr; typedef std::unique_ptr HookCommonPtr; - typedef IceUtil::Optional TypeId; + typedef Ice::optional TypeId; typedef boost::function ChildHandler; @@ -136,7 +136,7 @@ namespace Slicer { virtual ChildRef GetChildRef(const std::string & memberName, const HookFilter & = HookFilter(), bool matchCase = true) = 0; virtual ModelPartPtr GetSubclassModelPart(const std::string &); virtual TypeId GetTypeId() const; - virtual IceUtil::Optional GetTypeIdProperty() const; + virtual Ice::optional GetTypeIdProperty() const; virtual ModelPartType GetType() const = 0; virtual void Create(); virtual void Complete(); diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index 3b2961c..37b9fce 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -66,14 +66,14 @@ namespace Slicer { template<> const std::string Slicer::ModelPartForRoot::rootName = "Int"; template<> const std::string Slicer::ModelPartForRoot::rootName = "Long"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalString"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalBoolean"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalFloat"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalDouble"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalByte"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalShort"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalInt"; - template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalLong"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalString"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalBoolean"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalFloat"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalDouble"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalByte"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalShort"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalInt"; + template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalLong"; MODELPARTFOR(std::string, ModelPartForSimple); MODELPARTFOR(bool, ModelPartForSimple); diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index 3f26046..89f09c7 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -86,12 +86,12 @@ namespace Slicer { virtual bool GetValue(ValueTarget && s) override; }; - template M::* MV> - class DLL_PUBLIC ModelPartForConverted, M, MV> : public ModelPartForConvertedBase, protected ModelPartModel> { + template M::* MV> + class DLL_PUBLIC ModelPartForConverted, M, MV> : public ModelPartForConvertedBase, protected ModelPartModel> { public: - typedef IceUtil::Optional element_type; + typedef Ice::optional element_type; - ModelPartForConverted(IceUtil::Optional * h); + ModelPartForConverted(Ice::optional * h); virtual void SetValue(ValueSource && s) override; virtual bool GetValue(ValueTarget && s) override; @@ -115,9 +115,9 @@ namespace Slicer { }; template - class DLL_PUBLIC ModelPartForOptional : public ModelPartForOptionalBase, protected ModelPartModel > { + class DLL_PUBLIC ModelPartForOptional : public ModelPartForOptionalBase, protected ModelPartModel > { public: - ModelPartForOptional(IceUtil::Optional< typename T::element_type > * h); + ModelPartForOptional(Ice::optional< typename T::element_type > * h); virtual void Create() override; virtual bool GetValue(ValueTarget && s) override; virtual ModelPartType GetType() const override; @@ -228,7 +228,7 @@ namespace Slicer { template std::string getTypeId(typename std::enable_if::value>::type * = nullptr) const; - virtual IceUtil::Optional GetTypeIdProperty() const override; + virtual Ice::optional GetTypeIdProperty() const override; static const std::string typeIdProperty; static const std::string * className; diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 03af7c1..dfef37d 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -14,15 +14,15 @@ template<> ModelPartPtr ModelPart::CreateFor() { return std::make_shared(nullptr); } \ template<> ModelPartPtr ModelPart::CreateFor(Type & s) { return std::make_shared(&s); } \ template<> ModelPartPtr ModelPart::CreateFor(const Type & s) { return CreateFor(const_cast(s)); } \ - template<> ModelPartPtr ModelPart::CreateFor(IceUtil::Optional & s) { return std::make_shared>(&s); } \ - template<> ModelPartPtr ModelPart::CreateFor(const IceUtil::Optional & s) { return CreateFor(const_cast &>(s)); } \ + template<> ModelPartPtr ModelPart::CreateFor(Ice::optional & s) { return std::make_shared>(&s); } \ + template<> ModelPartPtr ModelPart::CreateFor(const Ice::optional & s) { return CreateFor(const_cast &>(s)); } \ template<> ModelPartForRootPtr ModelPart::CreateRootFor(Type & s) { return std::make_shared>(&s); } \ - template<> ModelPartForRootPtr ModelPart::CreateRootFor(IceUtil::Optional & s) { return std::make_shared>>(&s); } \ + template<> ModelPartForRootPtr ModelPart::CreateRootFor(Ice::optional & s) { return std::make_shared>>(&s); } \ template<> ModelPartForRootPtr ModelPart::CreateRootFor(const Type & s) { return CreateRootFor(const_cast(s)); } \ - template<> ModelPartForRootPtr ModelPart::CreateRootFor(const IceUtil::Optional & s) { return CreateRootFor(const_cast &>(s)); } \ + template<> ModelPartForRootPtr ModelPart::CreateRootFor(const Ice::optional & s) { return CreateRootFor(const_cast &>(s)); } \ template class BaseModelPart; \ template class ModelPartForRoot; \ - template class ModelPartForRoot< IceUtil::Optional >; \ + template class ModelPartForRoot< Ice::optional >; \ #define MODELPARTFOR(Type, ModelPartType) \ CUSTOMMODELPARTFOR(Type, ModelPartType, ModelPartType) @@ -56,7 +56,7 @@ namespace Slicer { template void - typeWrite(::Ice::OutputStream & s, const ::IceUtil::Optional & m) + typeWrite(::Ice::OutputStream & s, const ::Ice::optional & m) { if constexpr (!Slicer::isLocal::value) { typedef Ice::StreamableTraits traits; @@ -86,7 +86,7 @@ namespace Slicer { template void - typeRead(::Ice::InputStream & s, ::IceUtil::Optional & m) + typeRead(::Ice::InputStream & s, ::Ice::optional & m) { if constexpr (!Slicer::isLocal::value) { typedef Ice::StreamableTraits traits; @@ -159,14 +159,14 @@ namespace Slicer { { } - template M::* MV> - ModelPartForConverted, M, MV>::ModelPartForConverted(IceUtil::Optional * h) : - ModelPartModel>(h) + template M::* MV> + ModelPartForConverted, M, MV>::ModelPartForConverted(Ice::optional * h) : + ModelPartModel>(h) { } - template M::* MV> - bool ModelPartForConverted, M, MV>::HasValue() const + template M::* MV> + bool ModelPartForConverted, M, MV>::HasValue() const { BOOST_ASSERT(this->Model); return (bool)*this->Model; @@ -189,22 +189,22 @@ namespace Slicer { T & operator()(T & x) const { return x; } const T & operator()(const T & x) const { return x; } template - T & operator()(IceUtil::Optional & x) const { if (!x) x = Y(); return *x; } + T & operator()(Ice::optional & x) const { if (!x) x = Y(); return *x; } template - const T & operator()(const IceUtil::Optional & x) const { return *x; } + const T & operator()(const Ice::optional & x) const { return *x; } static bool valueExists(const T &) { return true; } - static bool valueExists(const IceUtil::Optional & y) { return y.has_value(); } + static bool valueExists(const Ice::optional & y) { return y.has_value(); } }; template - struct Coerce> { + struct Coerce> { typedef typename std::remove_const::type>::type T; - IceUtil::Optional & operator()(IceUtil::Optional & x) const { return x; } - const IceUtil::Optional & operator()(const IceUtil::Optional & x) const { return x; } + Ice::optional & operator()(Ice::optional & x) const { return x; } + const Ice::optional & operator()(const Ice::optional & x) const { return x; } template - IceUtil::Optional operator()(Y & y) const { return y; } + Ice::optional operator()(Y & y) const { return y; } static bool valueExists(const T &) { return true; } - static bool valueExists(const IceUtil::Optional &) { return true; } + static bool valueExists(const Ice::optional &) { return true; } }; template @@ -272,8 +272,8 @@ namespace Slicer { // ModelPartForOptional template - ModelPartForOptional::ModelPartForOptional(IceUtil::Optional< typename T::element_type > * h) : - ModelPartModel >(h) + ModelPartForOptional::ModelPartForOptional(Ice::optional< typename T::element_type > * h) : + ModelPartModel >(h) { if (this->Model && *this->Model) { modelPart = std::make_shared(&**this->Model); @@ -445,7 +445,7 @@ namespace Slicer { } template - IceUtil::Optional ModelPartForClass::GetTypeIdProperty() const + Ice::optional ModelPartForClass::GetTypeIdProperty() const { return typeIdProperty; } diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp index edeadac..3c23814 100644 --- a/slicer/test/conversions.cpp +++ b/slicer/test/conversions.cpp @@ -90,7 +90,7 @@ namespace Slicer { } DLL_PUBLIC - IceUtil::Optional + Ice::optional str2int(const std::string & s) { if (s.empty()) { @@ -101,7 +101,7 @@ namespace Slicer { DLL_PUBLIC std::string - int2str(const IceUtil::Optional & i) + int2str(const Ice::optional & i) { if (!i) { return std::string(); diff --git a/slicer/test/conversions.h b/slicer/test/conversions.h index c540e77..5d45f7e 100644 --- a/slicer/test/conversions.h +++ b/slicer/test/conversions.h @@ -32,11 +32,11 @@ namespace Slicer { std::string dateTimeToString(const ::TestModule::DateTime & in); DLL_PUBLIC - IceUtil::Optional + Ice::optional str2int(const std::string &); DLL_PUBLIC std::string - int2str(const IceUtil::Optional &); + int2str(const Ice::optional &); } #endif diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp index a94567e..e298fbd 100644 --- a/slicer/test/serializers.cpp +++ b/slicer/test/serializers.cpp @@ -28,7 +28,7 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE ( TestModule::ClassMap::iterator ) BOOST_TEST_DONT_PRINT_LOG_VALUE ( TestModule::SomeNumbers ) namespace std { template - ostream & operator<<(ostream & s, const IceUtil::Optional &) { + ostream & operator<<(ostream & s, const Ice::optional &) { return s; } } diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index c05e2e6..d743f57 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -152,7 +152,7 @@ namespace Slicer { fprintbf(cpp, "const std::string ModelPartForRoot< %s >::rootName(\"%s\");\n\n", type, name); fprintbf(cpp, "template<> DLL_PUBLIC\n"); - fprintbf(cpp, "const std::string ModelPartForRoot< IceUtil::Optional< %s > >::rootName(\"Optional%s\");\n\n", + fprintbf(cpp, "const std::string ModelPartForRoot< Ice::optional< %s > >::rootName(\"Optional%s\");\n\n", type, name); } @@ -431,7 +431,7 @@ namespace Slicer { { fprintbf(cpp, "ModelPartForConverted< "); if (dm->optional()) { - fprintbf(cpp, "IceUtil::Optional< %s >", + fprintbf(cpp, "Ice::optional< %s >", Slice::typeToString(type)); } else { -- cgit v1.2.3