summaryrefslogtreecommitdiff
path: root/libtmdb
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-01-18 21:41:57 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-01-18 21:41:57 +0000
commitaef428d8d6840395d85abb066b8118fb3e04dbc9 (patch)
treec1a0c95997e2bc05c32d4b49f6bd8501b489fea3 /libtmdb
parentCompatibility with gcc-5.3.0 (diff)
downloadp2pvr-0.1.4.1.tar.bz2
p2pvr-0.1.4.1.tar.xz
p2pvr-0.1.4.1.zip
Remove straggling use of Slicer::Deserialize in favour of more flexible DeserializeAnyp2pvr-0.1.4.1
Diffstat (limited to 'libtmdb')
-rw-r--r--libtmdb/httpClient.h4
-rw-r--r--libtmdb/testModels.cpp10
-rw-r--r--libtmdb/tmdb-proxy.cpp12
3 files changed, 13 insertions, 13 deletions
diff --git a/libtmdb/httpClient.h b/libtmdb/httpClient.h
index e171323..8e75428 100644
--- a/libtmdb/httpClient.h
+++ b/libtmdb/httpClient.h
@@ -46,11 +46,11 @@ namespace TMDb {
}
template <typename ReturnModel, typename ... Params>
- IceInternal::Handle<ReturnModel>
+ ReturnModel
GetData(const std::string & pathFormat, const Params & ... params, const Parameters & parameters) const
{
json::Value data = FetchJson(GetUrl<Params...>(pathFormat, params..., parameters));
- return Slicer::Deserialize<Slicer::JsonValueDeserializer, ReturnModel>(data);
+ return Slicer::DeserializeAny<Slicer::JsonValueDeserializer, ReturnModel>(data);
}
DLL_PUBLIC static void packParams(boost::format &);
diff --git a/libtmdb/testModels.cpp b/libtmdb/testModels.cpp
index fac4e65..0557017 100644
--- a/libtmdb/testModels.cpp
+++ b/libtmdb/testModels.cpp
@@ -20,7 +20,7 @@ const boost::filesystem::path root(XSTR(ROOT));
BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json )
{
- auto results = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::SearchMultiResults>((root / "samples" / "searchMulti_breakingBad.json").string());
+ auto results = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::SearchMultiResultsPtr>((root / "samples" / "searchMulti_breakingBad.json").string());
BOOST_REQUIRE_EQUAL(1, results->Page);
BOOST_REQUIRE_EQUAL(1, results->TotalPages);
BOOST_REQUIRE_EQUAL(3, results->TotalResults);
@@ -30,13 +30,13 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json )
BOOST_REQUIRE_EQUAL("Breaking Bad", tv->Name);
BOOST_REQUIRE_EQUAL("/4yMXf3DW6oCL0lVPZaZM2GypgwE.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]);
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);
-
+
BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchPerson", results->Results[2]->ice_id());
auto person = TMDb::SearchMatchPersonPtr::dynamicCast(results->Results[2]);
BOOST_REQUIRE_EQUAL("Brad Pitt", person->Name);
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json )
BOOST_AUTO_TEST_CASE( deserialize_movie_json )
{
- auto movie = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::Movie>((root / "samples" / "movie_550.json").string());
+ auto movie = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::MoviePtr>((root / "samples" / "movie_550.json").string());
BOOST_REQUIRE_EQUAL(550, movie->Id);
BOOST_REQUIRE_EQUAL(false, movie->Adult);
BOOST_REQUIRE_EQUAL("/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg", movie->BackdropPath);
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( deserialize_movie_json )
BOOST_AUTO_TEST_CASE( deserialize_tvseries_json )
{
- auto tvSeries = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::TvSeries>((root / "samples" / "tv_1396.json").string());
+ auto tvSeries = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::TvSeriesPtr>((root / "samples" / "tv_1396.json").string());
BOOST_REQUIRE_EQUAL("/sIJyCJedGlZf1TId41gCtkblBGo.jpg", tvSeries->BackdropPath);
BOOST_REQUIRE_EQUAL(1, tvSeries->CreatedBy.size());
BOOST_REQUIRE_EQUAL(66633, tvSeries->CreatedBy.front().Id);
diff --git a/libtmdb/tmdb-proxy.cpp b/libtmdb/tmdb-proxy.cpp
index 7a575e5..b20752c 100644
--- a/libtmdb/tmdb-proxy.cpp
+++ b/libtmdb/tmdb-proxy.cpp
@@ -9,37 +9,37 @@ namespace TMDb {
SearchMultiResultsPtr
Proxy::SearchMulti(const std::string & query, const IceUtil::Optional<int> & page, const Ice::Current&)
{
- return GetData<SearchMultiResults>("/search/multi", { { "query", query }, { "page", page } });
+ return GetData<SearchMultiResultsPtr>("/search/multi", { { "query", query }, { "page", page } });
}
SearchMovieResultsPtr
Proxy::SearchMovies(const std::string & query, const IceUtil::Optional<int> & year, const IceUtil::Optional<int> & page, const Ice::Current&)
{
- return GetData<SearchMovieResults>("/search/movies", { { "query", query }, { "page", page }, { "year", year } });
+ return GetData<SearchMovieResultsPtr>("/search/movies", { { "query", query }, { "page", page }, { "year", year } });
}
SearchPersonResultsPtr
Proxy::SearchPersons(const std::string & query, const IceUtil::Optional<int> & page, const Ice::Current&)
{
- return GetData<SearchPersonResults>("/search/person", { { "query", query }, { "page", page } });
+ return GetData<SearchPersonResultsPtr>("/search/person", { { "query", query }, { "page", page } });
}
SearchTvResultsPtr
Proxy::SearchTv(const std::string & query, const IceUtil::Optional<int> & page, const Ice::Current&)
{
- return GetData<SearchTvResults>("/search/tv", { { "query", query}, { "page", page } });
+ return GetData<SearchTvResultsPtr>("/search/tv", { { "query", query}, { "page", page } });
}
MoviePtr
Proxy::GetMovie(Ice::Int id, const Ice::Current&)
{
- return GetData<Movie, Ice::Int>("/movie/%d", id, { });
+ return GetData<MoviePtr, Ice::Int>("/movie/%d", id, { });
}
TvSeriesPtr
Proxy::GetTvSeries(Ice::Int id, const Ice::Current&)
{
- return GetData<TvSeries, Ice::Int>("/tv/%d", id, { });
+ return GetData<TvSeriesPtr, Ice::Int>("/tv/%d", id, { });
}
}