This pure static class converts values of arbitrary Arp type from and to string, respectively.
More...
#include <TryConvert.hpp>
|
| TryConvert (void)=delete |
| Deleted default constructor to make this class pure static.
|
|
|
template<class T > |
static bool | ToString (const T &value, String &result) |
| Converts the supplied value to string. More...
|
|
template<class T > |
static bool | ToValue (const char *input, T &result) |
| Converts the given string to a value. More...
|
|
template<class T > |
static bool | ToValue (const String &input, T &result) |
| Converts the given string to a value. More...
|
|
This pure static class converts values of arbitrary Arp type from and to string, respectively.
All primitive and elementary types, which are defined in Arp root namespace, are supported by this class, as well as all enum types defined in Arp namespace or any sub-namespace.
Furthermore all types providing specialized std::ostream
and std::istream
operators are also supported.
◆ ToString()
template<class T >
bool Arp::Base::Core::TryConvert::ToString |
( |
const T & |
value, |
|
|
String & |
result |
|
) |
| |
|
inlinestatic |
Converts the supplied value to string.
- Template Parameters
-
- Parameters
-
value | The value to convert to string. |
result | The resulting string. |
- Returns
true
on success, otherwise false
.
◆ ToValue() [1/2]
template<class T >
bool Arp::Base::Core::TryConvert::ToValue |
( |
const char * |
input, |
|
|
T & |
result |
|
) |
| |
|
inlinestatic |
Converts the given string to a value.
- Template Parameters
-
T | The desired type of the resulting value. |
- Parameters
-
input | The input string to convert. |
result | The converted value. |
- Returns
true
on success, otherwise false
.
◆ ToValue() [2/2]
template<class T >
bool Arp::Base::Core::TryConvert::ToValue |
( |
const String & |
input, |
|
|
T & |
result |
|
) |
| |
|
inlinestatic |
Converts the given string to a value.
- Template Parameters
-
T | The desired type of the resulting value. |
- Parameters
-
input | The input string to convert. |
result | The converted value. |
- Returns
true
on success, otherwise false
.
The documentation for this class was generated from the following files:
- Arp/Base/Core/TryConvert.hpp
- Arp/Base/Core/Detail/TryConvert.cpp
- Arp/Base/Core/Detail/TryConvert.ipp