PLCnext API Documentation 25.0.2.69
EnumStrings.hxx
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Core/Enum.hxx"
9#include <map>
10
11namespace Arp
12{
13
19template<class T>
20ARP_DEPRECATED("This implementation is deprecated, use Arp::Enum<T> instead.")
21ARP_CXX_SYMBOL_EXPORT const char* GetEnumString(T value);
22
29template<class T>
30ARP_DEPRECATED("This implementation is deprecated, use Arp::Enum<T> instead.")
31ARP_CXX_SYMBOL_EXPORT bool TryGetEnumValue(const char* name, T& value);
32
33
37template<class T>
38class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
39{
40private: // typedefs, friends
41 friend const char* GetEnumString<>(T key);
42 friend bool TryGetEnumValue<>(const char* name, T& value);
43 friend class Enum<T>;
44 typedef std::map<T, const char*> Dictionary;
45
46public:
51 ARP_DEPRECATED("Use Arp::Enum<T> instead.")
52 static const char* GetEntry(T key)
53 {
54 return GetEnumString<T>(key);
55 }
56
62 ARP_DEPRECATED("Use Arp::Enum<T> instead.")
63 static bool TryGetEntryValue(const char* name, T& value)
64 {
65 return TryGetEnumValue<T>(name, value);
66 }
67
68private:
69 static const Dictionary Values;
70
71private:
72 EnumStrings(void) = delete;
73};
74
76// inline methods of class EnumString<T>
77
78} // end of namespace Arp
Adapter class for enums to make them loggable and parsable from e.g. XML files.
Definition: Enum.hxx:21
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38