Collection of static methods for conversion from and to string.
More...
#include <convert.hpp>
|
| 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 TargetType > |
| static bb::Optional< TargetType > | from_string (const char *v) noexcept |
| | convert the input based on the 'TargetType', allowing only numeric types as valid destination types
|
| |
Collection of static methods for conversion from and to string.
static bb::Optional< TargetType > from_string(const char *v) noexcept
convert the input based on the 'TargetType', allowing only numeric types as valid destination types
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...
constexpr bool always_false_v
Helper value to bind a static_assert to a type.
- Todo:
- iox-#260 Refactor 'convert' so that one can use 'into' to directly to convert numbers to strings: 'ClassExpectingAString(iox2::bb::into<iox2::bb::StaticString<100>>(42)'
Definition at line 47 of file convert.hpp.
◆ NumberType
| Enumerator |
|---|
| INTEGER | |
| UNSIGNED_INTEGER | |
| FLOAT | |
Definition at line 49 of file convert.hpp.
◆ from_string() [1/2]
convert the input based on the 'TargetType', allowing only numeric types as valid destination types
- Note
- for the 'TargetType' equal to 'std::string,' please include 'iox/std_string_support.hpp'
- Template Parameters
-
| TargetType | the desired target type for converting text |
- Parameters
-
| v | the input string in c type |
- Returns
- an iox2::bb::Optional<TargetType> where, if the return value is iox2::bb::NULLOPT, it indicates a failed conversion process
◆ from_string() [2/2]
◆ toString() [1/2]
| static std::enable_if<!std::is_convertible< Source, std::string >::value, std::string >::type iox2::legacy::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]
| static std::enable_if< std::is_convertible< Source, std::string >::value, std::string >::type iox2::legacy::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
◆ DOUBLE_SIGNALING_NAN_MASK
◆ FLOAT_SIGNALING_NAN_MASK
◆ STRTOL_BASE
◆ STRTOLL_BASE
◆ STRTOUL_BASE
◆ STRTOULL_BASE
The documentation for this class was generated from the following files: