Split epee/string_tools.h and encapsulate boost::lexical_cast

This commit is contained in:
mj-xmr 2020-11-12 19:14:32 +01:00
parent e45619e61e
commit dc81e23e60
29 changed files with 733 additions and 496 deletions

View file

@ -28,8 +28,6 @@
#ifndef _TINY_INI_H_
#define _TINY_INI_H_
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include "string_tools.h"
namespace epee
@ -37,20 +35,8 @@ namespace epee
namespace tiny_ini
{
inline
bool get_param_value(const std::string& param_name, const std::string& ini_entry, std::string& res)
{
std::string expr_str = std::string() + "^("+ param_name +") *=(.*?)$";
const boost::regex match_ini_entry( expr_str, boost::regex::icase | boost::regex::normal);
boost::smatch result;
if(!boost::regex_search(ini_entry, result, match_ini_entry, boost::match_default))
return false;
res = result[2];
string_tools::trim(res);
return true;
}
inline
std::string get_param_value(const std::string& param_name, const std::string& ini_entry)
bool get_param_value(const std::string& param_name, const std::string& ini_entry, std::string& res);
inline std::string get_param_value(const std::string& param_name, const std::string& ini_entry)
{
std::string buff;
get_param_value(param_name, ini_entry, buff);