OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
OnixS::ICE::BOE::System::ConfigurationParser::Utils Namespace Reference

Classes

struct  NumberName

Functions

bool isEquals (const std::string &s1, const std::string &s2)
bool parse (uint64_t &result, const std::string &value)
bool parse (int64_t &result, const std::string &value)
bool parse (double &result, const std::string &value)
bool parse (bool &result, const std::string &value)
template<typename T>
parse (const std::string &value)
template<typename T>
fromString (const std::string &value)
template<>
std::string fromString< std::string > (const std::string &value)
template<>
bool fromString< bool > (const std::string &value)

Function Documentation

◆ fromString()

template<typename T>
T fromString ( const std::string & value)

Definition at line 79 of file ConfigurationParser.h.

80{
81 return parse<T>(value);
82}
bool parse(uint64_t &result, const std::string &value)

◆ fromString< bool >()

template<>
bool fromString< bool > ( const std::string & value)
inline

Definition at line 89 of file ConfigurationParser.h.

90{
91 bool v{};
92
93 if(!parse(v, value))
94 throw std::invalid_argument("Cannot parse bool value: '" + value + "'");
95
96 return v;
97}

◆ fromString< std::string >()

template<>
std::string fromString< std::string > ( const std::string & value)
inline

Definition at line 84 of file ConfigurationParser.h.

85{
86 return value;
87}

◆ isEquals()

bool isEquals ( const std::string & s1,
const std::string & s2 )

◆ parse() [1/5]

bool parse ( bool & result,
const std::string & value )

◆ parse() [2/5]

template<typename T>
T parse ( const std::string & value)

Definition at line 64 of file ConfigurationParser.h.

65{
66 static_assert(std::is_arithmetic<T>::value, "");
67
68 using Wide = typename std::conditional<std::is_floating_point<T>::value, double, typename std::conditional<std::is_signed<T>::value, int64_t, uint64_t>::type>::type;
69
70 Wide v{};
71
72 if(!parse(v, value) || static_cast<Wide>(static_cast<T>(v)) != v)
73 throw std::invalid_argument("Cannot parse " + std::string(NumberName<T>::name()) + " value: '" + value + "'");
74
75 return static_cast<T>(v);
76}

◆ parse() [3/5]

bool parse ( double & result,
const std::string & value )

◆ parse() [4/5]

bool parse ( int64_t & result,
const std::string & value )

◆ parse() [5/5]

bool parse ( uint64_t & result,
const std::string & value )