ADTF  3.18.4
strings_numeric_traits_decl.h
Go to the documentation of this file.
1 
15 #ifndef A_UTIL_UTIL_STRINGS_STRINGS_NUMERIC_TRAITS_DECL_HEADER_INCLUDED
16 #define A_UTIL_UTIL_STRINGS_STRINGS_NUMERIC_TRAITS_DECL_HEADER_INCLUDED
17 
18 #include <string> //std::string
19 #include <cstdint>
20 
21 namespace a_util {
22 namespace strings {
28 bool isBool(const std::string& str);
34 bool isInt8(const std::string& str);
36 bool isInt16(const std::string& str);
38 bool isInt32(const std::string& str);
40 bool isInt64(const std::string& str);
42 bool isUInt8(const std::string& str);
44 bool isUInt16(const std::string& str);
46 bool isUInt32(const std::string& str);
48 bool isUInt64(const std::string& str);
50 bool isFloat(const std::string& str);
52 bool isDouble(const std::string& str);
53 
55 bool isBool(const char* str);
57 bool isInt8(const char* str);
59 bool isInt16(const char* str);
61 bool isInt32(const char* str);
63 bool isInt64(const char* str);
65 bool isUInt8(const char* str);
67 bool isUInt16(const char* str);
69 bool isUInt32(const char* str);
71 bool isUInt64(const char* str);
73 bool isFloat(const char* str);
75 bool isDouble(const char* str);
76 
88  static bool check(const char* from, const bool&);
97  static bool check(const char* from, const std::int8_t&);
99  static bool check(const char* from, const std::int16_t&);
101  static bool check(const char* from, const std::int32_t&);
103  static bool check(const char* from, const std::int64_t&);
105  static bool check(const char* from, const std::uint8_t&);
107  static bool check(const char* from, const std::uint16_t&);
109  static bool check(const char* from, const std::uint32_t&);
111  static bool check(const char* from, const std::uint64_t&);
113  static bool check(const char* from, const float&);
115  static bool check(const char* from, const double&);
116 };
117 
124 template <typename Numeric>
125 bool isNumeric(const std::string& str);
126 
128 template <typename Numeric>
129 bool isNumeric(const char* str);
130 
131 } // namespace strings
132 } // namespace a_util
133 
138 #endif // A_UTIL_UTIL_STRINGS_STRINGS_NUMERIC_TRAITS_DECL_HEADER_INCLUDED
bool isInt64(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isNumeric(const char *str)
Check whether a string is convertible to a value of type Numeric for generic programming.
bool isInt8(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isInt16(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isUInt8(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isBool(const std::string &str)
Check whether a string can be converted to a boolean type.
bool isInt32(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isUInt16(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isDouble(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isUInt64(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isFloat(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
bool isUInt32(const std::string &str)
Check whether a string can be converted to a value of the given numeric type.
Serves as the root component, with common functionality documented in core functionality.
Definition: base.h:24
Private implementation for string numeric trait functions.
Convenience methods to validate string-to-numeric conversion for generic programming.
static bool check(const char *from, const std::uint16_t &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const float &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const std::uint8_t &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const std::int32_t &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const double &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const std::int16_t &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const bool &)
Check whether a conversion of string from to a boolean type is possible.
static bool check(const char *from, const std::uint32_t &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const std::int64_t &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const std::uint64_t &)
Check whether a conversion of string from to the type of the second parameter is possible.
static bool check(const char *from, const std::int8_t &)
Check whether a conversion of string from to the type of the second parameter is possible.