PLCnext API Documentation 25.0.2.69
Public Member Functions | Static Public Member Functions | List of all members
Arp::Base::Core::TryConvert Class Reference

This pure static class converts values of arbitrary Arp type from and to string, respectively. More...

#include <TryConvert.hpp>

Public Member Functions

 TryConvert (void)=delete
 Deleted default constructor to make this class pure static.
 

Static Public Member Functions

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...
 

Detailed Description

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.

Member Function Documentation

◆ ToString()

template<class T >
bool Arp::Base::Core::TryConvert::ToString ( const T &  value,
String result 
)
inlinestatic

Converts the supplied value to string.

Template Parameters
TThe value type.
Parameters
valueThe value to convert to string.
resultThe 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
TThe desired type of the resulting value.
Parameters
inputThe input string to convert.
resultThe 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
TThe desired type of the resulting value.
Parameters
inputThe input string to convert.
resultThe converted value.
Returns
true on success, otherwise false.

The documentation for this class was generated from the following files: