diff options
author | Josh Blum <josh@joshknows.com> | 2011-01-06 15:38:56 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-01-06 15:38:56 -0800 |
commit | 771b5cebda250f2a6a65aa7788e9051c94974c2b (patch) | |
tree | 78856934a0786b962d5acafde2eb3338ab5df582 /host/lib/utils | |
parent | 3d02c07470e83edfa118c7ff36e793ffa883ceff (diff) | |
download | uhd-771b5cebda250f2a6a65aa7788e9051c94974c2b.tar.gz uhd-771b5cebda250f2a6a65aa7788e9051c94974c2b.tar.bz2 uhd-771b5cebda250f2a6a65aa7788e9051c94974c2b.zip |
uhd: integrated boost split or tokenizer into source files, remove string split from algorithms header
Diffstat (limited to 'host/lib/utils')
-rw-r--r-- | host/lib/utils/paths.cpp | 8 | ||||
-rw-r--r-- | host/lib/utils/warning.cpp | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index 9e9525caf..f2037a38d 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -17,7 +17,7 @@ #include "constants.hpp" #include <uhd/config.hpp> -#include <uhd/utils/algorithm.hpp> +#include <boost/tokenizer.hpp> #include <boost/program_options.hpp> #include <boost/filesystem.hpp> #include <boost/foreach.hpp> @@ -38,6 +38,10 @@ namespace fs = boost::filesystem; static const std::string env_path_sep = ":"; #endif /*UHD_PLATFORM_WIN32*/ +#define path_tokenizer(inp) \ + boost::tokenizer<boost::char_separator<char> > \ + (inp, boost::char_separator<char>(env_path_sep.c_str())) + /*********************************************************************** * Get a list of paths for an environment variable **********************************************************************/ @@ -60,7 +64,7 @@ static std::vector<fs::path> get_env_paths(const std::string &var_name){ //convert to filesystem path, filter blank paths std::vector<fs::path> paths; - BOOST_FOREACH(const std::string &path_string, std::split_string(var_value, env_path_sep)){ + BOOST_FOREACH(const std::string &path_string, path_tokenizer(var_value)){ if (path_string.empty()) continue; paths.push_back(fs::system_complete(path_string)); } diff --git a/host/lib/utils/warning.cpp b/host/lib/utils/warning.cpp index 05be7ae4d..09a12aba5 100644 --- a/host/lib/utils/warning.cpp +++ b/host/lib/utils/warning.cpp @@ -16,7 +16,7 @@ // #include <uhd/utils/warning.hpp> -#include <uhd/utils/algorithm.hpp> +#include <boost/tokenizer.hpp> #include <uhd/utils/static.hpp> #include <uhd/types/dict.hpp> #include <boost/foreach.hpp> @@ -27,6 +27,10 @@ using namespace uhd; +#define tokenizer(inp, sep) \ + boost::tokenizer<boost::char_separator<char> > \ + (inp, boost::char_separator<char>(sep)) + /*********************************************************************** * Registry implementation **********************************************************************/ @@ -52,7 +56,7 @@ void warning::post(const std::string &msg){ //format the warning message ss << std::endl << "Warning:" << std::endl; - BOOST_FOREACH(const std::string &line, std::split_string(msg, "\n")){ + BOOST_FOREACH(const std::string &line, tokenizer(msg, "\n")){ ss << " " << line << std::endl; } |