Quark  0.1
Version Class Reference

A class representing an interface version number. More...

#include <Version.h++>

Public Member Functions

 Version (const QString &version)
 Constructs a new Version from the specified string representation. More...
 
 Version (uint current=0, uint revision=0, uint age=0)
 Constructs a new Version for the given components. More...
 
 Version (const Version &other)
 Copy constructor. More...
 
 ~Version ()
 Destructor. More...
 
bool satisfies (const Version &requested) const
 Determines if an interface with this version satisfies a request for an interface with a specific requested version (i.e., if it is API-compatible with the requested interface). More...
 
bool satisfiedBy (const Version &available) const
 Determines if a requested interface with this version is satisfied by a specific available version (i.e., if the available interface is API-compatible with the requested version of the interface). More...
 
uint current () const
 Returns the current component of the version. More...
 
uint revision () const
 Returns the revision component of the version. More...
 
uint age () const
 Returns the age component of the version. More...
 
void interfacesAdded ()
 Adjusts the version to reflect the addition of new interfaces. More...
 
void interfacesRemoved ()
 Adjusts the version to reflect the removal of existing interfaces. More...
 
void interfacesChanged ()
 Adjusts the version to reflect non-backward-compatible changes to the interfaces. More...
 
void implementationChanged ()
 Adjusts the version to reflect internal implementation changes. More...
 
QString toString () const
 Returns a string representation of the version, in C-A.A.R form. More...
 
QString toCRAString () const
 Returns a string representation of the version, in C:R:A form. More...
 
bool fromString (const QString &version)
 Parses the verison from a string. More...
 
bool operator== (const Version &other) const
 Equality operator. More...
 
bool operator!= (const Version &other) const
 Inequality operator. More...
 
bool operator< (const Version &other) const
 Determines if this Version is older than another version. More...
 
bool operator<= (const Version &other) const
 Determines if this Version is older than or equal to another version. More...
 
bool operator> (const Version &other) const
 Determines if this Version is newer than another version. More...
 
bool operator>= (const Version &other) const
 Determines if this Version is newer than or equal to another version. More...
 
Versionoperator= (const Version &other)
 Assignment operator. More...
 

Detailed Description

A class representing an interface version number.

The version number consists of three components:

  • current: The current interface version.
  • revision: The implementation number of current interface.
  • age: The number of interface versions, beginning with the current interface and working backwards, that the current version is API-compatible with.

These three components are not to be interpreted as major version, minor version, and build number.

A version begins at 0:0:0. The version number changes according to the following rules:

  • If the implementation changes in any way, revision is incremented.
  • If any interfaces are added, removed, or changed, current is incremented and revision is set to 0.
  • If any new interfaces are added, age is incremented.
  • If any existing interfaces are removed, age is set to 0.
Author
Mark Lindner

Constructor & Destructor Documentation

◆ Version() [1/3]

Version ( const QString &  version)

Constructs a new Version from the specified string representation.

Parameters
versionThe string representation of a version, in the form C:R:A or C-A.A.R. For example, 9:0:6 and 3.6.0 are equivalent.

◆ Version() [2/3]

Version ( uint  current = 0,
uint  revision = 0,
uint  age = 0 
)

Constructs a new Version for the given components.

Parameters
currentThe current component.
revisionThe revision component.
ageThe age component, which must always be less than or equal to current; if an invalid age is specified, the value of current is used for age.

◆ Version() [3/3]

Version ( const Version other)

Copy constructor.

◆ ~Version()

~Version ( )

Destructor.

Member Function Documentation

◆ age()

uint age ( ) const
inline

Returns the age component of the version.

◆ current()

uint current ( ) const
inline

Returns the current component of the version.

◆ fromString()

bool fromString ( const QString &  version)

Parses the verison from a string.

◆ implementationChanged()

void implementationChanged ( )

Adjusts the version to reflect internal implementation changes.

◆ interfacesAdded()

void interfacesAdded ( )

Adjusts the version to reflect the addition of new interfaces.

◆ interfacesChanged()

void interfacesChanged ( )

Adjusts the version to reflect non-backward-compatible changes to the interfaces.

◆ interfacesRemoved()

void interfacesRemoved ( )

Adjusts the version to reflect the removal of existing interfaces.

◆ operator!=()

bool operator!= ( const Version other) const
inline

Inequality operator.

◆ operator<()

bool operator< ( const Version other) const

Determines if this Version is older than another version.

◆ operator<=()

bool operator<= ( const Version other) const
inline

Determines if this Version is older than or equal to another version.

◆ operator=()

Version& operator= ( const Version other)

Assignment operator.

◆ operator==()

bool operator== ( const Version other) const

Equality operator.

◆ operator>()

bool operator> ( const Version other) const

Determines if this Version is newer than another version.

◆ operator>=()

bool operator>= ( const Version other) const
inline

Determines if this Version is newer than or equal to another version.

◆ revision()

uint revision ( ) const
inline

Returns the revision component of the version.

◆ satisfiedBy()

bool satisfiedBy ( const Version available) const

Determines if a requested interface with this version is satisfied by a specific available version (i.e., if the available interface is API-compatible with the requested version of the interface).

Parameters
availableThe version that is available.
Returns
true if an interface with the available version can be used by a caller requesting this version, false otherwise.

◆ satisfies()

bool satisfies ( const Version requested) const

Determines if an interface with this version satisfies a request for an interface with a specific requested version (i.e., if it is API-compatible with the requested interface).

Parameters
requestedThe requested version.
Returns
true if an interface with this version can be used by a caller requesting the requested version, false otherwise.

◆ toCRAString()

QString toCRAString ( ) const

Returns a string representation of the version, in C:R:A form.

◆ toString()

QString toString ( ) const

Returns a string representation of the version, in C-A.A.R form.


The documentation for this class was generated from the following file: