Ceylan::Version Class Reference

Describes a version, with respect to the form: (major version). More...

#include <CeylanVersion.h>

Inheritance diagram for Ceylan::Version:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::Version:

Collaboration graph
[legend]

List of all members.

Public Types

typedef Ceylan::Uint8 VersionNumber
 Describes a version number, a part of the full version identifier.
enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 Version (VersionNumber major=0, VersionNumber minor=0, VersionNumber release=0)
 Constructs a new version identifier.
 Version (const std::string &versionText)
 Constructs a new version identifier from a string of the form 'x.y.z' where x, y and z are textual representations of positive or null integers.
virtual ~Version () throw ()
 Basic virtual destructor.
virtual VersionNumber getMajorNumber () const
 Returns the major number of this version identifier.
virtual void setMajorNumber (VersionNumber newNumber)
 Sets the major number of this version identifier.
virtual VersionNumber getMinorNumber () const
 Returns the minor number of this version identifier.
virtual void setMinorNumber (VersionNumber newNumber)
 Sets the minor number of this version identifier.
virtual VersionNumber getReleaseNumber () const
 Returns the release number (or patch number) of this version identifier.
virtual void setReleaseNumber (VersionNumber newNumber)
 Sets the release number (or patch number) of this version identifier.
virtual bool isCompatibleWith (const Version &expectedVersion) const
 Tells whether this version, taken as an actual library version, is compatible with the specified one, taken as a requested version.
virtual bool canBeComparedWith (const Version &version) const
 Tells whether this version scheme is compatible with the one of the supplied version instance.
virtual const std::string toString (VerbosityLevels level=high) const
 Returns a user-friendly description of the state of this object.

Static Public Member Functions

static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Member Functions

virtual bool isUsualVersionSchemeCompliant () const
 Tells whether a Version instance (be it a child class or not), can be considered as a all-purpose usual version, or if it obeys to specific rules that prevent from comparing it according to the common rules.

Protected Attributes

VersionNumber _major
 The major version number, i.e. the first version coordinate.
VersionNumber _minor
 The minor version number, i.e. the second version coordinate.
VersionNumber _release
 The release version number (or patch number), i.e.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 Version (const Version &source)
 Copy constructor made private to ensure that it will be never called.
Versionoperator= (const Version &source)
 Assignment operator made private to ensure that it will be never called.


Detailed Description

Describes a version, with respect to the form: (major version).

(minor version).(release or patch version)

See also:
CeylanUtils.h for an actual use of this version facility, including automated checking on loading.

Definition at line 64 of file CeylanVersion.h.


Member Typedef Documentation

Describes a version number, a part of the full version identifier.

Definition at line 76 of file CeylanVersion.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

Version::Version ( VersionNumber  major = 0,
VersionNumber  minor = 0,
VersionNumber  release = 0 
) [explicit]

Constructs a new version identifier.

Parameters:
major the major version number.
minor the minor version number.
release the release version number, or the patch number.

Definition at line 58 of file CeylanVersion.cc.

Version::Version ( const std::string &  versionText  )  [explicit]

Constructs a new version identifier from a string of the form 'x.y.z' where x, y and z are textual representations of positive or null integers.

Parameters:
versionText a string describing the version, ex: "1.15.216"
Exceptions:
VersionException if the string could not be transformed into a valid version.

Definition at line 69 of file CeylanVersion.cc.

References _major, _minor, _release, dataUtils::e, Ceylan::formatStringList(), Ceylan::split(), Ceylan::stringToUnsignedLong(), Ceylan::Exception::toString(), and Ceylan::toString().

Version::~Version (  )  throw () [virtual]

Basic virtual destructor.

Definition at line 124 of file CeylanVersion.cc.

Ceylan::Version::Version ( const Version source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.


Member Function Documentation

bool Version::canBeComparedWith ( const Version version  )  const [virtual]

Tells whether this version scheme is compatible with the one of the supplied version instance.

Returns:
true iff comparing these two versions would have a meaning.
Note:
This method is public so that the operators can use it.

Reimplemented in Ceylan::LibtoolVersion.

Definition at line 182 of file CeylanVersion.cc.

References isUsualVersionSchemeCompliant().

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

Version::VersionNumber Version::getMajorNumber (  )  const [virtual]

Returns the major number of this version identifier.

Definition at line 131 of file CeylanVersion.cc.

References _major.

Referenced by operator<(), operator==(), and Ceylan::Module::setVersion().

Version::VersionNumber Version::getMinorNumber (  )  const [virtual]

Returns the minor number of this version identifier.

Definition at line 145 of file CeylanVersion.cc.

References _minor.

Referenced by operator<(), operator==(), and Ceylan::Module::setVersion().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

Version::VersionNumber Version::getReleaseNumber (  )  const [virtual]

Returns the release number (or patch number) of this version identifier.

Definition at line 159 of file CeylanVersion.cc.

References _release.

Referenced by operator<(), operator==(), and Ceylan::Module::setVersion().

bool Version::isCompatibleWith ( const Version expectedVersion  )  const [virtual]

Tells whether this version, taken as an actual library version, is compatible with the specified one, taken as a requested version.

Basically, for these all-purpose versions, the user-supplied version must exactly match this version to be deemed compatible with.

Parameters:
version the library version expected by the user program, which corresponds to the headers it has been compiled with.
Returns:
true iff the program can be safely linked with this library version.
Exceptions:
VersionException if the comparison of the two versions cannot be done, for example in the case where they belong to incompatible version schemes: this would be a meaningless operation.

Reimplemented in Ceylan::LibtoolVersion.

Definition at line 173 of file CeylanVersion.cc.

bool Version::isUsualVersionSchemeCompliant (  )  const [protected, virtual]

Tells whether a Version instance (be it a child class or not), can be considered as a all-purpose usual version, or if it obeys to specific rules that prevent from comparing it according to the common rules.

For example, Libtool versions should not be mixed with basic versions, since their meaning differ.

Reimplemented in Ceylan::LibtoolVersion.

Definition at line 211 of file CeylanVersion.cc.

References generalUtils::true.

Referenced by canBeComparedWith().

Version& Ceylan::Version::operator= ( const Version source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void Version::setMajorNumber ( VersionNumber  newNumber  )  [virtual]

Sets the major number of this version identifier.

Definition at line 138 of file CeylanVersion.cc.

References _major.

Referenced by Ceylan::Module::setVersion().

void Version::setMinorNumber ( VersionNumber  newNumber  )  [virtual]

Sets the minor number of this version identifier.

Definition at line 152 of file CeylanVersion.cc.

References _minor.

Referenced by Ceylan::Module::setVersion().

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

void Version::setReleaseNumber ( VersionNumber  newNumber  )  [virtual]

Sets the release number (or patch number) of this version identifier.

Definition at line 166 of file CeylanVersion.cc.

References _release.

Referenced by Ceylan::Module::setVersion().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string Version::toString ( VerbosityLevels  level = high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Implements Ceylan::TextDisplayable.

Reimplemented in Ceylan::LibtoolVersion.

Definition at line 189 of file CeylanVersion.cc.

References _major, _minor, _release, Ceylan::low, Ceylan::medium, and Ceylan::toNumericalString().

Referenced by Ceylan::LibtoolVersion::isCompatibleWith(), operator<(), operator==(), and Ceylan::Module::toString().


Member Data Documentation

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().


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

Generated on Thu Jun 4 20:40:10 2009 for Ceylan by  doxygen 1.5.8