BundleVersion¶
-
std::ostream &
cppmicroservices::
operator<<
(std::ostream &os, const BundleVersion &v)¶ Streams the string representation of
v
into the streamos
, using BundleVersion::ToString.
-
class
cppmicroservices::
BundleVersion
¶ - #include <cppmicroservices/BundleVersion.h>
Version identifier for CppMicroServices bundles.
Version identifiers have four components.
- Major version. A non-negative integer.
- Minor version. A non-negative integer.
- Micro version. A non-negative integer.
- Qualifier. A text string. See
BundleVersion(const std::string&)
for the format of the qualifier string.
BundleVersion
objects are immutable.Public Functions
-
BundleVersion
(unsigned int majorVersion, unsigned int minorVersion, unsigned int microVersion)¶ Creates a version identifier from the specified numerical components.
The qualifier is set to the empty string.
- Parameters
majorVersion
: Major component of the version identifier.minorVersion
: Minor component of the version identifier.microVersion
: Micro component of the version identifier.
-
BundleVersion
(unsigned int majorVersion, unsigned int minorVersion, unsigned int microVersion, std::string qualifier)¶ Creates a version identifier from the specified components.
- Parameters
majorVersion
: Major component of the version identifier.minorVersion
: Minor component of the version identifier.microVersion
: Micro component of the version identifier.qualifier
: Qualifier component of the version identifier.
-
BundleVersion
(const std::string &version)¶ Created a version identifier from the specified string.
Here is the grammar for version strings.
There must be no whitespace in version.
- Parameters
version
: string representation of the version identifier.
-
BundleVersion
(const BundleVersion &version)¶ Create a version identifier from another.
- Parameters
version
: Another version identifier
-
bool
IsUndefined
() const¶ Returns the undefined state of this version identifier.
- Return
true
if this version identifier is undefined,false
otherwise.
-
unsigned int
GetMajor
() const¶ Returns the majorVersion component of this version identifier.
- Return
- The majorVersion component.
-
unsigned int
GetMinor
() const¶ Returns the minorVersion component of this version identifier.
- Return
- The minorVersion component.
-
unsigned int
GetMicro
() const¶ Returns the microVersion component of this version identifier.
- Return
- The microVersion component.
-
std::string
GetQualifier
() const¶ Returns the qualifier component of this version identifier.
- Return
- The qualifier component.
-
std::string
ToString
() const¶ Returns the string representation of this version identifier.
The format of the version string will be
majorVersion.minorVersion.microVersion
if qualifier is the empty string ormajorVersion.minorVersion.microVersion.qualifier
otherwise.- Return
- The string representation of this version identifier.
-
bool
operator==
(const BundleVersion &object) const¶ Compares this
BundleVersion
object to another object.A version is considered to be equal to another version if the majorVersion, minorVersion and microVersion components are equal and the qualifier component is equal.
- Return
true
ifobject
is aBundleVersion
and is equal to this object;false
otherwise.- Parameters
object
: TheBundleVersion
object to be compared.
-
int
Compare
(const BundleVersion &object) const¶ Compares this
BundleVersion
object to another object.A version is considered to be less than another version if its majorVersion component is less than the other version’s majorVersion component, or the majorVersion components are equal and its minorVersion component is less than the other version’s minorVersion component, or the majorVersion and minorVersion components are equal and its microVersion component is less than the other version’s microVersion component, or the majorVersion, minorVersion and microVersion components are equal and it’s qualifier component is less than the other version’s qualifier component (using
std::string::operator<()
).A version is considered to be equal to another version if the majorVersion, minorVersion and microVersion components are equal and the qualifier component is equal.
- Return
- A negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified
BundleVersion
object. - Parameters
object
: TheBundleVersion
object to be compared.
Public Static Functions
-
static BundleVersion
EmptyVersion
()¶ The empty version “0.0.0”.
-
static BundleVersion
UndefinedVersion
()¶ Creates an undefined version identifier, representing either infinity or minus infinity.
-
static BundleVersion
ParseVersion
(const std::string &version)¶ Parses a version identifier from the specified string.
See
BundleVersion(const std::string&)
for the format of the version string.- Return
- A
BundleVersion
object representing the version identifier. Ifversion
is the empty string thenEmptyVersion
will be returned. - Parameters
version
: string representation of the version identifier. Leading and trailing whitespace will be ignored.