Collection of static methods for conversion from and to string.
More...
#include <iceoryx_hoofs/cxx/convert.hpp>
|
enum class | NumberType { INTEGER
, UNSIGNED_INTEGER
, FLOAT
} |
|
|
template<typename Source > |
static std::enable_if<!std::is_convertible< Source, std::string >::value, std::string >::type | toString (const Source &t) noexcept |
| Converts every type which is either a pod (plain old data) type or is convertable to a string (this means that the operator std::string() is defined)
|
|
template<typename Source > |
static std::enable_if< std::is_convertible< Source, std::string >::value, std::string >::type | toString (const Source &t) noexcept |
| Converts every type which is either a pod (plain old data) type or is convertable to a string (this means that the operator std::string() is defined)
|
|
template<typename Destination > |
static bool | fromString (const char *v, Destination &dest) noexcept |
| Sets dest from a given string. If the conversion fails false is returned and the value of dest is undefined.
|
|
static bool | stringIsNumber (const char *v, const NumberType type) noexcept |
| checks if a given string v is a number
|
|
|
static constexpr int32_t | STRTOULL_BASE = 10 |
|
Collection of static methods for conversion from and to string.
int i;
unsigned int a;
static std::enable_if<!std::is_convertible< Source, std::string >::value, std::string >::type toString(const Source &t) noexcept
Converts every type which is either a pod (plain old data) type or is convertable to a string (this m...
static bool fromString(const char *v, Destination &dest) noexcept
Sets dest from a given string. If the conversion fails false is returned and the value of dest is und...
◆ fromString()
template<typename Destination >
static bool iox::cxx::convert::fromString |
( |
const char * |
v, |
|
|
Destination & |
dest |
|
) |
| |
|
staticnoexcept |
Sets dest from a given string. If the conversion fails false is returned and the value of dest is undefined.
- Parameters
-
[in] | v | string which contains the value of dest |
[in] | dest | destination to which the value should be written |
- Returns
- false = if the conversion fails otherwise true
◆ stringIsNumber()
static bool iox::cxx::convert::stringIsNumber |
( |
const char * |
v, |
|
|
const NumberType |
type |
|
) |
| |
|
staticnoexcept |
checks if a given string v is a number
- Parameters
-
[in] | v | string which contains the number |
[in] | type | is the expected contained type in v |
- Returns
- true if the given string is a number, otherwise false
◆ toString() [1/2]
template<typename Source >
static std::enable_if<!std::is_convertible< Source, std::string >::value, std::string >::type iox::cxx::convert::toString |
( |
const Source & |
t | ) |
|
|
staticnoexcept |
Converts every type which is either a pod (plain old data) type or is convertable to a string (this means that the operator std::string() is defined)
- Parameters
-
| Source | type of the value which should be converted to a string |
[in] | t | value which should be converted to a string |
- Returns
- string representation of t
◆ toString() [2/2]
template<typename Source >
static std::enable_if< std::is_convertible< Source, std::string >::value, std::string >::type iox::cxx::convert::toString |
( |
const Source & |
t | ) |
|
|
staticnoexcept |
Converts every type which is either a pod (plain old data) type or is convertable to a string (this means that the operator std::string() is defined)
- Parameters
-
| Source | type of the value which should be converted to a string |
[in] | t | value which should be converted to a string |
- Returns
- string representation of t
The documentation for this class was generated from the following file: