PLCnext API Documentation 25.0.2.69
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
18class ARP_EXPORT Version
19{
20public: // Impl forward declaration
21 class Impl;
22
23public: // usings
24 using Value = uint32;
25
26public: // construction/destruction/assignment
27 explicit Version(Value major, Value minor = 0, Value patch = 0, Value build = 0);
28 Version(void);
29 Version(const Version& arg);
30 Version(Version&& arg)noexcept;
32 Version& operator=(Version&& arg)noexcept;
33 ~Version(void);
34
35public: // operators
36 friend ARP_EXPORT bool operator==(const Version& left, const Version& right);
37 friend ARP_EXPORT std::strong_ordering operator<=>(const Version& left, const Version& right);
38
39 friend ARP_EXPORT std::ostream& operator<<(std::ostream& os, const Version& arg);
40 friend ARP_EXPORT std::istream& operator>>(std::istream& is, Version& arg);
41
42public: // static operations
43 static Version Parse(const String& input);
44 static bool TryParse(const String& input, Version& result);
45
46public: // setter/getter operations
47 Value GetMajor(void)const;
48 Value GetMinor(void)const;
49 Value GetPatch(void)const;
50 Value GetBuildNumber(void)const;
51
52public: // operations
53 String ToString(void) const;
54
55public: // deprecated operations
56 ARP_DEPRECATED("Use class ArpVersion instead.")
57 Version(Value major, Value minor, Value patch, Value build, const String& state, const String& name);
58 ARP_DEPRECATED("Use class ArpVersion instead.")
59 const String& GetName(void)const;
60 ARP_DEPRECATED("Use class ArpVersion instead.")
61 const String& GetState(void)const;
62
63public: // internal operations
64 Impl& GetImpl(void);
65 const Impl& GetImpl(void)const;
66
67private: // Impl usings
68 using Pimpl = PimplPtr<Impl, true>;
69
70private: // Impl fields
71 Pimpl pimpl;
72};
73
74ARP_EXPORT std::ostream& operator<<(std::ostream& os, const Version& arg);
75ARP_EXPORT std::istream& operator>>(std::istream& os, Version& arg);
76
77}}} // end of namespace Arp::Base::Core
78
79namespace Arp {
82}
84template<> 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:19
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