From e39fc7760404becd426a97e496325f0d14896e5c Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Fri, 17 Nov 2023 09:30:46 +0000 Subject: [PATCH] Wrap uses of boost::algorithm These changes allow to more easily replace the use of Boost capabilities, by wrapping otherwise scattered and direct uses of boost::join/replace_first/split/starts_with/trim. Re ECFLOW-1922 --- ACore/src/NodePath.cpp | 6 +- ACore/src/PasswdFile.cpp | 4 +- ACore/src/Str.hpp | 29 ++++++++ ACore/src/WhiteListFile.cpp | 4 +- ANattr/src/CronAttr.cpp | 7 +- ANode/parser/src/DefsStructureParser.cpp | 4 +- ANode/src/EcfFile.cpp | 5 +- ANode/src/ExprParser.cpp | 29 ++++---- Base/src/ClientOptionsParser.cpp | 4 +- Base/src/cts/GroupCTSCmd.cpp | 4 +- Base/src/cts/LogCmd.cpp | 7 +- Pyext/src/ExportClient.cpp | 1 - Viewer/ecflowUI/src/EditProvider.cpp | 7 +- Viewer/ecflowUI/src/ExpandState.cpp | 5 +- Viewer/ecflowUI/src/InfoProvider.cpp | 1 - Viewer/ecflowUI/src/LogProvider.cpp | 4 - Viewer/ecflowUI/src/NodeExpression.cpp | 3 - Viewer/ecflowUI/src/OutputDirProvider.cpp | 1 - Viewer/ecflowUI/src/OutputFileProvider.cpp | 5 -- Viewer/ecflowUI/src/ServerHandler.cpp | 1 - Viewer/ecflowUI/src/ServerList.cpp | 5 +- Viewer/ecflowUI/src/Sound.cpp | 6 +- Viewer/ecflowUI/src/VConfig.cpp | 86 +--------------------- Viewer/ecflowUI/src/VDir.cpp | 4 +- Viewer/ecflowUI/src/VNode.cpp | 5 +- Viewer/ecflowUI/src/VProperty.cpp | 5 +- Viewer/ecflowUI/src/VServerSettings.cpp | 1 - Viewer/ecflowUI/src/VSettings.cpp | 4 +- Viewer/ecflowUI/src/VTaskNode.cpp | 2 - Viewer/libViewer/src/DirectoryHandler.cpp | 1 - 30 files changed, 76 insertions(+), 174 deletions(-) diff --git a/ACore/src/NodePath.cpp b/ACore/src/NodePath.cpp index 842ff0ba4..38dfe5f65 100644 --- a/ACore/src/NodePath.cpp +++ b/ACore/src/NodePath.cpp @@ -15,8 +15,6 @@ #include "NodePath.hpp" -#include - #include "Str.hpp" using namespace ecf; @@ -45,8 +43,8 @@ bool NodePath::extractHostPort(const std::string& path, std::string& host, std:: host = thePath[0].substr(0, colonPos); port = thePath[0].substr(colonPos + 1); - boost::algorithm::trim(host); - boost::algorithm::trim(port); + ecf::algorithm::trim(host); + ecf::algorithm::trim(port); if (host.empty()) return false; if (port.empty()) diff --git a/ACore/src/PasswdFile.cpp b/ACore/src/PasswdFile.cpp index cdd5e457a..ea302cd49 100644 --- a/ACore/src/PasswdFile.cpp +++ b/ACore/src/PasswdFile.cpp @@ -17,8 +17,6 @@ #include -#include - #include "Converter.hpp" #include "File.hpp" #include "PasswordEncryption.hpp" @@ -73,7 +71,7 @@ bool PasswdFile::load(const std::string& file, bool debug, std::string& errorMsg theLine.erase(comment_pos); } - boost::algorithm::trim(theLine); // remove leading and trailing spaces + ecf::algorithm::trim(theLine); // remove leading and trailing spaces std::vector lineTokens; Str::split(theLine, lineTokens); if (lineTokens.empty()) diff --git a/ACore/src/Str.hpp b/ACore/src/Str.hpp index 1ffcc3b79..8cbcf55ff 100644 --- a/ACore/src/Str.hpp +++ b/ACore/src/Str.hpp @@ -25,6 +25,35 @@ namespace ecf { +namespace algorithm { + +template +inline static auto join(const Sequence1& strings, const Sequence2& separator) { + return ::boost::algorithm::join(strings, separator); +} + +template +inline static auto replace_first(Sequence& input, const SearchSequence& search, const ReplaceSequence& replace) { + return ::boost::algorithm::replace_first(input, search, replace); +} + +template +inline static ResultSequence& split(ResultSequence& result, const Sequence1& input, const Sequence2& separators) { + return ::boost::algorithm::split(result, input, ::boost::is_any_of(separators)); +} + +template +inline static bool starts_with(const Sequence1& input, const Sequence2& pattern) { + return ::boost::algorithm::starts_with(input, pattern); +} + +template +inline static void trim(Sequence& input) { + ::boost::algorithm::trim(input); +} + +} // namespace algorithm + class Str { public: static int reserve_4() { return 4; } diff --git a/ACore/src/WhiteListFile.cpp b/ACore/src/WhiteListFile.cpp index caf54f937..ce3615b4f 100644 --- a/ACore/src/WhiteListFile.cpp +++ b/ACore/src/WhiteListFile.cpp @@ -18,8 +18,6 @@ #include #include -#include - #include "Converter.hpp" #include "File.hpp" #include "Str.hpp" @@ -257,7 +255,7 @@ bool WhiteListFile::load(const std::string& file, bool debug, std::string& error theLine.erase(comment_pos); } - boost::algorithm::trim(theLine); // remove leading and trailing spaces + ecf::algorithm::trim(theLine); // remove leading and trailing spaces std::vector lineTokens; Str::split(theLine, lineTokens); if (lineTokens.empty()) diff --git a/ANattr/src/CronAttr.cpp b/ANattr/src/CronAttr.cpp index 9cb756259..654c67b80 100644 --- a/ANattr/src/CronAttr.cpp +++ b/ANattr/src/CronAttr.cpp @@ -18,7 +18,6 @@ #include #include -#include #include // requires boost date and time lib #include #include @@ -668,7 +667,7 @@ std::vector extract_month(size_t& index, const std::vector& li for (tokenizer::iterator beg = theTokenizer.begin(); beg != theTokenizer.end(); ++beg) { string theIntToken = *beg; - boost::algorithm::trim(theIntToken); + ecf::algorithm::trim(theIntToken); if (theIntToken.empty()) continue; @@ -704,7 +703,7 @@ void extract_days_of_week(size_t& index, for (tokenizer::iterator beg = theTokenizer.begin(); beg != theTokenizer.end(); ++beg) { string theIntToken = *beg; - boost::algorithm::trim(theIntToken); + ecf::algorithm::trim(theIntToken); if (theIntToken.empty()) continue; @@ -751,7 +750,7 @@ void extract_days_of_month(size_t& index, for (tokenizer::iterator beg = theTokenizer.begin(); beg != theTokenizer.end(); ++beg) { string theIntToken = *beg; - boost::algorithm::trim(theIntToken); + ecf::algorithm::trim(theIntToken); if (theIntToken.empty()) continue; diff --git a/ANode/parser/src/DefsStructureParser.cpp b/ANode/parser/src/DefsStructureParser.cpp index aae6678a7..f5b65d99e 100644 --- a/ANode/parser/src/DefsStructureParser.cpp +++ b/ANode/parser/src/DefsStructureParser.cpp @@ -16,8 +16,6 @@ #include -#include -#include #include #include "Defs.hpp" @@ -270,7 +268,7 @@ bool DefsStructureParser::semiColonInEditVariable() { // edit A fred; edit B bill # valid // edit A 'fred;bill'; edit B 'bill;bill' # Can't cope with this, will be ONE variable !!!! for (auto& i : multi_statements_per_line_vec_) { - boost::algorithm::trim(i); + ecf::algorithm::trim(i); if (i.find("edit") != 0) { return true; } diff --git a/ANode/src/EcfFile.cpp b/ANode/src/EcfFile.cpp index 68954a517..738b28fdf 100644 --- a/ANode/src/EcfFile.cpp +++ b/ANode/src/EcfFile.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include // for waitpid @@ -434,8 +433,8 @@ void EcfFile::extract_used_variables(NameValueMap& used_variables_as_map, continue; string name = script_lines[i].substr(0, equal_pos); string value = script_lines[i].substr(equal_pos + 1); - boost::algorithm::trim(name); - boost::algorithm::trim(value); + ecf::algorithm::trim(name); + ecf::algorithm::trim(value); // std::cout << " extracted as '" << name << "' = '" << value << "'\n"; used_variables_as_map.insert(std::make_pair(name, value)); diff --git a/ANode/src/ExprParser.cpp b/ANode/src/ExprParser.cpp index bb95d586f..8eea95fd4 100644 --- a/ANode/src/ExprParser.cpp +++ b/ANode/src/ExprParser.cpp @@ -30,10 +30,7 @@ #include #include #include -#include -#include -#include #include #include #include @@ -715,7 +712,7 @@ Ast* createAst(const tree_iter_t& i, const std::map& rul if (i->value.id() == ExpressionGrammer::node_name_ID) { string thevalue(i->value.begin(), i->value.end()); - boost::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces LOG_ASSERT(!thevalue.empty(), ""); return new AstNode(thevalue); } @@ -730,8 +727,8 @@ Ast* createAst(const tree_iter_t& i, const std::map& rul string nodePath(theNodePathIter->value.begin(), theNodePathIter->value.end()); string name(theNameIter->value.begin(), theNameIter->value.end()); - boost::algorithm::trim(nodePath); // don't know why we get leading/trailing spaces - boost::algorithm::trim(name); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(nodePath); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(name); // don't know why we get leading/trailing spaces return new AstVariable(nodePath, name); } else if (i->value.id() == ExpressionGrammer::parent_variable_ID) { @@ -740,35 +737,35 @@ Ast* createAst(const tree_iter_t& i, const std::map& rul auto the_variable_t = i->children.begin() + 1; string the_variable(the_variable_t->value.begin(), the_variable_t->value.end()); - boost::algorithm::trim(the_variable); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(the_variable); // don't know why we get leading/trailing spaces LOG_ASSERT(!the_variable.empty(), ""); return new AstParentVariable(the_variable); } else if (i->value.id() == ExpressionGrammer::dot_dot_path_ID) { string thevalue(i->value.begin(), i->value.end()); - boost::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces LOG_ASSERT(!thevalue.empty(), ""); return new AstNode(thevalue); } if (i->value.id() == ExpressionGrammer::absolute_path_ID) { string thevalue(i->value.begin(), i->value.end()); - boost::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces LOG_ASSERT(!thevalue.empty(), ""); return new AstNode(thevalue); } else if (i->value.id() == ExpressionGrammer::dot_path_ID) { string thevalue(i->value.begin(), i->value.end()); - boost::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces LOG_ASSERT(!thevalue.empty(), ""); return new AstNode(thevalue); } else if (i->value.id() == ExpressionGrammer::event_state_ID) { string thevalue(i->value.begin(), i->value.end()); - boost::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces if (thevalue == Event::SET()) return new AstEventState(true); assert(thevalue == Event::CLEAR()); @@ -777,7 +774,7 @@ Ast* createAst(const tree_iter_t& i, const std::map& rul else if (i->value.id() == ExpressionGrammer::integer_ID) { string thevalue(i->value.begin(), i->value.end()); - boost::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(thevalue); // don't know why we get leading/trailing spaces auto theInt = ecf::convert_to(thevalue); return new AstInteger(theInt); } @@ -821,8 +818,8 @@ Ast* createAst(const tree_iter_t& i, const std::map& rul string nodePath(theNodePathIter->value.begin(), theNodePathIter->value.end()); string flag(theFlagIter->value.begin(), theFlagIter->value.end()); - boost::algorithm::trim(nodePath); // don't know why we get leading/trailing spaces - boost::algorithm::trim(flag); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(nodePath); // don't know why we get leading/trailing spaces + ecf::algorithm::trim(flag); // don't know why we get leading/trailing spaces return new AstFlag(nodePath, ecf::Flag::string_to_flag_type(flag)); } @@ -1135,8 +1132,8 @@ bool SimpleExprParser::doParse() { if (tokens.size() == 2) { - boost::algorithm::trim(tokens[0]); - boost::algorithm::trim(tokens[1]); + ecf::algorithm::trim(tokens[0]); + ecf::algorithm::trim(tokens[1]); if (tokens[0].find(' ') != string::npos) { // cout << "Found space " << expr_ << "\n"; diff --git a/Base/src/ClientOptionsParser.cpp b/Base/src/ClientOptionsParser.cpp index 8bdbf2374..cb8e76c2a 100644 --- a/Base/src/ClientOptionsParser.cpp +++ b/Base/src/ClientOptionsParser.cpp @@ -10,7 +10,7 @@ #include "ClientOptionsParser.hpp" -#include +#include "Str.hpp" namespace ecf { @@ -36,7 +36,7 @@ ClientOptionsParser::option_set_t ClientOptionsParser::operator()(ClientOptionsP // 1) --alter arg1 arg2 arg3 (arg4) path [path [path [...]]] // 2) --alter=arg1 arg2 arg3 (arg4) path [path [path [...]]] - if (boost::algorithm::starts_with(args[0], "--alter")) { + if (ecf::algorithm::starts_with(args[0], "--alter")) { option_t alter{std::string{"alter"}, {}}; diff --git a/Base/src/cts/GroupCTSCmd.cpp b/Base/src/cts/GroupCTSCmd.cpp index 4b97b463f..1735d4e3e 100644 --- a/Base/src/cts/GroupCTSCmd.cpp +++ b/Base/src/cts/GroupCTSCmd.cpp @@ -17,8 +17,6 @@ #include #include -#include - #include "AbstractClientEnv.hpp" #include "AbstractServer.hpp" #include "ClientOptionsParser.hpp" @@ -60,7 +58,7 @@ GroupCTSCmd::GroupCTSCmd(const std::string& cmdSeries, AbstractClientEnv* client for (auto aCmd : individualCmdVec) { // massage the commands so that, we add -- at the start of each command. // This is required by the boost program options. - boost::algorithm::trim(aCmd); + ecf::algorithm::trim(aCmd); subCmd.clear(); if (aCmd.find("--") == std::string::npos) diff --git a/Base/src/cts/LogCmd.cpp b/Base/src/cts/LogCmd.cpp index 6fc7e6e71..e66e8d811 100644 --- a/Base/src/cts/LogCmd.cpp +++ b/Base/src/cts/LogCmd.cpp @@ -15,8 +15,6 @@ #include -#include - #include "AbstractClientEnv.hpp" #include "AbstractServer.hpp" #include "ClientToServerCmd.hpp" @@ -28,7 +26,6 @@ using namespace ecf; using namespace std; -using namespace boost; namespace po = boost::program_options; LogCmd::LogCmd(LogApi a, int get_last_n_lines) : api_(a), get_last_n_lines_(get_last_n_lines) { @@ -48,7 +45,7 @@ LogCmd::LogCmd(const std::string& path) // ECFLOW-174, Never get the full log, as this can make server consume to much memory // default taken from get_last_n_lines_default // ECFLOW-377, should remove leading/trailing spaces from path - boost::algorithm::trim(new_path_); + ecf::algorithm::trim(new_path_); } void LogCmd::print(std::string& os) const { @@ -159,7 +156,7 @@ STC_Cmd_ptr LogCmd::doHandleRequest(AbstractServer* as) const { std::string log_file_name = as->defs()->server().find_variable(Str::ECF_LOG()); // ECFLOW-377 should remove leading/trailing spaces from path - boost::algorithm::trim(log_file_name); + ecf::algorithm::trim(log_file_name); Log::instance()->new_path(log_file_name); // will throw for errors } diff --git a/Pyext/src/ExportClient.cpp b/Pyext/src/ExportClient.cpp index 4201ff60f..ac23ddc1a 100644 --- a/Pyext/src/ExportClient.cpp +++ b/Pyext/src/ExportClient.cpp @@ -15,7 +15,6 @@ #include // for std::transform -#include #include #include diff --git a/Viewer/ecflowUI/src/EditProvider.cpp b/Viewer/ecflowUI/src/EditProvider.cpp index f38035aa4..9ecb01e5f 100644 --- a/Viewer/ecflowUI/src/EditProvider.cpp +++ b/Viewer/ecflowUI/src/EditProvider.cpp @@ -9,10 +9,9 @@ #include "EditProvider.hpp" -#include - #include "NodeFwd.hpp" #include "ServerHandler.hpp" +#include "Str.hpp" #include "UiLog.hpp" #include "VNode.hpp" #include "VReply.hpp" @@ -85,8 +84,8 @@ void EditProvider::submit(const std::vector& txt, bool alias) { if (pos != std::string::npos && pos + 1 != it.size()) { std::string name = it.substr(0, pos); std::string val = it.substr(pos + 1); - boost::trim(name); - boost::trim(val); + ecf::algorithm::trim(name); + ecf::algorithm::trim(val); vars.push_back(std::make_pair(name, val)); } } diff --git a/Viewer/ecflowUI/src/ExpandState.cpp b/Viewer/ecflowUI/src/ExpandState.cpp index 62e878ff5..deb1db73f 100644 --- a/Viewer/ecflowUI/src/ExpandState.cpp +++ b/Viewer/ecflowUI/src/ExpandState.cpp @@ -9,11 +9,10 @@ #include "ExpandState.hpp" -#include - #include "AbstractNodeView.hpp" #include "ExpandStateNode.hpp" #include "ServerHandler.hpp" +#include "Str.hpp" #include "TreeNodeModel.hpp" #include "UIDebug.hpp" #include "UiLog.hpp" @@ -288,7 +287,7 @@ ExpandStateNode* ExpandState::find(const std::string& fullPath) { return root_; std::vector pathVec; - boost::split(pathVec, fullPath, boost::is_any_of("/")); + ecf::algorithm::split(pathVec, fullPath, "/"); if (pathVec.size() > 0 && pathVec[0].empty()) { pathVec.erase(pathVec.begin()); diff --git a/Viewer/ecflowUI/src/InfoProvider.cpp b/Viewer/ecflowUI/src/InfoProvider.cpp index d68cd05a9..1cf2d98be 100644 --- a/Viewer/ecflowUI/src/InfoProvider.cpp +++ b/Viewer/ecflowUI/src/InfoProvider.cpp @@ -13,7 +13,6 @@ #include #include -#include #include "EcfFile.hpp" #include "ServerHandler.hpp" diff --git a/Viewer/ecflowUI/src/LogProvider.cpp b/Viewer/ecflowUI/src/LogProvider.cpp index 95a2ea060..12f46c3c9 100644 --- a/Viewer/ecflowUI/src/LogProvider.cpp +++ b/Viewer/ecflowUI/src/LogProvider.cpp @@ -12,10 +12,6 @@ #include -#include -#include -#include - #include "File.hpp" #include "FileWatcher.hpp" #include "ServerHandler.hpp" diff --git a/Viewer/ecflowUI/src/NodeExpression.cpp b/Viewer/ecflowUI/src/NodeExpression.cpp index a116195a2..dbbb8ea8e 100644 --- a/Viewer/ecflowUI/src/NodeExpression.cpp +++ b/Viewer/ecflowUI/src/NodeExpression.cpp @@ -16,7 +16,6 @@ #endif #include #include -#include #include "MenuHandler.hpp" #include "Node.hpp" @@ -199,8 +198,6 @@ BaseNodeCondition* NodeExpressionParser::parseWholeExpression(const std::string& ecf::Str::replace_all(expr, std::string("("), std::string(" ( ")); ecf::Str::replace_all(expr, std::string(")"), std::string(" ) ")); - // boost::algorithm::to_lower(expr); // convert to lowercase - int index = 0; int length = expr.length(); std::string token = ""; diff --git a/Viewer/ecflowUI/src/OutputDirProvider.cpp b/Viewer/ecflowUI/src/OutputDirProvider.cpp index 8be3d20d2..c3d12a63b 100644 --- a/Viewer/ecflowUI/src/OutputDirProvider.cpp +++ b/Viewer/ecflowUI/src/OutputDirProvider.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/Viewer/ecflowUI/src/OutputFileProvider.cpp b/Viewer/ecflowUI/src/OutputFileProvider.cpp index 991772b34..8c81f99e9 100644 --- a/Viewer/ecflowUI/src/OutputFileProvider.cpp +++ b/Viewer/ecflowUI/src/OutputFileProvider.cpp @@ -11,11 +11,6 @@ #include -#include -#include -#include -#include - #include "OutputCache.hpp" #include "OutputFileClient.hpp" #include "ServerHandler.hpp" diff --git a/Viewer/ecflowUI/src/ServerHandler.cpp b/Viewer/ecflowUI/src/ServerHandler.cpp index 3cd1b8360..61f9d5698 100644 --- a/Viewer/ecflowUI/src/ServerHandler.cpp +++ b/Viewer/ecflowUI/src/ServerHandler.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include "ChangeNotify.hpp" diff --git a/Viewer/ecflowUI/src/ServerList.cpp b/Viewer/ecflowUI/src/ServerList.cpp index 7361f8874..aa5d4311b 100644 --- a/Viewer/ecflowUI/src/ServerList.cpp +++ b/Viewer/ecflowUI/src/ServerList.cpp @@ -17,9 +17,6 @@ #include #include -#include -#include -#include #include "Converter.hpp" #include "DirectoryHandler.hpp" @@ -540,7 +537,7 @@ bool ServerList::load() { } std::vector sv; - boost::split(sv, line, boost::is_any_of(",")); + ecf::algorithm::split(sv, line, ","); bool favourite = false; if (sv.size() >= 4) diff --git a/Viewer/ecflowUI/src/Sound.cpp b/Viewer/ecflowUI/src/Sound.cpp index 3ddfc7217..0de3a3d48 100644 --- a/Viewer/ecflowUI/src/Sound.cpp +++ b/Viewer/ecflowUI/src/Sound.cpp @@ -26,7 +26,7 @@ #include -#include +#include "Str.hpp" Sound* Sound::instance_ = nullptr; @@ -79,8 +79,8 @@ void Sound::play(const std::string& fName, int loopCount) { if (currentCmd_.empty()) {} else { std::string cmd = currentCmd_; - boost::replace_first(cmd, "%FILE%", fName); - boost::replace_first(cmd, "%REPEAT%", ecf::convert_to(loopCount - 1)); + ecf::algorithm::replace_first(cmd, "%FILE%", fName); + ecf::algorithm::replace_first(cmd, "%REPEAT%", ecf::convert_to(loopCount - 1)); if (system(cmd.c_str())) { UiLog().dbg() << "Sound::play() could not play sound alert. Command: " << cmd; } diff --git a/Viewer/ecflowUI/src/VConfig.cpp b/Viewer/ecflowUI/src/VConfig.cpp index 088c3d71c..691ad6c3a 100644 --- a/Viewer/ecflowUI/src/VConfig.cpp +++ b/Viewer/ecflowUI/src/VConfig.cpp @@ -10,14 +10,13 @@ #include "VConfig.hpp" -#include -#include #include #include #include #include "DirectoryHandler.hpp" #include "SessionHandler.hpp" +#include "Str.hpp" #include "UiLog.hpp" #include "UserMessage.hpp" #include "VConfigLoader.hpp" @@ -403,7 +402,7 @@ bool VConfig::readRcFile(const std::string& rcFile, boost::property_tree::ptree& if (vec.size() >= 1) { std::vector par; - boost::split(par, vec[0], boost::is_any_of(":")); + ecf::algorithm::split(par, vec[0], ":"); if (par.size() == 2) { // Update @@ -489,84 +488,3 @@ bool VConfig::readRcFile(const std::string& rcFile, boost::property_tree::ptree& return hasValue; } -/* -void VConfig::decodeShowMask() -{ - -option show::status32_ (globals::instance(), "show_mask32", 0); - -option show::status_ (globals::instance(), "show_mask", - (1< 31) { - status32_ = int(status32_) | (1<<(flag_-32)); - } else { - status_ = int(status_ ) | (1<<(flag_)); - } -} - -void show::off() -{ - if (flag_ == show::all) { - status_ = 0xFFFF ; status32_ = 0xFFFF; - status32_ = (int) (status32_) & (~(1<<(show::none-32))); - status32_ = (int) (status32_) & (~(1<<(show::all -32))); - } else if (flag_ == show::none) { - status_ = 0; status32_ = 0; - } else if (flag_ > 31) { - status32_ = int(status32_) & (~(1<<(flag_-32))); - } else { - status_ = int(status_) & (~(1< 31) { - return (int(status32_) & (1<<(flag_-32))) != 0; - } else { - return (int(status_ ) & (1< -#include #include #include #include #include "DirectoryHandler.hpp" +#include "Str.hpp" VDir::VDir(const std::string& path) : path_(path), fetchMode_(NoFetchMode) { } @@ -69,7 +69,7 @@ void VDir::reload() { boost::filesystem::directory_iterator it(path), eod; BOOST_FOREACH (boost::filesystem::path const& p, std::make_pair(it, eod)) { - if (is_regular_file(p) && boost::algorithm::starts_with(p.filename().string(), pattern_)) { + if (is_regular_file(p) && ecf::algorithm::starts_with(p.filename().string(), pattern_)) { auto* item = new VDirItem; item->name_ = p.filename().string(); diff --git a/Viewer/ecflowUI/src/VNode.cpp b/Viewer/ecflowUI/src/VNode.cpp index 9ab223dbc..d89916b36 100644 --- a/Viewer/ecflowUI/src/VNode.cpp +++ b/Viewer/ecflowUI/src/VNode.cpp @@ -10,8 +10,6 @@ #include "VNode.hpp" -#include - #include "AstCollateVNodesVisitor.hpp" #include "ConnectState.hpp" #include "Converter.hpp" @@ -19,6 +17,7 @@ #include "Limit.hpp" #include "ServerDefsAccess.hpp" #include "ServerHandler.hpp" +#include "Str.hpp" #include "Suite.hpp" #include "TriggerCollector.hpp" #include "TriggeredScanner.hpp" @@ -1234,7 +1233,7 @@ VNode* VServer::find(const std::string& fullPath) { return this; std::vector pathVec; - boost::split(pathVec, fullPath, boost::is_any_of("/")); + ecf::algorithm::split(pathVec, fullPath, "/"); if (pathVec.size() > 0 && pathVec.at(0).empty()) { pathVec.erase(pathVec.begin()); diff --git a/Viewer/ecflowUI/src/VProperty.cpp b/Viewer/ecflowUI/src/VProperty.cpp index 97978f01f..fe1f0bba3 100644 --- a/Viewer/ecflowUI/src/VProperty.cpp +++ b/Viewer/ecflowUI/src/VProperty.cpp @@ -17,9 +17,8 @@ #include #endif -#include - #include "Sound.hpp" +#include "Str.hpp" #include "UserMessage.hpp" #include "ViewerUtil.hpp" @@ -331,7 +330,7 @@ VProperty* VProperty::find(const std::string& fullPath) { return this; std::vector pathVec; - boost::split(pathVec, fullPath, boost::is_any_of(".")); + ecf::algorithm::split(pathVec, fullPath, "."); if (pathVec.size() > 0) { if (pathVec.at(0) != strName_) diff --git a/Viewer/ecflowUI/src/VServerSettings.cpp b/Viewer/ecflowUI/src/VServerSettings.cpp index a789db2d6..4761d1534 100644 --- a/Viewer/ecflowUI/src/VServerSettings.cpp +++ b/Viewer/ecflowUI/src/VServerSettings.cpp @@ -11,7 +11,6 @@ #include -#include #include #include diff --git a/Viewer/ecflowUI/src/VSettings.cpp b/Viewer/ecflowUI/src/VSettings.cpp index 06b9a65a1..ffafeb868 100644 --- a/Viewer/ecflowUI/src/VSettings.cpp +++ b/Viewer/ecflowUI/src/VSettings.cpp @@ -12,12 +12,12 @@ #include -#include #include #include #include #include "DirectoryHandler.hpp" +#include "Str.hpp" #include "UiLog.hpp" #include "UserMessage.hpp" @@ -48,7 +48,7 @@ std::string VSettingsPath::path(const std::string& key) const { } std::string VSettingsPath::join(const std::string& sep) const { - return boost::algorithm::join(path_, sep); + return ecf::algorithm::join(path_, sep); } //====================================================== diff --git a/Viewer/ecflowUI/src/VTaskNode.cpp b/Viewer/ecflowUI/src/VTaskNode.cpp index 1b1a08211..3d4955786 100644 --- a/Viewer/ecflowUI/src/VTaskNode.cpp +++ b/Viewer/ecflowUI/src/VTaskNode.cpp @@ -10,8 +10,6 @@ #include "VTaskNode.hpp" -#include - #include "ChangeNotify.hpp" #include "ServerDefsAccess.hpp" #include "ServerHandler.hpp" diff --git a/Viewer/libViewer/src/DirectoryHandler.cpp b/Viewer/libViewer/src/DirectoryHandler.cpp index 5f25654cc..839d0b861 100644 --- a/Viewer/libViewer/src/DirectoryHandler.cpp +++ b/Viewer/libViewer/src/DirectoryHandler.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include #include