diff options
author | lloyd <[email protected]> | 2014-02-13 12:51:15 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-02-13 12:51:15 +0000 |
commit | c548b437e6004328830f8b4f55ac922951ebdf3d (patch) | |
tree | 34c38a02a4a78cc1e4189cb8cdea07d7d9c6b17b /src/lib/utils/read_cfg.cpp | |
parent | f4413f88f535ade0257ef1ea914c2df44cdb51f2 (diff) |
Remove dependency on boost string algos
Diffstat (limited to 'src/lib/utils/read_cfg.cpp')
-rw-r--r-- | src/lib/utils/read_cfg.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/lib/utils/read_cfg.cpp b/src/lib/utils/read_cfg.cpp index ad57a8b3e..31348832a 100644 --- a/src/lib/utils/read_cfg.cpp +++ b/src/lib/utils/read_cfg.cpp @@ -1,12 +1,12 @@ /* * Simple config/test file reader -* (C) 2013 Jack Lloyd +* (C) 2013,2014 Jack Lloyd * * Distributed under the terms of the Botan license */ #include <botan/parsing.h> -#include <boost/algorithm/string.hpp> +#include <ctype.h> namespace Botan { @@ -21,11 +21,18 @@ void lex_cfg(std::istream& is, while(is.good() && s.back() == '\\') { - boost::trim_if(s, boost::is_any_of("\\\n")); + while(s.size() && (s.back() == '\\' || s.back() == '\n')) + s.resize(s.size()-1); + std::string x; std::getline(is, x); - boost::trim_left(x); - s += x; + + size_t i = 0; + + while(i < x.size() && (::isspace(x[i]))) + ++i; + + s += x.substr(i); } auto comment = s.find('#'); @@ -35,10 +42,9 @@ void lex_cfg(std::istream& is, if(s.empty()) continue; - std::vector<std::string> parts; - boost::split(parts, s, boost::is_any_of(" \t\n"), boost::token_compress_on); + auto parts = split_on_pred(s, [](char c) { return ::isspace(c); }); - for(auto p : parts) + for(auto& p : parts) { if(p.empty()) continue; |