xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
version.h
Go to the documentation of this file.
1
4#pragma once
5#include "icomparable.h"
6#include "ustring.h"
7
9#undef major
10#undef minor
12
14namespace xtd {
93 class version final : public object, public icomparable<version> {
94 public:
103 version() noexcept = default;
126 version(int32_t major, int32_t minor);
139 version(int32_t major, int32_t minor, int32_t build);
156 version(int32_t major, int32_t minor, int32_t build, int32_t revision);
157
159 version(const version&) noexcept = default;
160 version& operator=(const version&) noexcept = default;
161
162 bool operator==(const version& v) const noexcept;
163 bool operator!=(const version& v) const noexcept;
165
169 int32_t build() const noexcept;
170
174 int32_t major() const noexcept;
175
179 int16_t major_revision() const noexcept;
180
184 int32_t minor() const noexcept;
185
189 int16_t minor_revision() const noexcept;
190
194 int32_t revision() const noexcept;
195
211 int32_t compare_to(const object& version) const noexcept override;
227 int32_t compare_to(const version& version) const noexcept override;
228
240 static version parse(const xtd::ustring& input);
241
246 xtd::ustring to_string() const noexcept override;
259 xtd::ustring to_string(size_t field_count) const;
260
269 static bool try_parse(const xtd::ustring& input, version& result) noexcept;
270
271 private:
272 int32_t major_ = 0;
273 int32_t minor_ = 0;
274 int32_t build_ = -1;
275 int32_t revision_ = -1;
276 };
277
279 std::ostream& operator <<(std::ostream& os, const version& ver) noexcept;
281}
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition: icomparable.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition: version.h:93
int16_t minor_revision() const noexcept
Gets the low 16 bits of the revision number.
static bool try_parse(const xtd::ustring &input, version &result) noexcept
Tries to convert the string representation of a version number to an equivalent xtd::version object,...
version() noexcept=default
Initializes a new instance of the xtd::version class.
int32_t compare_to(const object &version) const noexcept override
Compares the current xtd::version object to a specified object and returns an indication of their rel...
int32_t minor() const noexcept
Gets the value of the minor component of the version number for the current xtd::version object.
int32_t major() const noexcept
Gets the value of the major component of the version number for the current xtd::version object.
int32_t build() const noexcept
Gets the value of the build component of the version number for the current xtd::version object.
int16_t major_revision() const noexcept
Gets the high 16 bits of the revision number.
xtd::ustring to_string() const noexcept override
Converts the value of the current xtd::version object to its equivalent xtd::ustring representation.
static version parse(const xtd::ustring &input)
Converts the string representation of a version number to an equivalent Version object.
int32_t revision() const noexcept
Gets the value of the revision component of the version number for the current xtd::version object.
@ v
The V key.
Contains xtd::icomparable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::ustring class.