8 #ifndef SCARAB_PARAM_VALUE_HH_ 9 #define SCARAB_PARAM_VALUE_HH_ 15 #include <boost/variant.hpp> 56 bool strict_is_equal_to(
const param_value& rhs )
const;
57 bool loose_is_equal_to(
const param_value& rhs )
const;
61 virtual bool is_null()
const;
62 virtual bool is_value()
const;
64 virtual bool has_subset(
const param& a_subset )
const;
66 std::string
type()
const;
70 bool is_double()
const;
71 bool is_string()
const;
74 uint64_t as_uint()
const;
75 int64_t as_int()
const;
76 double as_double()
const;
77 std::string as_string()
const;
80 template<
typename XValType >
83 template< typename XValType, typename std::enable_if< std::is_convertible< XValType, param_value >::value, XValType >
::type* =
nullptr >
84 void set( XValType a_value );
94 boost::variant< bool, uint64_t, int64_t, double, std::string >
f_value;
103 template <
typename T,
typename U >
109 template <
typename T >
119 template <
typename T,
typename U >
123 return t_as_string(lhs) == t_as_string(rhs);
126 template <
typename T >
160 template<
typename XValType >
167 return static_cast< XValType
>( a_value );
171 return static_cast< XValType
>( a_value );
175 return static_cast< XValType
>( a_value );
179 return static_cast< XValType
>( a_value );
183 std::stringstream t_conv;
199 template<
typename T >
214 template<
typename T >
229 template<
typename T >
244 template<
typename T >
259 template<
typename T >
276 if( a_value.empty() )
return false;
278 std::string t_str_val;
279 bool t_is_numeric =
true;
280 for( std::string::const_iterator t_val_it = a_value.begin(); t_val_it != a_value.end(); ++t_val_it )
282 t_is_numeric = t_is_numeric && ::isdigit( *t_val_it );
283 t_str_val.push_back( ::tolower( *t_val_it ) );
286 if( t_is_numeric )
return std::stoi( t_str_val );
288 std::istringstream t_iss_val( t_str_val );
290 t_iss_val >> std::boolalpha >> t_bool_val;
293 template<
typename T >
306 return std::stoull( a_value );
308 template<
typename T >
311 return (uint64_t)a_value;
321 return std::stoll( a_value );
323 template<
typename T >
326 return (int64_t)a_value;
336 return std::stod( a_value );
338 template<
typename T >
341 return (
double)a_value;
351 return a_value ?
"true" :
"false";
357 template<
typename T >
372 template<
typename T >
391 template<
typename T >
404 inline bool param_value::as< bool >()
const 410 inline uint64_t param_value::as< uint64_t >()
const 416 inline int64_t param_value::as< int64_t >()
const 422 inline double param_value::as< double >()
const 439 template<
typename XValType >
542 template< typename XValType, typename std::enable_if< std::is_convertible< XValType, param_value >::value, XValType >
::type* >
XValType operator()(const std::string &a_value) const
virtual param_ptr_t clone() const
XValType operator()(bool a_value) const
constexpr bool operator==(const day &x, const day &y) noexcept
std::string operator()(double) const
std::string operator()(uint64_t) const
scarab::path operator()(T) const
XValType operator()(uint64_t a_value) const
std::string operator()(bool a_value) const
bool operator==(const param_value &rhs) const
Strict equality.
std::string operator()(int64_t) const
XValType operator()(int64_t a_value) const
std::string operator()(const std::string &) const
bool operator()(const T &, const U &) const
bool strict_is_equal_to(const param_value &rhs) const
std::string type(const x_type &a_param)
boost::variant< bool, uint64_t, int64_t, double, std::string > f_value
scarab::path param_value::as< scarab::path >() const
uint64_t operator()(T a_value) const
bool operator()(T a_value) const
bool operator()(bool) const
bool operator()(const T &rhs, const U &lhs) const
scarab::path operator()(const std::string &a_value) const
void operator()(T &a_value) const
virtual std::string to_string() const
double operator()(T a_value) const
bool operator()(bool a_value) const
std::string operator()(const std::string &a_value) const
bool operator()(const T &lhs, const T &rhs) const
std::string operator()(T a_value) const
int64_t operator()(T a_value) const
void operator()(std::string &a_value) const
uint64_t operator()(const std::string &a_value) const
bool operator()(const std::string &) const
void operator()(bool &a_value) const
SCARAB_API std::ostream & operator<<(std::ostream &out, const param_array &a_value)
double operator()(const std::string &a_value) const
virtual param_ptr_t move_clone()
std::unique_ptr< param > param_ptr_t
void set(XValType a_value)
bool operator()(const std::string &a_value) const
std::string to_string(std::uint64_t x)
bool operator()(int64_t) const
std::string operator()(bool) const
std::string param_value::as< std::string >() const
XValType operator()(double a_value) const
virtual bool is_null() const
std::string as_string() const
bool loose_is_equal_to(const param_value &rhs) const
int64_t operator()(const std::string &a_value) const
bool operator()(uint64_t) const
bool operator()(const T &lhs, const T &rhs) const
bool operator()(double) const
virtual bool is_value() const