PLCnext API Documentation 26.0.1.58
ArpVersion.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/Detail/Version.hpp"
11
12namespace Arp { namespace Base { namespace Core
13{
14
20class ARP_EXPORT ArpVersion
21{
22public: // Impl forward declaration
23 class Impl;
24
25public: // usings
26 using Value = Version::Value;
27
28public: // canonical construction/destruction/assignment
30 ArpVersion(ArpVersion&& arg)noexcept;
34
35public: // construction
37 ArpVersion(Value major, const String& state = "", const String& name = "");
38 ArpVersion(Value major, Value minor, const String& state = "", const String& name = "");
39 ArpVersion(Value major, Value minor, Value patch, const String& state = "", const String& name = "");
40 ArpVersion(Value major, Value minor, Value patch, Value build, const String& state = "", const String& name = "");
41 explicit ArpVersion(const Version& version, const String& state = "", const String& name = "");
42
43public: // operators
44 ARP_EXPORT friend bool operator==(const ArpVersion& left, const ArpVersion& right);
45
46public: // static operations
47 static const ArpVersion& GetCurrent(void);
48 static ArpVersion Parse(const String& input);
49 static bool TryParse(const String& input, ArpVersion& result);
50
51public: // setter/getter operations
52 const String& GetName(void)const;
53 const String& GetState(void)const;
54 const Version& GetBuildVersion(void)const;
55
56public: // operations
57 String ToString(void)const;
58
59public: // deprecated operations
60 ARP_DEPRECATED("Use ArpVersion::GetBuildVersion().GetMajor() instead.")
61 uint8 GetMajor(void)const;
62 ARP_DEPRECATED("Use ArpVersion::GetBuildVersion().GetMinor() instead.")
63 uint8 GetMinor(void)const;
64 ARP_DEPRECATED("Use ArpVersion::GetBuildVersion().GetPatch() instead.")
65 uint8 GetPatch(void)const;
66 ARP_DEPRECATED("Use ArpVersion::GetBuildVersion().GetBuildNumber() instead.")
67 uint32 GetBuild(void)const;
68
69 friend ARP_EXPORT bool operator>(const ArpVersion& left, const ArpVersion& right);
70 friend ARP_EXPORT bool operator<(const ArpVersion& left, const ArpVersion& right);
71 friend ARP_EXPORT bool operator>=(const ArpVersion& left, const ArpVersion& right);
72 friend ARP_EXPORT bool operator<=(const ArpVersion& left, const ArpVersion& right);
73
74public: // internal operations
75 Impl& GetImpl(void);
76 const Impl& GetImpl(void)const;
77
78private: // Impl usings
79 using Pimpl = PimplPtr<Impl, true>;
80
81private: // Impl fields
82 Pimpl pimpl;
83};
84
85ARP_EXPORT std::ostream& operator<<(std::ostream& os, const ArpVersion& arg);
86ARP_EXPORT std::istream& operator>>(std::istream& is, ArpVersion& arg);
87
88
89ARP_DEPRECATED("Use compare operator of ArpVersion::GetBuildVersion() instead.")
90ARP_EXPORT bool operator>(const ArpVersion& left, const ArpVersion& right);
91
92ARP_DEPRECATED("Use compare operator of ArpVersion::GetBuildVersion() instead.")
93ARP_EXPORT bool operator<(const ArpVersion& left, const ArpVersion& right);
94
95ARP_DEPRECATED("Use compare operator of ArpVersion::GetBuildVersion() instead.")
96ARP_EXPORT bool operator>=(const ArpVersion& left, const ArpVersion& right);
97
98ARP_DEPRECATED("Use compare operator of ArpVersion::GetBuildVersion() instead.")
99ARP_EXPORT bool operator<=(const ArpVersion& left, const ArpVersion& right);
100
101
110#define ARP_VERSION_CURRENT ArpVersion(ARP_VERSION_MAJOR, ARP_VERSION_MINOR, ARP_VERSION_PATCH, ARP_VERSION_BUILD, ARP_VERSION_STATE, ARP_VERSION_NAME)
111
118#define ARP_VERSION_BUILT ArpVersion(ARP_VERSION_MAJOR, ARP_VERSION_MINOR, ARP_VERSION_PATCH, ARP_VERSION_BUILD, ARP_VERSION_STATE, ARP_VERSION_NAME)
119
137#define ARP_ABI_VERSION_CURRENT ArpVersion(ARP_ABI_VERSION_MAJOR, ARP_ABI_VERSION_MINOR, ARP_ABI_VERSION_PATCH, "", "ABI");
138
139}}} // end of namespace Arp::Base::Core
140
141namespace Arp {
144}
146template<> struct fmt::formatter<Arp::Base::Core::ArpVersion> : public fmt::ostream_formatter {};
This class compounds Arp build version and infos.
Definition: ArpVersion.hpp:21
ArpVersion(const ArpVersion &arg)
Default copy constructor.
~ArpVersion(void)
Default destructor.
ArpVersion(ArpVersion &&arg) noexcept
Default move constructor.
ArpVersion(void)
Default constructor.
ArpVersion & operator=(ArpVersion &&arg) noexcept
Default move-assignment operator.
ArpVersion & operator=(const ArpVersion &arg)
Default copy-assignment operator.
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
This class provides versioning.
Definition: Version.hpp:23
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
std::uint8_t uint8
The Arp unsigned integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:25
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
Namespace of the C++ standard library