omni::extras::SemanticVersion

Defined in omni/extras/Version.h

struct SemanticVersion

Version struct, follows Semantic Versioning 2.0.

https://semver.org/

Warning

This struct is not ABI safe and must not be passed through ABI boundaries. For an ABI-safe version, see omni::ext::Version.

Public Functions

SemanticVersion() = default

Constructor.

Initializes a SemanticVersion with -1 for all version values and empty pre-release and build values.

inline std::string toString(bool includeBuildMetadata = true) const

Converts this version to a string.

If major, minor and patch are negative, an empty string is returned. Otherwise the string returned is <major>.<minor>.<patch>[-<prerelease>][+<build>]. The +<build> section is only included if includeBuildMetadata is true. The -<prerelease> and +<build> sections are only included if the prerelease and build members (respectively) are not empty.

Parameters

includeBuildMetadata – If true, the +<build> section is included in the returned string

Returns

the version string. See above for detailed explanation

inline void replaceNegativesWithZeros() noexcept

Replaces major, minor or patch values with zeros if they are negative.

inline bool isAllZeroes() const noexcept

Checks if the major, minor and patch values are all zeros.

Returns

true if the major, minor and patch values are all zero; false otherwise

Public Members

int32_t major = {-1}

The major version, as defined by Semantic Versioning. May be negative to match any major version.

int32_t minor = {-1}

The minor version, as defined by Semantic Versioning. May be negative to match any minor version.

int32_t patch = {-1}

The patch version, as defined by Semantic Versioning. May be negative to match any patch version.

std::string prerelease

A string indicating a pre-release value. May be empty.

std::string build

A string indicating a build value. May be empty.

Public Static Functions

static inline SemanticVersion getDefault() noexcept

Returns a default-constructed SemanticVersion.

Returns

a default-constructed SemanticVersion