From aa308e127902572f324f6eca7030b0eeb442e915 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 3 Jan 2016 21:32:20 +0000 Subject: Use icetray tools for SQL embedding --- gentoobrowse-api/service/Jamfile.jam | 24 +---------- gentoobrowse-api/service/embed.cpp.m4 | 12 ------ gentoobrowse-api/service/embed.h.m4 | 12 ------ gentoobrowse-api/service/portageimpl.cpp | 68 ++++++++++++++++---------------- 4 files changed, 36 insertions(+), 80 deletions(-) delete mode 100644 gentoobrowse-api/service/embed.cpp.m4 delete mode 100644 gentoobrowse-api/service/embed.h.m4 diff --git a/gentoobrowse-api/service/Jamfile.jam b/gentoobrowse-api/service/Jamfile.jam index 946da69..5bad606 100644 --- a/gentoobrowse-api/service/Jamfile.jam +++ b/gentoobrowse-api/service/Jamfile.jam @@ -1,6 +1,5 @@ -import generators ; -import type ; import lex ; +import icetray ; lib icetray : : : : /usr/include/icetray ; @@ -23,6 +22,7 @@ lib gentoobrowse-service : ..//boost_thread ..//boost_date_time ../..//glibmm + Gentoo::Service . : : . @@ -30,23 +30,3 @@ lib gentoobrowse-service : ../api//gentoobrowse-api ; -path-constant root : . ; -type.register SQL : sql ; -type.register HEX : hex ; -generators.register-standard sql.embed.hex : SQL : HEX ; -generators.register-standard sql.embed : HEX : CPP H ; - -actions sql.embed -{ - m4 -DNAME="$(2[1]:B)" "$(root)/embed.h.m4" > "$(1[2])" - m4 -DNAME="$(2[1]:B)" "$(root)/embed.cpp.m4" > "$(1[1])" -} - -actions sql.embed.hex -{ - xxd -i "$(2)" - | grep , > "$(1[1])" -} - -IMPORT $(__name__) : sql.embed : : sql.embed ; -IMPORT $(__name__) : sql.embed.hex : : sql.embed.hex ; - diff --git a/gentoobrowse-api/service/embed.cpp.m4 b/gentoobrowse-api/service/embed.cpp.m4 deleted file mode 100644 index 43901dd..0000000 --- a/gentoobrowse-api/service/embed.cpp.m4 +++ /dev/null @@ -1,12 +0,0 @@ -define(`name', NAME) -define(`incl', `#include "'NAME`.h"') -define(`inclhex', `#include "'NAME`.hex"') -incl - -namespace sql { - const std::string name::sql({ - inclhex - , 0x00}); - const std::size_t name::hash(std::hash()(sql)); -} - diff --git a/gentoobrowse-api/service/embed.h.m4 b/gentoobrowse-api/service/embed.h.m4 deleted file mode 100644 index a08a1c5..0000000 --- a/gentoobrowse-api/service/embed.h.m4 +++ /dev/null @@ -1,12 +0,0 @@ -define(`name', NAME) -#include -#include - -namespace sql { - class name { - public: - static const std::string sql; - static const std::size_t hash; - }; -} - diff --git a/gentoobrowse-api/service/portageimpl.cpp b/gentoobrowse-api/service/portageimpl.cpp index a3f499e..99af5f8 100644 --- a/gentoobrowse-api/service/portageimpl.cpp +++ b/gentoobrowse-api/service/portageimpl.cpp @@ -1,21 +1,21 @@ #include "portageimpl.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace Gentoo { namespace Service { @@ -27,103 +27,103 @@ Portage::Portage(boost::shared_ptr> d) : Gentoo::CategoryPtr Portage::getCategory(Ice::Int id, const Ice::Current &) { - return fetch(id); + return fetch(id); } Gentoo::Categories Portage::getAllCategories(const Ice::Current &) { - return fetch(); + return fetch(); } Gentoo::Categories Portage::getCategoriesInSuper(const std::string & super, const Ice::Current &) { - return fetch(super); + return fetch(super); } Gentoo::OverviewCategories Portage::getOverviewCategoriesInSuper(const std::string & super, const Ice::Current &) { - return fetch(super); + return fetch(super); } Gentoo::PackagePtr Portage::getPackage(Ice::Int id, const Ice::Current &) { - return fetch(id); + return fetch(id); } IceUtil::Optional Portage::findPackage(const std::string & cat, const std::string & pkg, const Ice::Current &) { - return fetch, sql::findPackage>(cat, pkg); + return fetch, sql::portage::findPackage>(cat, pkg); } Gentoo::Packages Portage::getPackagesInCategory(Ice::Int id, const Ice::Current &) { - return fetch(id); + return fetch(id); } Gentoo::SearchResultPackages Portage::getPackagesSearch(const std::string & query, const Ice::Current &) { - return fetch(query, query); + return fetch(query, query); } Gentoo::Ebuilds Portage::getPackageVersions(Ice::Int id, const Ice::Current &) { - return fetch(id); + return fetch(id); } Gentoo::ChangeLog Portage::getPackageChangeLog(Ice::Int id, const Ice::Current &) { - return fetch(id); + return fetch(id); } Gentoo::Ebuilds Portage::getRecentAdditions(Ice::Int syncs, const Ice::Current &) { - return fetch(syncs); + return fetch(syncs); } Gentoo::BugPtr Portage::getBug(Ice::Int id, const Ice::Current &) { - return fetch(id); + return fetch(id); } Gentoo::Bugs Portage::getPackageBugs(Ice::Int packageId, const Ice::Current &) { - return fetch(packageId); + return fetch(packageId); } Gentoo::SearchResultBugs Portage::getBugsSearch(const std::string & query, const Ice::Current &) { - return fetch(query, query); + return fetch(query, query); } Gentoo::NewsItemPtr Portage::getNewsItem(const std::string & id, const Ice::Current &) { - return fetch(id); + return fetch(id); } Gentoo::News Portage::getNewsSearch(const std::string & query, const Ice::Current &) { - return fetch(query); + return fetch(query); } Gentoo::News Portage::getNewsRecent(Ice::Int items, const Ice::Current &) { - return fetch(items); + return fetch(items); } } } -- cgit v1.2.3