Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#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 | |
Version & | operator= (const Version &version) |
Version & | operator= (const char *text) |
Version & | operator= (const cstring text) |
Version & | operator= (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 |
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).
elm::Version::Version | ( | int | major = 0 , |
int | minor = 0 , |
||
int | release = 0 |
||
) |
Build a new version.
major | Major number. |
minor | Minor number. |
release | Release number. |
Referenced by nextMajor(), nextMinor(), and nextRelease().
elm::Version::Version | ( | const Version & | version | ) |
Build a version by cloning.
version | Cloned 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.
text | String to build from. |
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.
version | Version 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.
version | Version to compare with. |
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 |
Version& elm::Version::operator= | ( | const char * | 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.
text | Text containing the version. |
References elm::io::in, elm::String::indexOf(), elm::io::Input::setStream(), elm::String::substring(), and ZERO.
int elm::Version::release | ( | void | ) | const |
Get the release number.
Referenced by elm::operator<<().
|
static |
Zero version, that is, 0.0.0.
Referenced by operator=().