PLCnext API Documentation 25.0.2.69
TryConvert.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8namespace Arp::Base::Core
9{
10
18class ARP_EXPORT TryConvert
19{
20public: // construction/destruction
21 TryConvert(void) = delete;
22
23public: // static operations
24 template<class T> static bool ToString(const T& value, String& result);
25 template<class T> static bool ToValue(const char* input, T& result);
26 template<class T> static bool ToValue(const String& input, T& result);
27
28private: // static template methods
29 template<class T, class TInt>
30 static bool ToValueIntegral(const char* input, T& result);
31
32private: // static template and specialized methods
33 template<class T>
34 static bool ToValueInternal(const char* input, T& result);
35 static bool ToValueInternal(const char* input, bool& result);
36 static bool ToValueInternal(const char* input, byte& result);
37 static bool ToValueInternal(const char* input, int8& result);
38 static bool ToValueInternal(const char* input, uint8& result);
39};
40
41} // end of namespace Arp::Base::Core
42
43#include "Arp/Base/Core/Detail/TryConvert.ipp"
44
45namespace Arp {
48}
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
This pure static class converts values of arbitrary Arp type from and to string, respectively.
Definition: TryConvert.hpp:19
TryConvert(void)=delete
Deleted default constructor to make this class pure static.
std::uint8_t uint8
The Arp unsigned integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:25
std::int8_t int8
The Arp integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:27
Root namespace for the PLCnext API