From f3e2dd7780bb90feff6b2f7a36797752a4933ff6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 15 Apr 2018 13:41:38 +0100 Subject: C++17 and Ice 3.7 Updates all components to be C++17 and Ice 3.7 --- service/Jamfile.jam | 4 ---- service/apiImpl.cpp | 12 ++++++------ service/apiImpl.h | 6 +++--- service/main.cpp | 4 ++-- service/test.cpp | 6 +++--- 5 files changed, 14 insertions(+), 18 deletions(-) (limited to 'service') diff --git a/service/Jamfile.jam b/service/Jamfile.jam index 3c2862d..315457a 100644 --- a/service/Jamfile.jam +++ b/service/Jamfile.jam @@ -11,7 +11,6 @@ lib mirrorsearch-domain : : yes ..//Ice - ..//IceUtil ..//pthread ..//slicer ..//adhocutil @@ -25,7 +24,6 @@ lib mirrorsearch-api : : yes ..//Ice - ..//IceUtil ..//pthread ..//slicer mirrorsearch-domain @@ -52,7 +50,6 @@ lib mirrorsearch-service : ..//boost_date_time ..//Ice ..//IceBox - ..//IceUtil ..//pthread ..//icetray ..//slicer @@ -86,7 +83,6 @@ run test.cpp ..//adhocutil ..//boost_system ..//boost_filesystem - ..//IceUtil ..//Ice ..//IceBox ..//pthread diff --git a/service/apiImpl.cpp b/service/apiImpl.cpp index 42a7918..5a1e7a6 100644 --- a/service/apiImpl.cpp +++ b/service/apiImpl.cpp @@ -15,7 +15,7 @@ BOOST_VERIFY_MSG(CURLE_OK == curl_easy_setopt(curl.get(), opt, expr), "Failed setting option " #opt); namespace MirrorSearch { - SearchImpl::SearchImpl(IceTray::DatabasePoolPtr db) : + SearchImpl::SearchImpl(const DB::ConnectionPoolPtr & db) : IceTray::AbstractDatabaseClient(db), log(LOGMANAGER()->getLogger()) { @@ -65,7 +65,7 @@ namespace MirrorSearch { AdHocFormatter(Read, "Failed to read in %? (%?) [%?]"); UPtr getDoc(const SearchServicePtr & ss, const std::string & fn) { auto fmt = AdHoc::Buffer::getFormat(ss->baseurl); - auto url = (*fmt % fn).str(); + auto url = (fmt % fn).str(); char errbuf[CURL_ERROR_SIZE] = ""; xmlParserCtxtSPtr ctx { nullptr, nullptr }; @@ -137,17 +137,17 @@ namespace MirrorSearch { if (!xpathObj->nodesetval) { throw XmlError("Nodeset is null"); } - log->messagebf(LOG::INFO, "%d nodes matched %s", xpathObj->nodesetval->nodeNr, s->listxpath); + log->messagebf(LOG::LogLevel::INFO, "%d nodes matched %s", xpathObj->nodesetval->nodeNr, s->listxpath); for (int row = 0; row < xpathObj->nodesetval->nodeNr; row += 1) { xpathCtx->node = xpathObj->nodesetval->nodeTab[row]; auto xpathObjI = getXPathObj(s->urlxpath, xpathCtx, xmlXPathObjectType::XPATH_STRING); if (xpathObjI->stringval && *xpathObjI->stringval) { - sh.push_back(new SearchHit(0, s->id, (const char *) xpathObjI->stringval)); + sh.push_back(std::make_shared(0, s->id, (const char *) xpathObjI->stringval)); } } } - SearchHits SearchImpl::getMatches(const ::std::string & fn, const ::Ice::Current & c) + SearchHits SearchImpl::getMatches(const ::std::string fn, const ::Ice::Current & c) { SearchHits sh; for (const auto & s : getServices(c)) { @@ -156,7 +156,7 @@ namespace MirrorSearch { return sh; } - ::IceUtil::Optional<::std::string> SearchImpl::feelingLucky(const ::std::string & fn, const ::Ice::Current & c) + ::IceUtil::Optional<::std::string> SearchImpl::feelingLucky(const ::std::string fn, const ::Ice::Current & c) { const auto ms = getMatches(fn, c); if (ms.empty()) diff --git a/service/apiImpl.h b/service/apiImpl.h index e56368c..0ee7972 100644 --- a/service/apiImpl.h +++ b/service/apiImpl.h @@ -8,11 +8,11 @@ namespace MirrorSearch { class SearchImpl : public Search, public IceTray::AbstractDatabaseClient { public: - SearchImpl(IceTray::DatabasePoolPtr); + SearchImpl(const DB::ConnectionPoolPtr &); virtual SearchServices getServices(const ::Ice::Current& = ::Ice::Current()) override; - virtual SearchHits getMatches(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) override; - virtual ::IceUtil::Optional<::std::string> feelingLucky(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) override; + virtual SearchHits getMatches(const ::std::string, const ::Ice::Current& = ::Ice::Current()) override; + virtual ::IceUtil::Optional<::std::string> feelingLucky(const ::std::string, const ::Ice::Current& = ::Ice::Current()) override; private: void callService(const ::std::string & fn, const SearchServicePtr & s, SearchHits & sh) const; diff --git a/service/main.cpp b/service/main.cpp index 00563f4..c84b11b 100644 --- a/service/main.cpp +++ b/service/main.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "apiImpl.h" @@ -21,7 +21,7 @@ namespace MirrorSearch { void addObjects(const std::string &, const Ice::CommunicatorPtr & ic, const Ice::StringSeq &, const Ice::ObjectAdapterPtr & adp) override { auto dbpool = getConnectionPool(ic, "postgresql", "MirrorSearch"); - adp->add(new SearchImpl(dbpool), ic->stringToIdentity("Search")); + adp->add(std::make_shared(dbpool), Ice::stringToIdentity("Search")); } }; diff --git a/service/test.cpp b/service/test.cpp index 5be34e7..acc03e2 100644 --- a/service/test.cpp +++ b/service/test.cpp @@ -6,9 +6,9 @@ #include #include -class Service : PQ::Mock, public IceTray::DryIce { +class Service : DB::PluginMock, public IceTray::DryIce { public: - Service() : PQ::Mock("user=postgres", "MirrorSearch", { + Service() : DB::PluginMock("user=postgres", "MirrorSearch", { rootDir / "schema.sql", rootDir / "data.sql" }) { } @@ -22,7 +22,7 @@ class TestClient : public IceTray::DryIceClient { { } - MirrorSearch::SearchPrx s; + MirrorSearch::SearchPrxPtr s; }; BOOST_TEST_GLOBAL_FIXTURE(Service); -- cgit v1.2.3