8#include <botan/parsing.h>
9#include <botan/exceptn.h>
15 const char* ws =
" \t\n";
16 auto start = s.find_first_not_of(ws);
17 auto end = s.find_last_not_of(ws);
19 if(start == std::string::npos)
22 if(end == std::string::npos)
23 return s.substr(start, end);
25 return s.substr(start, start + end + 1);
28std::map<std::string, std::string>
read_cfg(std::istream& is)
30 std::map<std::string, std::string> kv;
41 if(s.empty() || s[0] ==
'#')
44 s =
clean_ws(s.substr(0, s.find(
'#')));
49 auto eq = s.find(
"=");
51 if(eq == std::string::npos || eq == 0 || eq == s.size() - 1)
54 const std::string key =
clean_ws(s.substr(0, eq));
55 const std::string val =
clean_ws(s.substr(eq + 1, std::string::npos));
std::string to_string(const BER_Object &obj)
std::map< std::string, std::string > read_cfg(std::istream &is)
std::string clean_ws(const std::string &s)