summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-02-19 15:54:35 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-02-19 15:54:35 +0000
commitfb49df49cd2a604886f3b4f93cb2855d271a49ee (patch)
treed23b73d304a0f4d46a65f8b244489a30fd71ca7c
parentTidy includes (diff)
downloadicetray-fb49df49cd2a604886f3b4f93cb2855d271a49ee.tar.bz2
icetray-fb49df49cd2a604886f3b4f93cb2855d271a49ee.tar.xz
icetray-fb49df49cd2a604886f3b4f93cb2855d271a49ee.zip
Generate nested namespaces for SQL files
-rw-r--r--icetray/tool/icetraySql.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/icetray/tool/icetraySql.cpp b/icetray/tool/icetraySql.cpp
index 37bec01..ef55711 100644
--- a/icetray/tool/icetraySql.cpp
+++ b/icetray/tool/icetraySql.cpp
@@ -2,6 +2,7 @@
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/constants.hpp>
#include <boost/algorithm/string/detail/classification.hpp>
+#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/detail/basic_pointerbuf.hpp>
@@ -102,9 +103,8 @@ main(int argc, char ** argv)
std::ofstream hout(h);
CPPHeader::write(cppout, sql.filename().string());
- std::for_each(sqlnsparts.begin(), sqlnsparts.end(), [&cppout](const auto & nsp) {
- CPPNS::write(cppout, nsp);
- });
+ const auto fullns {boost::algorithm::join(sqlnsparts, "::")};
+ CPPNS::write(cppout, fullns);
CPPOpen::write(cppout, sql.stem().string());
std::string buf;
std::stringstream map;
@@ -133,13 +133,9 @@ main(int argc, char ** argv)
CPPFooter::write(cppout);
HHeader::write(hout);
- std::for_each(sqlnsparts.begin(), sqlnsparts.end(), [&hout](const auto & nsp) {
- OpenNamespace::write(hout, nsp);
- });
+ OpenNamespace::write(hout, fullns);
HDeclartion::write(hout, sql.stem().string());
- std::for_each(sqlnsparts.begin(), sqlnsparts.end(), [&hout](const auto & nsp) {
- CloseNamespace::write(hout, nsp);
- });
+ CloseNamespace::write(hout, fullns);
HFooter::write(hout);
return 0;