summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-17 22:22:02 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-17 22:22:02 +0100
commitcdcadd2d16710a14ba1427e88a048d75ee88a3cb (patch)
tree5ad79125f1b6d385e234840205e1ca4804adbf56
parentGracefully handle the case where a use flag has no description (diff)
downloadgentoobrowse-2.1.tar.bz2
gentoobrowse-2.1.tar.xz
gentoobrowse-2.1.zip
C++17 and Ice 3.7gentoobrowse-2.1
Update everything to Ice 3.7 and C++17 in keeping with other libs/services
-rw-r--r--Jamroot.jam14
-rw-r--r--gentoobrowse/src/Jamfile.jam8
-rw-r--r--gentoobrowse/src/base.json2
-rw-r--r--gentoobrowse/src/packages.cpp188
-rw-r--r--gentoobrowse/src/search.cpp24
-rw-r--r--gentoobrowse/src/user.cpp98
-rw-r--r--slice.jam12
7 files changed, 146 insertions, 200 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index 83087e4..36fe9c6 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -7,12 +7,14 @@ variant coverage : debug ;
project
: requirements
- <variant>release:<cxxflags>"-std=c++1y -fvisibility=hidden"
- <variant>release:<linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
- <variant>debug:<cxxflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y -fvisibility=hidden"
- <variant>debug:<linkflags>"-Wl,-z,defs,--warn-once"
- <variant>coverage:<cxxflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y --coverage -fvisibility=hidden"
- <variant>coverage:<linkflags>"-Wl,-z,defs,--warn-once --coverage"
+ <define>ICE_CPP11_MAPPING
+ <cxxflags>"-std=c++17 -fvisibility=hidden -fvisibility-inlines-hidden"
+ <linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
+ <variant>release:<cxxflags>"-flto=2"
+ <variant>release:<linkflags>"-flto=2"
+ <variant>debug:<cxxflags>"-W -Wall -Werror -Wextra"
+ <variant>coverage:<cxxflags>"--coverage"
+ <variant>coverage:<linkflags>"--coverage"
;
build-project gentoobrowse ;
diff --git a/gentoobrowse/src/Jamfile.jam b/gentoobrowse/src/Jamfile.jam
index f480770..80fbed7 100644
--- a/gentoobrowse/src/Jamfile.jam
+++ b/gentoobrowse/src/Jamfile.jam
@@ -9,8 +9,7 @@ lib icespider-filesessions ;
lib icespider-testing ;
lib adhocutil ;
lib tidy ;
-lib Ice ;
-lib IceUtil ;
+lib Ice : : <name>Ice++11 ;
lib pthread ;
lib boost_system ;
lib boost_filesystem ;
@@ -41,11 +40,9 @@ lib icespider : :
<library>icespider-filesessions
<library>adhocutil
<library>Ice
- <library>IceUtil
<library>pthread
<library>slicer
<library>boost_system
- <allow-ice>yes
;
alias gentoobrowse :
@@ -53,12 +50,11 @@ alias gentoobrowse :
:
<slicer>yes
: :
- <variant>release:<cxxflags>-flto=3
- <variant>release:<linkflags>-flto=3
<library>gentoobrowse-api
<library>slicer-json
<library>slicer-xml
<library>icespider
+ <ice-visibility>hidden
<include>.
;
diff --git a/gentoobrowse/src/base.json b/gentoobrowse/src/base.json
index c1164ee..00178d2 100644
--- a/gentoobrowse/src/base.json
+++ b/gentoobrowse/src/base.json
@@ -8,7 +8,7 @@
"void trimCategories(Gentoo::Categories &, const Gentoo::Packages &) const",
"void trimCategories(Gentoo::Categories &, const Gentoo::SearchResultPackages &) const",
"void trimPackages(Gentoo::Packages &, const Gentoo::Ebuilds &) const",
- "template<typename T> void trimCategories(const IceSpider::IHttpRequest *, const IceInternal::Handle<T> & p) const { trimCategories(p->categories, p->packages); }",
+ "template<typename T> void trimCategories(const IceSpider::IHttpRequest *, const std::shared_ptr<T> & p) const { trimCategories(p->categories, p->packages); }",
"void addUser(const IceSpider::IHttpRequest *, const PageBasePtr &) const"
]
}
diff --git a/gentoobrowse/src/packages.cpp b/gentoobrowse/src/packages.cpp
index ce07a11..c6e01fb 100644
--- a/gentoobrowse/src/packages.cpp
+++ b/gentoobrowse/src/packages.cpp
@@ -14,7 +14,11 @@
#include <safeMapFind.h>
namespace GentooBrowse {
- template<typename I, typename T> std::map<I, T> makeMap(const std::vector<T> & items, const boost::function<I(const T &)> & id)
+ const IceSpider::RouteOptions noDefaultSerializersOptions {
+ false // addDefaultSerializers
+ };
+
+ template<typename I, typename T> std::map<I, T> makeMap(const std::vector<T> & items, const std::function<I(const T &)> & id)
{
std::map<I, T> rtn;
for (const auto & item : items) {
@@ -35,37 +39,31 @@ namespace GentooBrowse {
common(core),
prx0(core->getProxy<Gentoo::Portage>()),
prx1(core->getProxy<Gentoo::Users>()),
- _pd_syncs(3),
- _serializer_text_html("xslt/home.xslt"),
- _serializer_application_atom_xml("xslt/home-atom.xslt")
- {
- addRouteSerializer({ "application", "atom+xml" }, &_serializer_application_atom_xml);
- addRouteSerializer({ "text", "html" }, &_serializer_text_html );
- }
-
- ~index()
+ _pd_syncs(3)
{
- removeRouteSerializer({ "application", "atom+xml" });
- removeRouteSerializer({ "text", "html" });
+ addRouteSerializer({ "application", "atom+xml" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/home-atom.xslt"));
+ addRouteSerializer({ "text", "html" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/home.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
- ::GentooBrowse::IndexPtr _responseModel = new ::GentooBrowse::Index();
- auto _ar_categories = prx0->begin_getCategoriesWithRecentAdditions(_pd_syncs, request->getContext());
- auto _ar_ebuilds = prx0->begin_getRecentAdditions(_pd_syncs, request->getContext());
- auto _ar_packages = prx0->begin_getPackagesWithRecentAdditions(_pd_syncs, request->getContext());
+ ::GentooBrowse::IndexPtr _responseModel = std::make_shared<::GentooBrowse::Index>();
+ auto _ar_categories = prx0->getCategoriesWithRecentAdditionsAsync(_pd_syncs, request->getContext());
+ auto _ar_ebuilds = prx0->getRecentAdditionsAsync(_pd_syncs, request->getContext());
+ auto _ar_packages = prx0->getPackagesWithRecentAdditionsAsync(_pd_syncs, request->getContext());
addUser(request, _responseModel);
- Ice::AsyncResultPtr _ar_t;
+ std::future<::Gentoo::PackageIds> _ar_t;
if (_responseModel->user) {
- _ar_t = prx1->begin_tracked(_responseModel->user->userid);
+ _ar_t = prx1->trackedAsync(_responseModel->user->userid);
}
- auto ebuilds = prx0->end_getRecentAdditions(_ar_ebuilds);
- auto packages = GentooBrowse::makeMap<Ice::Int, Gentoo::PackagePtr>(prx0->end_getPackagesWithRecentAdditions(_ar_packages), [](auto p){ return p->packageid; });
- auto categories = GentooBrowse::makeMap<Ice::Int, Gentoo::CategoryPtr>(prx0->end_getCategoriesWithRecentAdditions(_ar_categories), [](auto c){ return c->categoryid; });
- decltype(prx1->end_tracked(_ar_t)) tracked;
- if (_ar_t) {
- tracked = prx1->end_tracked(_ar_t);
+ auto ebuilds = _ar_ebuilds.get();
+ auto packages = GentooBrowse::makeMap<Ice::Int, Gentoo::PackagePtr>(_ar_packages.get(), [](auto p){ return p->packageid; });
+ auto categories = GentooBrowse::makeMap<Ice::Int, Gentoo::CategoryPtr>(_ar_categories.get(), [](auto c){ return c->categoryid; });
+ ::Gentoo::PackageIds tracked;
+ if (_responseModel->user) {
+ tracked = _ar_t.get();
}
for(const auto & ebuild : ebuilds) {
auto & p = packages[ebuild->packageid];
@@ -80,11 +78,9 @@ namespace GentooBrowse {
}
private:
- const Gentoo::PortagePrx prx0;
- const Gentoo::UsersPrx prx1;
+ const Gentoo::PortagePrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
const ::Ice::Int _pd_syncs;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_application_atom_xml;
};
// Route name: category
@@ -96,33 +92,27 @@ namespace GentooBrowse {
IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/packages/{category}"),
common(core),
prx0(core->getProxy<Gentoo::Portage>()),
- _pi_category(1),
- _serializer_text_html("xslt/category.xslt")
- {
- addRouteSerializer({ "text", "html" }, &_serializer_text_html);
- }
-
- ~category()
+ _pi_category(1)
{
- removeRouteSerializer({ "text", "html" });
+ addRouteSerializer({ "text", "html" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/category.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
auto _p_category(request->getURLParam<::std::string>(_pi_category));
auto cat = prx0->findCategory(_p_category, request->getContext());
- auto _ar_pkgs = prx0->begin_getPackagesInCategory(cat->categoryid, request->getContext());
- ::GentooBrowse::CategoryPtr model = new ::GentooBrowse::Category();
+ auto _ar_pkgs = prx0->getPackagesInCategoryAsync(cat->categoryid, request->getContext());
+ ::GentooBrowse::CategoryPtr model = std::make_shared<::GentooBrowse::Category>();
model->category = cat;
- model->packages = prx0->end_getPackagesInCategory(_ar_pkgs);
+ model->packages = _ar_pkgs.get();
addUser(request, model);
request->response(this, model);
}
private:
- const Gentoo::PortagePrx prx0;
+ const Gentoo::PortagePrxPtr prx0;
const ::Ice::Int _pi_category;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
};
// Route name: package
@@ -136,51 +126,46 @@ namespace GentooBrowse {
prx0(core->getProxy<Gentoo::Portage>()),
prx1(core->getProxy<Gentoo::Users>()),
_pi_category(1),
- _pi_package(2),
- _serializer_text_html("xslt/package.xslt")
- {
- addRouteSerializer({ "text", "html" }, &_serializer_text_html);
- }
-
- ~package()
+ _pi_package(2)
{
- removeRouteSerializer({ "text", "html" });
+ addRouteSerializer({ "text", "html" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/package.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
auto _p_category(request->getURLParam<::std::string>(_pi_category));
auto _p_package(request->getURLParam<::std::string>(_pi_package));
- auto _ar_p = prx0->begin_findPackage(_p_category, _p_package, request->getContext());
- auto _ar_r = prx0->begin_getRepositories(request->getContext());
- auto _ar_cats = prx0->begin_getAllCategories(request->getContext());
- ::GentooBrowse::PackagePtr model = new ::GentooBrowse::Package();
- model->package = prx0->end_findPackage(_ar_p);
- Ice::AsyncResultPtr _ar_t;
- auto _ar_cl = prx0->begin_getPackageChangeLog(model->package->packageid, request->getContext());
- auto _ar_ebuilds = prx0->begin_getPackageVersionDetails(model->package->packageid, request->getContext());
- auto _ar_bugs = prx0->begin_getPackageBugs(model->package->packageid, request->getContext());
- auto _ar_d = prx0->begin_getPackageDependencies(model->package->packageid, request->getContext());
- auto _ar_rd = prx0->begin_getPackageRuntimeDependencies(model->package->packageid, request->getContext());
- auto _ar_dp = prx0->begin_getPackagesDepending(model->package->packageid, request->getContext());
- auto _ar_m = prx0->begin_getPackageMasks(model->package->packageid, request->getContext());
- auto _ar_u = prx0->begin_getPackageUses(model->package->packageid, request->getContext());
- auto _ar_urls = prx0->begin_getPackageUrls(model->package->packageid, request->getContext());
+ auto _ar_p = prx0->findPackageAsync(_p_category, _p_package, request->getContext());
+ auto _ar_r = prx0->getRepositoriesAsync(request->getContext());
+ auto _ar_cats = prx0->getAllCategoriesAsync(request->getContext());
+ ::GentooBrowse::PackagePtr model = std::make_shared<::GentooBrowse::Package>();
+ model->package = _ar_p.get();
+ auto _ar_cl = prx0->getPackageChangeLogAsync(model->package->packageid, request->getContext());
+ auto _ar_ebuilds = prx0->getPackageVersionDetailsAsync(model->package->packageid, request->getContext());
+ auto _ar_bugs = prx0->getPackageBugsAsync(model->package->packageid, request->getContext());
+ auto _ar_d = prx0->getPackageDependenciesAsync(model->package->packageid, request->getContext());
+ auto _ar_rd = prx0->getPackageRuntimeDependenciesAsync(model->package->packageid, request->getContext());
+ auto _ar_dp = prx0->getPackagesDependingAsync(model->package->packageid, request->getContext());
+ auto _ar_m = prx0->getPackageMasksAsync(model->package->packageid, request->getContext());
+ auto _ar_u = prx0->getPackageUsesAsync(model->package->packageid, request->getContext());
+ auto _ar_urls = prx0->getPackageUrlsAsync(model->package->packageid, request->getContext());
addUser(request, model);
+ std::future<::Gentoo::PackageIds> _ar_t;
if (model->user) {
- _ar_t = prx1->begin_tracked(model->user->userid);
+ _ar_t = prx1->trackedAsync(model->user->userid);
}
- model->categories = prx0->end_getAllCategories(_ar_cats);
- model->changelog = prx0->end_getPackageChangeLog(_ar_cl);
- model->ebuilds = prx0->end_getPackageVersionDetails(_ar_ebuilds);
- model->bugs = prx0->end_getPackageBugs(_ar_bugs);
- model->dependencies = prx0->end_getPackageDependencies(_ar_d);
- model->rdependencies = prx0->end_getPackageRuntimeDependencies(_ar_rd);
- model->depending = prx0->end_getPackagesDepending(_ar_dp);
- model->masks = prx0->end_getPackageMasks(_ar_m);
- model->uses = prx0->end_getPackageUses(_ar_u);
- model->repos = prx0->end_getRepositories(_ar_r);
- model->urls = prx0->end_getPackageUrls(_ar_urls);
+ model->categories = _ar_cats.get();
+ model->changelog = _ar_cl.get();
+ model->ebuilds = _ar_ebuilds.get();
+ model->bugs = _ar_bugs.get();
+ model->dependencies = _ar_d.get();
+ model->rdependencies = _ar_rd.get();
+ model->depending = _ar_dp.get();
+ model->masks = _ar_m.get();
+ model->uses = _ar_u.get();
+ model->repos = _ar_r.get();
+ model->urls = _ar_urls.get();
std::set<Ice::Int> ids({ model->package->categoryid });
collateCategoryIds(ids, model->dependencies);
collateCategoryIds(ids, model->depending);
@@ -188,8 +173,8 @@ namespace GentooBrowse {
model->categories.erase(std::remove_if(model->categories.begin(), model->categories.end(), [&ids](auto category) {
return ids.find(category->categoryid) == ids.end();
}), model->categories.end());
- if (_ar_t) {
- model->tracked = AdHoc::containerContains(prx1->end_tracked(_ar_t), model->package->packageid);
+ if (model->user) {
+ model->tracked = AdHoc::containerContains(_ar_t.get(), model->package->packageid);
}
request->response(this, model);
}
@@ -202,11 +187,10 @@ namespace GentooBrowse {
return p->categoryid;
});
}
- const Gentoo::PortagePrx prx0;
- const Gentoo::UsersPrx prx1;
+ const Gentoo::PortagePrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
const ::Ice::Int _pi_category;
const ::Ice::Int _pi_package;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
};
@@ -236,8 +220,8 @@ namespace GentooBrowse {
}
private:
- const Gentoo::PortagePrx prx0;
- const Gentoo::UsersPrx prx1;
+ const Gentoo::PortagePrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
const ::Ice::Int _pi_category;
const ::Ice::Int _pi_package;
};
@@ -269,8 +253,8 @@ namespace GentooBrowse {
}
private:
- const Gentoo::PortagePrx prx0;
- const Gentoo::UsersPrx prx1;
+ const Gentoo::PortagePrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
const ::Ice::Int _pi_category;
const ::Ice::Int _pi_package;
};
@@ -282,44 +266,36 @@ namespace GentooBrowse {
public common {
public:
userAtom(const IceSpider::Core * core) :
- IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/atom/{username}"),
+ IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/atom/{username}", noDefaultSerializersOptions),
common(core),
prx0(core->getProxy<Gentoo::Portage>()),
prx1(core->getProxy<Gentoo::Users>()),
- _pi_username(1),
- _serializer_application_atom_xml("xslt/user-atom.xslt")
- {
- addRouteSerializer({ "application", "atom+xml" }, &_serializer_application_atom_xml);
- removeRouteSerializer({ "application", "xml" });
- removeRouteSerializer({ "application", "json" });
- }
-
- ~userAtom()
+ _pi_username(1)
{
- removeRouteSerializer({ "application", "atom+xml" });
+ addRouteSerializer({ "application", "atom+xml" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/user-atom.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
auto _p_username(request->getURLParam<::std::string>(_pi_username));
auto user = prx1->find(_p_username);
- auto _ar_cs = prx0->begin_getAllCategories(request->getContext());
- auto _ar_ps = prx0->begin_getUserTrackedPackages(user->userid, request->getContext());
- auto _ar_vs = prx0->begin_getUserTrackedRecentVersions(user->userid, 50, request->getContext());
- GentooBrowse::UserTrackedPtr ut = new GentooBrowse::UserTracked();
- ut->categories = prx0->end_getAllCategories(_ar_cs);
- ut->packages = prx0->end_getUserTrackedPackages(_ar_ps);
- ut->versions = prx0->end_getUserTrackedRecentVersions(_ar_vs);
+ auto _ar_cs = prx0->getAllCategoriesAsync(request->getContext());
+ auto _ar_ps = prx0->getUserTrackedPackagesAsync(user->userid, request->getContext());
+ auto _ar_vs = prx0->getUserTrackedRecentVersionsAsync(user->userid, 50, request->getContext());
+ GentooBrowse::UserTrackedPtr ut = std::make_shared<GentooBrowse::UserTracked>();
+ ut->categories = _ar_cs.get();
+ ut->packages = _ar_ps.get();
+ ut->versions = _ar_vs.get();
common::trimPackages(ut->packages, ut->versions);
common::trimCategories(ut->categories, ut->packages);
request->response(this, ut);
}
private:
- const Gentoo::PortagePrx prx0;
- const Gentoo::UsersPrx prx1;
+ const Gentoo::PortagePrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
const ::Ice::Int _pi_username;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_application_atom_xml;
};
diff --git a/gentoobrowse/src/search.cpp b/gentoobrowse/src/search.cpp
index 64234ca..e1740f8 100644
--- a/gentoobrowse/src/search.cpp
+++ b/gentoobrowse/src/search.cpp
@@ -26,24 +26,19 @@ namespace GentooBrowse {
public:
sitemap(const IceSpider::Core * core) :
IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/sitemap.xml"),
- prx0(core->getProxy<Gentoo::Portage>()),
- _serializer_text_html("xslt/sitemap.xslt")
+ prx0(core->getProxy<Gentoo::Portage>())
{
- addRouteSerializer({ "application", "xml" }, &_serializer_text_html);
- }
-
- ~sitemap()
- {
- removeRouteSerializer({ "application", "xml" });
+ addRouteSerializer({ "application", "xml" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/sitemap.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
- auto _ar_categories = prx0->begin_getAllOverviewCategories(request->getContext());
- auto _ar_packages = prx0->begin_getAllPackages(request->getContext());
- ::GentooBrowse::SitemapPtr _responseModel = new ::GentooBrowse::Sitemap();
- auto categories = prx0->end_getAllOverviewCategories(_ar_categories);
- auto packages = prx0->end_getAllPackages(_ar_packages);
+ auto _ar_categories = prx0->getAllOverviewCategoriesAsync(request->getContext());
+ auto _ar_packages = prx0->getAllPackagesAsync(request->getContext());
+ ::GentooBrowse::SitemapPtr _responseModel = std::make_shared<::GentooBrowse::Sitemap>();
+ auto categories = _ar_categories.get();
+ auto packages = _ar_packages.get();
for (const auto & super : categories) {
std::transform(super.second.begin(), super.second.end(),
std::inserter(_responseModel->categories, _responseModel->categories.begin()), [&packages](auto c) {
@@ -58,8 +53,7 @@ namespace GentooBrowse {
}
private:
- const Gentoo::PortagePrx prx0;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
+ const Gentoo::PortagePrxPtr prx0;
};
} // namespace GentooBrowse
diff --git a/gentoobrowse/src/user.cpp b/gentoobrowse/src/user.cpp
index e98de2c..cf56b43 100644
--- a/gentoobrowse/src/user.cpp
+++ b/gentoobrowse/src/user.cpp
@@ -13,6 +13,8 @@
#include <icespider-routes-base.h>
namespace GentooBrowse {
+ using namespace std::literals;
+
// Implementation classes.
// Route name: login
@@ -33,13 +35,13 @@ namespace GentooBrowse {
auto s = prx0->createSession();
s->variables[USERID] = boost::lexical_cast<std::string>(user->userid);
prx0->updateSession(s);
- request->setCookie(SESSIONID, s->id, IceUtil::None, "/");
- request->responseRedirect("/user/home", "Authenticated");
+ request->setCookie(SESSIONID, s->id, IceUtil::None, "/"s);
+ request->responseRedirect("/user/home", "Authenticated"s);
}
private:
- const IceSpider::SessionManagerPrx prx0;
- const Gentoo::UsersPrx prx1;
+ const IceSpider::SessionManagerPrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
};
// Route name: signup
@@ -47,20 +49,16 @@ namespace GentooBrowse {
class signup : public IceSpider::IRouteHandler {
public:
signup(const IceSpider::Core *) :
- IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/signup"),
- _serializer_text_html("xslt/user-signup.xslt")
+ IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/signup")
{
- addRouteSerializer({ "text", "html" }, &_serializer_text_html);
+ addRouteSerializer({ "text", "html" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/user-signup.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
- PageBasePtr p = new PageBase();
- request->response(this, p);
+ request->response(this, std::make_shared<PageBase>());
}
-
- private:
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
};
// Route name: signup post
@@ -77,11 +75,11 @@ namespace GentooBrowse {
{
auto signup = *request->getBody<GentooBrowse::SignUpPtr>();
auto user = prx1->create(signup->username, signup->password, signup->realname, signup->email);
- request->responseRedirect("/user/verification", "Pending verification");
+ request->responseRedirect("/user/verification", "Pending verification"s);
}
private:
- const Gentoo::UsersPrx prx1;
+ const Gentoo::UsersPrxPtr prx1;
};
// Route name: verification
@@ -89,20 +87,16 @@ namespace GentooBrowse {
class verification : public IceSpider::IRouteHandler {
public:
verification(const IceSpider::Core *) :
- IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/verification"),
- _serializer_text_html("xslt/user-verification.xslt")
+ IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/verification")
{
- addRouteSerializer({ "text", "html" }, &_serializer_text_html);
+ addRouteSerializer({ "text", "html" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/user-verification.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
- PageBasePtr p = new PageBase();
- request->response(this, p);
+ request->response(this, std::make_shared<PageBase>());
}
-
- private:
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
};
class verificationHandler {
@@ -119,13 +113,13 @@ namespace GentooBrowse {
auto s = prx0->createSession();
s->variables[USERID] = boost::lexical_cast<std::string>(user->userid);
prx0->updateSession(s);
- request->setCookie(SESSIONID, s->id, IceUtil::None, "/");
- request->responseRedirect("/user/home", "Verified, welcome!");
+ request->setCookie(SESSIONID, s->id, IceUtil::None, "/"s);
+ request->responseRedirect("/user/home", "Verified, welcome!"s);
}
private:
- const IceSpider::SessionManagerPrx prx0;
- const Gentoo::UsersPrx prx1;
+ const IceSpider::SessionManagerPrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
};
// Route name: verification post
@@ -188,28 +182,22 @@ namespace GentooBrowse {
IceSpider::IRouteHandler(IceSpider::HttpMethod::GET, "/user/home"),
common(core),
prx0(core->getProxy<IceSpider::SessionManager>()),
- prx1(core->getProxy<Gentoo::Users>()),
- _serializer_text_html("xslt/user-home.xslt")
- {
- addRouteSerializer({ "text", "html" }, &_serializer_text_html );
- }
-
- ~home()
+ prx1(core->getProxy<Gentoo::Users>())
{
- removeRouteSerializer({ "text", "html" });
+ addRouteSerializer({ "text", "html" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/user-home.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
- PageBasePtr p = new PageBase();
+ PageBasePtr p = std::make_shared<PageBase>();
addUser(request, p);
request->response(this, p);
}
private:
- const IceSpider::SessionManagerPrx prx0;
- const Gentoo::UsersPrx prx1;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
+ const IceSpider::SessionManagerPrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
};
// Route name: tracked
@@ -222,33 +210,27 @@ namespace GentooBrowse {
common(core),
prx0(core->getProxy<IceSpider::SessionManager>()),
prx1(core->getProxy<Gentoo::Users>()),
- prx2(core->getProxy<Gentoo::Portage>()),
- _serializer_text_html("xslt/user-tracked.xslt")
- {
- addRouteSerializer({ "text", "html" }, &_serializer_text_html);
- }
-
- ~tracked()
+ prx2(core->getProxy<Gentoo::Portage>())
{
- removeRouteSerializer({ "text", "html" });
+ addRouteSerializer({ "text", "html" },
+ std::make_shared<IceSpider::XsltStreamSerializer::IceSpiderFactory>("xslt/user-tracked.xslt"));
}
void execute(IceSpider::IHttpRequest * request) const
{
- PopularPtr u = new Popular();
- auto _ar_c = prx2->begin_getAllCategories(request->getContext());
+ PopularPtr u = std::make_shared<Popular>();
+ auto _ar_c = prx2->getAllCategoriesAsync(request->getContext());
addUser(request, u);
- auto _ar_p = prx2->begin_getUserTrackedPackages(u->user->userid, request->getContext());
- u->categories = prx2->end_getAllCategories(_ar_c);
- u->packages = prx2->end_getUserTrackedPackages(_ar_p);
+ auto _ar_p = prx2->getUserTrackedPackagesAsync(u->user->userid, request->getContext());
+ u->categories = _ar_c.get();
+ u->packages = _ar_p.get();
request->response(this, u);
}
private:
- const IceSpider::SessionManagerPrx prx0;
- const Gentoo::UsersPrx prx1;
- const Gentoo::PortagePrx prx2;
- IceSpider::XsltStreamSerializer::IceSpiderFactory _serializer_text_html;
+ const IceSpider::SessionManagerPrxPtr prx0;
+ const Gentoo::UsersPrxPtr prx1;
+ const Gentoo::PortagePrxPtr prx2;
};
// Route name: logout
@@ -264,12 +246,12 @@ namespace GentooBrowse {
void execute(IceSpider::IHttpRequest * request) const
{
prx0->destroySession(*request->getCookieParam<std::string>(SESSIONID));
- request->setCookie(SESSIONID, std::string(), IceUtil::None, "/", false, 0);
- request->responseRedirect("/", "Logged out");
+ request->setCookie(SESSIONID, std::string(), IceUtil::None, "/"s, false, 0);
+ request->responseRedirect("/", "Logged out"s);
}
private:
- const IceSpider::SessionManagerPrx prx0;
+ const IceSpider::SessionManagerPrxPtr prx0;
};
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 ;