From 7cce01c40746c3e9925c1ecb4474b025bf2f9c1c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 29 Apr 2018 19:41:12 +0100 Subject: C++17 and Ice 3.7 Updates all components to be C++17 and Ice 3.7 --- libtmdb/Jamfile.jam | 5 +---- libtmdb/conversions.cpp | 2 +- libtmdb/conversions.h | 2 +- libtmdb/testModels.cpp | 14 +++++++++++--- libtmdb/tmdb-proxy.cpp | 8 ++++---- libtmdb/tmdb-proxy.h | 8 ++++---- 6 files changed, 22 insertions(+), 17 deletions(-) (limited to 'libtmdb') diff --git a/libtmdb/Jamfile.jam b/libtmdb/Jamfile.jam index faf02b9..f6c8366 100644 --- a/libtmdb/Jamfile.jam +++ b/libtmdb/Jamfile.jam @@ -2,8 +2,7 @@ import testing ; lib slicer : : : : /usr/include/slicer ; lib slicer-json : : : : /usr/include/slicer ; -lib Ice ; -lib IceUtil ; +lib Ice : : Ice++11 ; lib jsonpp ; lib pthread ; lib boost_system ; @@ -15,7 +14,6 @@ lib adhocutil : : : : /usr/include/adhocutil ; lib tmdb : [ glob *.cpp *.ice : test*.cpp ] : Ice - IceUtil jsonpp pthread slicer @@ -29,7 +27,6 @@ lib tmdb : : : . Ice - IceUtil pthread ; diff --git a/libtmdb/conversions.cpp b/libtmdb/conversions.cpp index 7f291da..1067dd8 100644 --- a/libtmdb/conversions.cpp +++ b/libtmdb/conversions.cpp @@ -6,7 +6,7 @@ namespace Slicer { std::string - dateToString(const IceUtil::Optional<::TMDb::Date> & in) + dateToString(const Ice::optional<::TMDb::Date> & in) { if (!in) { return std::string(); diff --git a/libtmdb/conversions.h b/libtmdb/conversions.h index c64cf92..72aeee2 100644 --- a/libtmdb/conversions.h +++ b/libtmdb/conversions.h @@ -5,7 +5,7 @@ #include namespace Slicer { - DLL_PUBLIC std::string dateToString(const IceUtil::Optional<::TMDb::Date> &); + DLL_PUBLIC std::string dateToString(const Ice::optional<::TMDb::Date> &); DLL_PUBLIC IceUtil::Optional<::TMDb::Date> stringToDate(const std::string &); } diff --git a/libtmdb/testModels.cpp b/libtmdb/testModels.cpp index 3b1b289..2b61644 100644 --- a/libtmdb/testModels.cpp +++ b/libtmdb/testModels.cpp @@ -7,6 +7,14 @@ #include namespace std { + std::ostream & + operator<<(std::ostream & o, const Ice::optional & d) + { + if (d) { + o << *d; + } + return o; + } std::ostream & operator<<(std::ostream & o, const TMDb::Date & d) { @@ -23,13 +31,13 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json_breakingbad ) BOOST_REQUIRE_EQUAL(3, results->TotalResults); BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchTv", results->Results[0]->ice_id()); - auto tv = TMDb::SearchMatchTvPtr::dynamicCast(results->Results[0]); + auto tv = std::dynamic_pointer_cast(results->Results[0]); BOOST_REQUIRE_EQUAL("Breaking Bad", tv->Name); BOOST_REQUIRE_EQUAL("/1yeVJox3rjo2jBKrrihIMj7uoS9.jpg", tv->PosterPath); BOOST_REQUIRE_EQUAL(1396, tv->Id); BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchMovie", results->Results[1]->ice_id()); - auto movie = TMDb::SearchMatchMoviePtr::dynamicCast(results->Results[1]); + auto movie = std::dynamic_pointer_cast(results->Results[1]); BOOST_REQUIRE_EQUAL("No Half Measures: Creating the Final Season of Breaking Bad", movie->Title); BOOST_REQUIRE_EQUAL("/8OixSR45U5dbqv8F0tlspmTbXxN.jpg", movie->PosterPath); BOOST_REQUIRE_EQUAL(239459, movie->Id); @@ -43,7 +51,7 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json_bradpitt ) BOOST_REQUIRE_EQUAL(1, results->TotalResults); BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchPerson", results->Results[0]->ice_id()); - auto person = TMDb::SearchMatchPersonPtr::dynamicCast(results->Results[0]); + auto person = std::dynamic_pointer_cast(results->Results[0]); BOOST_REQUIRE_EQUAL("Brad Pitt", person->Name); BOOST_REQUIRE_EQUAL(287, person->Id); } diff --git a/libtmdb/tmdb-proxy.cpp b/libtmdb/tmdb-proxy.cpp index b20752c..d3c1e8f 100644 --- a/libtmdb/tmdb-proxy.cpp +++ b/libtmdb/tmdb-proxy.cpp @@ -7,25 +7,25 @@ namespace TMDb { } SearchMultiResultsPtr - Proxy::SearchMulti(const std::string & query, const IceUtil::Optional & page, const Ice::Current&) + Proxy::SearchMulti(const std::string query, const IceUtil::Optional page, const Ice::Current&) { return GetData("/search/multi", { { "query", query }, { "page", page } }); } SearchMovieResultsPtr - Proxy::SearchMovies(const std::string & query, const IceUtil::Optional & year, const IceUtil::Optional & page, const Ice::Current&) + Proxy::SearchMovies(const std::string query, const IceUtil::Optional year, const IceUtil::Optional page, const Ice::Current&) { return GetData("/search/movies", { { "query", query }, { "page", page }, { "year", year } }); } SearchPersonResultsPtr - Proxy::SearchPersons(const std::string & query, const IceUtil::Optional & page, const Ice::Current&) + Proxy::SearchPersons(const std::string query, const IceUtil::Optional page, const Ice::Current&) { return GetData("/search/person", { { "query", query }, { "page", page } }); } SearchTvResultsPtr - Proxy::SearchTv(const std::string & query, const IceUtil::Optional & page, const Ice::Current&) + Proxy::SearchTv(const std::string query, const IceUtil::Optional page, const Ice::Current&) { return GetData("/search/tv", { { "query", query}, { "page", page } }); } diff --git a/libtmdb/tmdb-proxy.h b/libtmdb/tmdb-proxy.h index 472e522..1fbe9d1 100644 --- a/libtmdb/tmdb-proxy.h +++ b/libtmdb/tmdb-proxy.h @@ -7,10 +7,10 @@ namespace TMDb { public: Proxy(const std::string & baseUrl, const std::string & apikey); - SearchMultiResultsPtr SearchMulti(const std::string&, const IceUtil::Optional&, const Ice::Current&) override; - SearchMovieResultsPtr SearchMovies(const std::string&, const IceUtil::Optional&, const IceUtil::Optional&, const Ice::Current&) override; - SearchPersonResultsPtr SearchPersons(const std::string&, const IceUtil::Optional&, const Ice::Current&) override; - SearchTvResultsPtr SearchTv(const std::string&, const IceUtil::Optional&, const Ice::Current&) override; + SearchMultiResultsPtr SearchMulti(const std::string, const IceUtil::Optional, const Ice::Current&) override; + SearchMovieResultsPtr SearchMovies(const std::string, const IceUtil::Optional, const IceUtil::Optional, const Ice::Current&) override; + SearchPersonResultsPtr SearchPersons(const std::string, const IceUtil::Optional, const Ice::Current&) override; + SearchTvResultsPtr SearchTv(const std::string, const IceUtil::Optional, const Ice::Current&) override; MoviePtr GetMovie(Ice::Int, const Ice::Current&) override; TvSeriesPtr GetTvSeries(Ice::Int, const Ice::Current&) override; }; -- cgit v1.2.3