xentara-workbench-plugin v1.2.1
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::application::Version Class Referencefinal

A version number consisting on a number of components. More...

#include <xentara/workbench/application/Version.hpp>

Public Member Functions

constexpr Version () noexcept=default
 Default constructor that creates an empty version with no components.
 
 Version (std::initializer_list< unsigned int > components)
 Constructor that sets the version components.
 
template<std::input_iterator Iterator, std::sentinel_for< Iterator > Sentinel>
requires std::convertible_to<std::iter_value_t<Iterator>, unsigned int>
 Version (Iterator first, Sentinel last)
 Constructor that sets the version components.
 
template<std::ranges::input_range Range>
requires std::convertible_to<std::ranges::range_value_t<Range>, unsigned int>
 Version (const Range &range)
 Constructor that sets the version components from a range.
 
template<utils::tparam::String kLiteral>
constexpr Version (const LiteralVersionInitializer< kLiteral > &initializer)
 Constructor for creating literal versions from an iterator-sentinel pair.
 
template<typename Char >
auto toBasicString () const -> std::basic_string< Char >
 Converts the version to a string.
 
auto toString () const -> std::string
 Converts the version to an std::string.
 
auto toWString () const -> std::wstring
 Converts the version to an std::wstring.
 
constexpr auto begin () const noexcept -> auto
 Gets an iterator to the begining of the components.
 
constexpr auto end () const noexcept -> auto
 Gets an iterator to the begining of the components.
 
constexpr auto size () const noexcept -> std::size_t
 Gets the number of components.
 
constexpr auto empty () const noexcept -> bool
 Checks whether the version is empty.
 

Static Public Member Functions

template<utils::tools::StringViewable String>
static auto fromString (const String &string) -> utils::eh::expected< Version, std::error_code >
 Creates a new version object from a string.
 

Detailed Description

A version number consisting on a number of components.

Constructor & Destructor Documentation

◆ Version() [1/5]

constexpr xentara::workbench::application::Version::Version ( )
constexprdefaultnoexcept

Default constructor that creates an empty version with no components.

◆ Version() [2/5]

xentara::workbench::application::Version::Version ( std::initializer_list< unsigned int >  components)

Constructor that sets the version components.

◆ Version() [3/5]

template<std::input_iterator Iterator, std::sentinel_for< Iterator > Sentinel>
requires std::convertible_to<std::iter_value_t<Iterator>, unsigned int>
xentara::workbench::application::Version::Version ( Iterator  first,
Sentinel  last 
)

Constructor that sets the version components.

◆ Version() [4/5]

template<std::ranges::input_range Range>
requires std::convertible_to<std::ranges::range_value_t<Range>, unsigned int>
xentara::workbench::application::Version::Version ( const Range &  range)
explicit

Constructor that sets the version components from a range.

◆ Version() [5/5]

template<utils::tparam::String kLiteral>
constexpr xentara::workbench::application::Version::Version ( const LiteralVersionInitializer< kLiteral > &  initializer)
constexpr

Constructor for creating literal versions from an iterator-sentinel pair.

Member Function Documentation

◆ begin()

constexpr auto xentara::workbench::application::Version::begin ( ) const -> auto
constexprnoexcept

Gets an iterator to the begining of the components.

Returns
An iterator to the beginning of the components. The iterator iterates over the components as unsigned int.

◆ empty()

constexpr auto xentara::workbench::application::Version::empty ( ) const -> bool
constexprnoexcept

Checks whether the version is empty.

Returns
Returns true if the version number contains no components, or false if it contains components.

◆ end()

constexpr auto xentara::workbench::application::Version::end ( ) const -> auto
constexprnoexcept

Gets an iterator to the begining of the components.

Returns
An iterator to one past the end of the components. The iterator iterates over the components as unsigned int.

◆ fromString()

template<utils::tools::StringViewable String>
auto xentara::workbench::application::Version::fromString ( const String &  string) -> utils::eh::expected<Version, std::error_code>
static

Creates a new version object from a string.

Parameters
string

The string, containing version components separated by periods (“.”). You can pass an empty string to create an empty version object.

The encoding of the string can be ASCII, or any encoding compatible with ASCII. This includes, but is not limited to, UTF-8, Latin-1, Windows Code Page 1252, and Windows Code Page 850 (OEM).

Returns
The version object, or an error if the string does not contain a valid version.

◆ size()

constexpr auto xentara::workbench::application::Version::size ( ) const -> std::size_t
constexprnoexcept

Gets the number of components.

◆ toBasicString()

template<typename Char >
auto xentara::workbench::application::Version::toBasicString ( ) const -> std::basic_string<Char>

Converts the version to a string.

Returns
The string representation of the version, with the components separated using periods (“.”). If the version is empty, an empty string is returned.

◆ toString()

auto xentara::workbench::application::Version::toString ( ) const -> std::string

Converts the version to an std::string.

Returns
The string representation of the version, with the components separated using periods (“.”). If the version is empty, an empty string is returned.

◆ toWString()

auto xentara::workbench::application::Version::toWString ( ) const -> std::wstring

Converts the version to an std::wstring.

Returns
The string representation of the version, with the components separated using periods (“.”). If the version is empty, an empty string is returned.