libcommonc++  0.7
Version Class Reference

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

#include <Version.h++>

Public Member Functions

 Version (const String &version)
 Construct a new Version from the specified string representation. More...
 
 Version (uint_t current=0, uint_t revision=0, uint_t age=0)
 Construct a new Version for the given components. More...
 
 Version (const Version &other)
 Copy constructor. More...
 
virtual ~Version ()
 Destructor. More...
 
bool satisfies (const Version &requested) const
 Determine 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
 Determine 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_t getCurrent () const
 Get the current component of the version. More...
 
uint_t getRevision () const
 Get the revision component of the version. More...
 
uint_t getAge () const
 Get the age component of the version. More...
 
void interfacesAdded ()
 Adjust the version to reflect the addition of new interfaces. More...
 
void interfacesRemoved ()
 Adjust the version to reflect the removal of existing interfaces. More...
 
void interfacesChanged ()
 Adjust the version to reflect non-backward-compatible changes to the interfaces. More...
 
void implementationChanged ()
 Adjust the version to reflect internal implementation changes. More...
 
String toString () const
 Get a String representation of the version, in C-A.A.R form. More...
 
String toCRAString () const
 Get a String representation of the version, in C:R:A form. More...
 
void fromString (const String &version)
 Parse 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
 Determine if this Version is older than another version. More...
 
bool operator<= (const Version &other) const
 Determine if this Version is older than or equal to another version. More...
 
bool operator> (const Version &other) const
 Determine if this Version is newer than another version. More...
 
bool operator>= (const Version &other) const
 Determine 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 String version)

Construct 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_t  current = 0,
uint_t  revision = 0,
uint_t  age = 0 
)

Construct 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 ( )
virtual

Destructor.

Member Function Documentation

◆ fromString()

void fromString ( const String version)

Parse the verison from a String.

◆ getAge()

uint_t getAge ( ) const
inline

Get the age component of the version.

◆ getCurrent()

uint_t getCurrent ( ) const
inline

Get the current component of the version.

◆ getRevision()

uint_t getRevision ( ) const
inline

Get the revision component of the version.

◆ implementationChanged()

void implementationChanged ( )

Adjust the version to reflect internal implementation changes.

◆ interfacesAdded()

void interfacesAdded ( )

Adjust the version to reflect the addition of new interfaces.

◆ interfacesChanged()

void interfacesChanged ( )

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

◆ interfacesRemoved()

void interfacesRemoved ( )

Adjust 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

Determine if this Version is older than another version.

◆ operator<=()

bool operator<= ( const Version other) const
inline

Determine 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

Determine if this Version is newer than another version.

◆ operator>=()

bool operator>= ( const Version other) const
inline

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

◆ satisfiedBy()

bool satisfiedBy ( const Version available) const

Determine 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

Determine 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()

String toCRAString ( ) const

Get a String representation of the version, in C:R:A form.

◆ toString()

String toString ( ) const

Get a String representation of the version, in C-A.A.R form.


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