summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-15 13:41:38 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-15 13:41:38 +0100
commitf3e2dd7780bb90feff6b2f7a36797752a4933ff6 (patch)
tree70b494839b379ab96cae33b01ae9ef6c1e893340
parentAdd a redirect to work as a Gentoo mirror (diff)
downloadmirrorsearch-f3e2dd7780bb90feff6b2f7a36797752a4933ff6.tar.bz2
mirrorsearch-f3e2dd7780bb90feff6b2f7a36797752a4933ff6.tar.xz
mirrorsearch-f3e2dd7780bb90feff6b2f7a36797752a4933ff6.zip
C++17 and Ice 3.7
Updates all components to be C++17 and Ice 3.7
-rw-r--r--Jamroot.jam12
-rw-r--r--service/Jamfile.jam4
-rw-r--r--service/apiImpl.cpp12
-rw-r--r--service/apiImpl.h6
-rw-r--r--service/main.cpp4
-rw-r--r--service/test.cpp6
-rw-r--r--site/Jamfile.jam6
-rw-r--r--site/custom.cpp5
-rw-r--r--site/test.cpp11
-rw-r--r--slice.jam12
10 files changed, 34 insertions, 44 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index d389b87..de18e22 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -8,11 +8,12 @@ variant coverage : debug ;
project
: requirements
- <cxxflags>"-std=c++17 -fvisibility=hidden"
+ <define>ICE_CPP11_MAPPING
+ <cxxflags>"-std=c++17 -fvisibility=hidden -fvisibility-inlines-hidden"
<linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
- <variant>release:<cxxflags>"-fvisibility-inlines-hidden -flto=2"
+ <variant>release:<cxxflags>"-flto=2"
<variant>release:<linkflags>"-flto=2"
- <variant>debug:<cxxflags>"-W -Wall -Wextra -Werror -Wwrite-strings"
+ <variant>debug:<cxxflags>"-W -Wall -Werror -Wextra"
<variant>coverage:<cxxflags>"--coverage"
<variant>coverage:<linkflags>"--coverage"
;
@@ -38,10 +39,9 @@ lib slicer : : : : <include>/usr/include/slicer ;
lib slicer-db : : : : <include>/usr/include/slicer ;
lib icetray : : : : <include>/usr/include/icetray ;
lib dbppcore : : : : <include>/usr/include/dbpp ;
-lib Ice ;
-lib IceUtil ;
+lib Ice : : <name>Ice++11 ;
lib pthread ;
-lib IceBox ;
+lib IceBox : : <name>IceBox++11 ;
lib boost_filesystem ;
lib boost_system ;
lib boost_thread ;
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 :
:
<slicer>yes
<library>..//Ice
- <library>..//IceUtil
<library>..//pthread
<library>..//slicer
<library>..//adhocutil
@@ -25,7 +24,6 @@ lib mirrorsearch-api :
:
<slicer>yes
<library>..//Ice
- <library>..//IceUtil
<library>..//pthread
<library>..//slicer
<library>mirrorsearch-domain
@@ -52,7 +50,6 @@ lib mirrorsearch-service :
<library>..//boost_date_time
<library>..//Ice
<library>..//IceBox
- <library>..//IceUtil
<library>..//pthread
<library>..//icetray
<library>..//slicer
@@ -86,7 +83,6 @@ run test.cpp
<library>..//adhocutil
<library>..//boost_system
<library>..//boost_filesystem
- <library>..//IceUtil
<library>..//Ice
<library>..//IceBox
<library>..//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<SearchImpl>())
{
@@ -65,7 +65,7 @@ namespace MirrorSearch {
AdHocFormatter(Read, "Failed to read in %? (%?) [%?]");
UPtr<xmlDoc> 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<SearchHit>(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 <Ice/Communicator.h>
+#include <Ice/Initialize.h>
#include <Ice/ObjectAdapter.h>
#include <icetrayService.h>
#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<SearchImpl>(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 <definedDirs.h>
#include <api.h>
-class Service : PQ::Mock, public IceTray::DryIce {
+class Service : DB::PluginMock<PQ::Mock>, public IceTray::DryIce {
public:
- Service() : PQ::Mock("user=postgres", "MirrorSearch", {
+ Service() : DB::PluginMock<PQ::Mock>("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);
diff --git a/site/Jamfile.jam b/site/Jamfile.jam
index 7bdba93..51a2f98 100644
--- a/site/Jamfile.jam
+++ b/site/Jamfile.jam
@@ -6,8 +6,6 @@ lib icespider-common ;
lib icespider-fcgi ;
lib icespider-testing ;
lib adhocutil ;
-lib Ice ;
-lib IceUtil ;
lib pthread ;
lib boost_system ;
lib boost_filesystem ;
@@ -24,12 +22,10 @@ lib icespider : :
<include>/usr/share/icespider/ice
<library>icespider-common
<library>adhocutil
- <library>Ice
- <library>IceUtil
+ <library>..//Ice
<library>pthread
<library>slicer
<library>boost_system
- <allow-ice>yes
;
alias mirrorsearchsite :
diff --git a/site/custom.cpp b/site/custom.cpp
index 35d0d40..5d955a2 100644
--- a/site/custom.cpp
+++ b/site/custom.cpp
@@ -1,6 +1,7 @@
#include "icespider-routes-search.h"
namespace MirrorSearch {
+ using namespace std::literals;
// Implementation classes.
// Route name: download
@@ -19,13 +20,13 @@ namespace MirrorSearch {
auto _p_filename(request->getURLParam<::std::string>(_pi_filename));
auto _responseModel = prx0->feelingLucky(_p_filename, request->getContext());
if (_responseModel) {
- request->responseRedirect(*_responseModel, "Mirror found");
+ request->responseRedirect(*_responseModel, "Mirror found"s);
}
request->response(404, "No mirror found");
}
private:
- const MirrorSearch::SearchPrx prx0;
+ const MirrorSearch::SearchPrxPtr prx0;
const unsigned int _pi_filename;
};
diff --git a/site/test.cpp b/site/test.cpp
index ab71f83..4cd9763 100644
--- a/site/test.cpp
+++ b/site/test.cpp
@@ -6,6 +6,7 @@
#include <api.h>
#include <Ice/ObjectAdapter.h>
+#include <Ice/Initialize.h>
using namespace IceSpider;
using namespace MirrorSearch;
@@ -16,18 +17,18 @@ class TestSerice : public Search {
{
return {};
}
- virtual SearchHits getMatches(const ::std::string & fn, const ::Ice::Current& = ::Ice::Current()) override
+ virtual SearchHits getMatches(const ::std::string fn, const ::Ice::Current& = ::Ice::Current()) override
{
BOOST_TEST_INFO(fn);
if (fn == "good.txt") {
return {
- new SearchHit(1, 1, "file:///some/file/path"),
- new SearchHit(1, 1, "file:///some/other/path")
+ std::make_shared<SearchHit>(1, 1, "file:///some/file/path"),
+ std::make_shared<SearchHit>(1, 1, "file:///some/other/path")
};
}
return {};
}
- virtual ::IceUtil::Optional<::std::string> feelingLucky(const ::std::string & fn, const ::Ice::Current & c = ::Ice::Current()) override
+ virtual ::Ice::optional<::std::string> feelingLucky(const ::std::string fn, const ::Ice::Current & c = ::Ice::Current()) override
{
auto ms = getMatches(fn, c);
if (ms.empty()) {
@@ -47,7 +48,7 @@ class TestApp : public CoreWithDefaultRouter {
adp(communicator->createObjectAdapterWithEndpoints("test", "default"))
{
adp->activate();
- adp->add(new TestSerice(), communicator->stringToIdentity("Search"));
+ adp->add(std::make_shared<TestSerice>(), Ice::stringToIdentity("Search"));
}
~TestApp()
diff --git a/slice.jam b/slice.jam
index 434e562..d261c50 100644
--- a/slice.jam
+++ b/slice.jam
@@ -8,7 +8,6 @@ import toolset ;
type.register SLICE : ice ;
feature slicer : no yes pure ;
-feature allow-ice : no yes ;
feature ice-visibility : public hidden ;
class slice-scanner : common-scanner
@@ -29,27 +28,24 @@ generators.register-standard slice.slicer.pure : SLICE : CPP(slicer-%) : <slicer
toolset.flags slice.slice2cpp INCLUDES <include> ;
toolset.flags slice.slice2cpp DLLEXPORT <ice-visibility>public : --dll-export JAM_DLL_PUBLIC ;
-toolset.flags slice.slice2cpp ALLOWICE <allow-ice>yes : --ice ;
toolset.flags slice.slicer INCLUDES <include> ;
toolset.flags slice.slicer DLLEXPORT <ice-visibility>public : --dll-export JAM_DLL_PUBLIC ;
-toolset.flags slice.slicer ALLOWICE <allow-ice>yes : --ice ;
toolset.flags slice.slicer.pure INCLUDES <include> ;
-toolset.flags slice.slicer.pure ALLOWICE <allow-ice>yes : --ice ;
actions slice.slice2cpp
{
- slice2cpp -I"$(INCLUDES)" --checksum --output-dir $(1[1]:D) $(2) $(DLLEXPORT) $(ALLOWICE[1])
+ slice2cpp -I"$(INCLUDES)" --checksum --output-dir $(1[1]:D) $(2) $(DLLEXPORT)
}
actions slice.slicer
{
- slice2cpp -I"$(INCLUDES)" --checksum --output-dir $(1[1]:D) $(2) $(DLLEXPORT) $(ALLOWICE[1])
- slicer -I"$(INCLUDES)" $(2) $(1[2]) $(ALLOWICE[1])
+ slice2cpp -I"$(INCLUDES)" --checksum --output-dir $(1[1]:D) $(2) $(DLLEXPORT)
+ slicer -I"$(INCLUDES)" $(2) $(1[2])
}
actions slice.slicer.pure
{
- slicer -I"$(INCLUDES)" $(2) $(1[1]) $(ALLOWICE[1])
+ slicer -I"$(INCLUDES)" $(2) $(1[1])
}
IMPORT $(__name__) : slice.slice2cpp : : slice.slice2cpp ;