Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::Version Class Reference

#include <elm/util/Version.h>

Public Member Functions

 Version (int major=0, int minor=0, int release=0)
 
 Version (const Version &version)
 
 Version (const char *text)
 
 Version (const cstring text)
 
 Version (const string &text)
 
Version nextRelease (void) const
 
Version nextMinor (void) const
 
Version nextMajor (void) const
 
int major (void) const
 
int minor (void) const
 
int release (void) const
 
bool accepts (const Version &version) const
 
int compare (const Version &version) const
 
 operator bool (void) const
 
Versionoperator= (const Version &version)
 
Versionoperator= (const char *text)
 
Versionoperator= (const cstring text)
 
Versionoperator= (const string &text)
 
bool operator== (const Version &version) const
 
bool operator!= (const Version &version) const
 
bool operator> (const Version &version) const
 
bool operator>= (const Version &version) const
 
bool operator< (const Version &version) const
 
bool operator<= (const Version &version) const
 

Static Public Attributes

static const Version ZERO
 

Detailed Description

Useful for representing versions. The versions are represented as a triplet composed of a major number, a minor number and a release number. Different major numbers means that two versions are uncompatible. The minor version number means ascending compatibility. The release number versions only denotes different debugging versions (no change in the interface of a compilation unit).

Constructor & Destructor Documentation

elm::Version::Version ( int  major = 0,
int  minor = 0,
int  release = 0 
)

Build a new version.

Parameters
majorMajor number.
minorMinor number.
releaseRelease number.

Referenced by nextMajor(), nextMinor(), and nextRelease().

elm::Version::Version ( const Version version)

Build a version by cloning.

Parameters
versionCloned version.
elm::Version::Version ( const char *  text)
elm::Version::Version ( const cstring  text)
elm::Version::Version ( const string text)

Build a version from a string.

See also
operator=(const string& text)
Parameters
textString to build from.

Member Function Documentation

bool elm::Version::accepts ( const Version version) const

Test if the current version accepts the given one, that is, the current one is ascendent-compatible with the given one.

Parameters
versionVersion to compare with.

Referenced by elm::sys::Plugger::plugFile().

int elm::Version::compare ( const Version version) const

Compare two versions. Notice that comparison is only performed on major and minor numbers.

Parameters
versionVersion to compare with.
Returns
0 for equality, <0 if current is less than passed one, >0 else.

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

int elm::Version::major ( void  ) const

Get the major number.

Referenced by elm::operator<<().

int elm::Version::minor ( void  ) const

Get the minor number.

Referenced by elm::operator<<().

Version elm::Version::nextMajor ( void  ) const

Build a version with the next major number.

References Version().

Version elm::Version::nextMinor ( void  ) const

Build a version with the next minor number.

References Version().

Version elm::Version::nextRelease ( void  ) const

Build a version with the next release.

References Version().

elm::Version::operator bool ( void  ) const
bool elm::Version::operator!= ( const Version version) const

References compare().

bool elm::Version::operator< ( const Version version) const

References compare().

bool elm::Version::operator<= ( const Version version) const

References compare().

Version & elm::Version::operator= ( const Version version)
Version& elm::Version::operator= ( const char *  text)
Version& elm::Version::operator= ( const cstring  text)
Version & elm::Version::operator= ( const string text)

Set a version from a text string. The text string must have the following form: [0-9]+(.[0-9]+([0-9]+)?)?. If the string does not match, the version 0.0.0 is set.

Parameters
textText containing the version.
Returns
Current version.

References elm::io::in, elm::String::indexOf(), elm::io::Input::setStream(), elm::String::substring(), and ZERO.

bool elm::Version::operator== ( const Version version) const

References compare().

bool elm::Version::operator> ( const Version version) const

References compare().

bool elm::Version::operator>= ( const Version version) const

References compare().

int elm::Version::release ( void  ) const

Get the release number.

Referenced by elm::operator<<().

Member Data Documentation

const Version elm::Version::ZERO
static

Zero version, that is, 0.0.0.

Referenced by operator=().


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