PLCnext API Documentation 26.0.1.58
Version.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
7#define ARP_INSIDE_ARP_BASE_CORE_ARP_H
8#include "Arp/Base/Core/PimplPtr.hxx"
9#include "Arp/Base/Core/Detail/PrimitiveTypes.hpp"
10#include "Arp/Base/Core/Detail/String.hpp"
11#include <compare>
12
13namespace Arp { namespace Base { namespace Core
14{
15
22class ARP_EXPORT Version
23{
24public: // Impl forward declaration
25 class Impl;
26
27public: // usings
28 using Value = uint32;
29
30public: // construction/destruction/assignment
31 explicit Version(Value major, Value minor = 0, Value patch = 0, Value build = 0);
32 explicit Version(Value major, Value minor, Value patch, const String& preRelease, const String& buildInfo);
33 Version(void);
34 Version(const Version& arg);
35 Version(Version&& arg)noexcept;
37 Version& operator=(Version&& arg)noexcept;
38 ~Version(void);
39
40public: // operators
41 friend ARP_EXPORT bool operator==(const Version& left, const Version& right);
42 friend ARP_EXPORT std::strong_ordering operator<=>(const Version& left, const Version& right);
43
44 friend ARP_EXPORT std::ostream& operator<<(std::ostream& os, const Version& arg);
45 friend ARP_EXPORT std::istream& operator>>(std::istream& is, Version& arg);
46
47public: // static operations
48 static Version Parse(const String& input);
49 static bool TryParse(const String& input, Version& result);
50
51public: // setter/getter operations
52 Value GetMajor(void)const;
53 Value GetMinor(void)const;
54 Value GetPatch(void)const;
55 Value GetBuildNumber(void)const;
56 String GetPreRelease(void)const;
57 String GetBuildInfo(void)const;
58
59public: // operations
60 String ToString(void) const;
61
62public: // deprecated operations
63 ARP_DEPRECATED("Use class ArpVersion instead.")
64 Version(Value major, Value minor, Value patch, Value build, const String& state, const String& name);
65 ARP_DEPRECATED("Use class ArpVersion instead.")
66 const String& GetName(void)const;
67 ARP_DEPRECATED("Use class ArpVersion instead.")
68 const String& GetState(void)const;
69
70public: // internal operations
71 Impl& GetImpl(void);
72 const Impl& GetImpl(void)const;
73
74private: // Impl usings
75 using Pimpl = PimplPtr<Impl, true>;
76
77private: // Impl fields
78 Pimpl pimpl;
79};
80
81ARP_EXPORT std::ostream& operator<<(std::ostream& os, const Version& arg);
82ARP_EXPORT std::istream& operator>>(std::istream& os, Version& arg);
83
84}}} // end of namespace Arp::Base::Core
85
86namespace Arp {
89}
91template<> struct fmt::formatter<Arp::Base::Core::Version> : public fmt::ostream_formatter {};
This class compounds Arp build version and infos.
Definition: ArpVersion.hpp:21
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
Version & operator=(const Version &arg)
Default copy-assignment operator.
Version & operator=(Version &&arg) noexcept
Default move-assignment operator.
~Version(void)
Default destructor.
Version(Version &&arg) noexcept
Default move constructor.
Version(void)
Default constructor.
Version(const Version &arg)
Default copy constructor.
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
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