Classes | Public Member Functions | Protected Member Functions | Private Attributes

version_info Class Reference

#include <version.hpp>

Collaboration diagram for version_info:
Collaboration graph
[legend]

List of all members.

Classes

struct  not_sane_exception
 Thrown when trying to compare an non-sane version_info object. More...

Public Member Functions

 version_info ()
 Default constructor.
 version_info (const version_info &)
 Copy constructor.
 version_info (const std::string &)
 String constructor.
 version_info (unsigned int major, unsigned int minor, unsigned int revision_level, bool sane=true, char special_separator='\0', const std::string &special=std::string())
 Simple list constructor.
version_infooperator= (const version_info &o)
 Assignment operator.
bool good () const
bool is_canonical () const
unsigned int major_version () const
 Retrieves the major version number (X in "X.Y.Z").
unsigned int minor_version () const
 Retrieves the minor version number (Y in "X.Y.Z").
unsigned int revision_level () const
 Retrieves the revision level (Z in "X.Y.Z").
const std::string & special_version () const
 It is sometimes useful so append special build/distribution information to version numbers, in the form of "X.Y.Z+svn", "X.Y.Za", etcetera.
char special_version_separator () const
 Retrieves the special version separator.
void set_major_version (unsigned int)
 Set major version number.
void set_minor_version (unsigned int)
 Set minor version number.
void set_revision_level (unsigned int)
 Set revision level.
void set_special_version (const std::string &str)
 Set special version string.
unsigned int get_component (size_t index) const
 Returns a component from a non-canonically formatted version string (i.e.
void set_component (size_t index, unsigned int value)
 Sets a component in a non-canonically formatted version string (i.e.
const std::vector< unsigned int > & components () const
 Read-only access to complete vector of components.
std::string str () const
 Returns a formatted string of the form A.B.C[.x1[.x2[...]]]kS, where xN stand for non-canonical version components, k for the suffix separator, and S for the suffix string.
 operator std::string () const
 Syntactic shortcut for str().

Protected Member Functions

void assign (const version_info &)
 Assign from other version_info object.

Private Attributes

std::vector< unsigned int > nums_
std::string special_
char special_separator_
bool sane_

Detailed Description

Definition at line 31 of file version.hpp.


Constructor & Destructor Documentation

version_info::version_info (  ) 

Default constructor.

Definition at line 30 of file version.cpp.

version_info::version_info ( const version_info o  ) 

Copy constructor.

Definition at line 22 of file version.cpp.

version_info::version_info ( const std::string &  str  ) 

String constructor.

Definition at line 44 of file version.cpp.

References components(), lexical_cast(), nums_, sane_, special_, special_separator_, utils::split(), and utils::strip().

Here is the call graph for this function:

version_info::version_info ( unsigned int  major,
unsigned int  minor,
unsigned int  revision_level,
bool  sane = true,
char  special_separator = '\0',
const std::string &  special = std::string() 
)

Simple list constructor.

Definition at line 35 of file version.cpp.

References nums_.


Member Function Documentation

void version_info::assign ( const version_info o  )  [protected]

Assign from other version_info object.

Definition at line 106 of file version.cpp.

References nums_, sane_, special_, and special_separator_.

Referenced by operator=().

Here is the caller graph for this function:

const std::vector<unsigned int>& version_info::components (  )  const [inline]

Read-only access to complete vector of components.

Definition at line 125 of file version.hpp.

References nums_.

Referenced by version_info().

Here is the caller graph for this function:

unsigned int version_info::get_component ( size_t  index  )  const [inline]

Returns a component from a non-canonically formatted version string (i.e.

'D' from A.B.C.D is index 3). The index may be in the [0,3) range; in such case, this function works identically to the canonical version numbers extractors.

Note:
If the number of components is smaller than index-1, a std::out_of_range exception may be thrown.

Definition at line 106 of file version.hpp.

References nums_.

bool version_info::good (  )  const [inline]

Definition at line 51 of file version.hpp.

References sane_.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

bool version_info::is_canonical (  )  const

Definition at line 165 of file version.cpp.

References nums_, and sane_.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

unsigned int version_info::major_version (  )  const

Retrieves the major version number (X in "X.Y.Z").

Definition at line 153 of file version.cpp.

References nums_.

Referenced by BOOST_AUTO_TEST_CASE(), savegame::loadgame::check_version_compatibility(), and get_version_path_suffix().

Here is the caller graph for this function:

unsigned int version_info::minor_version (  )  const

Retrieves the minor version number (Y in "X.Y.Z").

Definition at line 157 of file version.cpp.

References nums_.

Referenced by BOOST_AUTO_TEST_CASE(), savegame::loadgame::check_version_compatibility(), and get_version_path_suffix().

Here is the caller graph for this function:

version_info::operator std::string (  )  const [inline]

Syntactic shortcut for str().

Definition at line 137 of file version.hpp.

References str().

Here is the call graph for this function:

version_info& version_info::operator= ( const version_info o  )  [inline]

Assignment operator.

Definition at line 46 of file version.hpp.

References assign().

Here is the call graph for this function:

unsigned int version_info::revision_level (  )  const

Retrieves the revision level (Z in "X.Y.Z").

Definition at line 161 of file version.cpp.

References nums_.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

void version_info::set_component ( size_t  index,
unsigned int  value 
) [inline]

Sets a component in a non-canonically formatted version string (i.e.

'D' from A.B.C.D is index 3). The index may be in the [0,3) range; in such case, this function works identically to the canonical version numbers setters.

Note:
If the number of components is smaller than index-1, new ones are added and initialized as 0 to make room.

Definition at line 120 of file version.hpp.

References nums_.

void version_info::set_major_version ( unsigned int  v  ) 

Set major version number.

Definition at line 141 of file version.cpp.

References nums_.

void version_info::set_minor_version ( unsigned int  v  ) 

Set minor version number.

Definition at line 145 of file version.cpp.

References nums_.

void version_info::set_revision_level ( unsigned int  v  ) 

Set revision level.

Definition at line 149 of file version.cpp.

References nums_.

void version_info::set_special_version ( const std::string &  str  )  [inline]

Set special version string.

Definition at line 90 of file version.hpp.

References special_.

const std::string& version_info::special_version (  )  const [inline]

It is sometimes useful so append special build/distribution information to version numbers, in the form of "X.Y.Z+svn", "X.Y.Za", etcetera.

This member function retrieves such if available.

Definition at line 72 of file version.hpp.

References special_.

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

Here is the caller graph for this function:

char version_info::special_version_separator (  )  const [inline]

Retrieves the special version separator.

For the "X.Y.Z+blah" string, it would be '+'. On the other hand, it would be a null (ASCII 00) character if the string was "X.Y.Za".

Definition at line 81 of file version.hpp.

References special_separator_.

Referenced by BOOST_AUTO_TEST_CASE().

Here is the caller graph for this function:

std::string version_info::str (  )  const

Returns a formatted string of the form A.B.C[.x1[.x2[...]]]kS, where xN stand for non-canonical version components, k for the suffix separator, and S for the suffix string.

Definition at line 117 of file version.cpp.

References nums_, special_, and special_separator_.

Referenced by BOOST_AUTO_TEST_CASE(), savegame::loadgame::check_version_compatibility(), preprocessor_data::get_chunk(), operator std::string(), addon_info::write(), and addon_info::write_minimal().

Here is the caller graph for this function:


Member Data Documentation

std::vector<unsigned int> version_info::nums_ [private]
bool version_info::sane_ [private]

Definition at line 147 of file version.hpp.

Referenced by assign(), good(), is_canonical(), and version_info().

std::string version_info::special_ [private]

Definition at line 145 of file version.hpp.

Referenced by assign(), set_special_version(), special_version(), str(), and version_info().

Definition at line 146 of file version.hpp.

Referenced by assign(), special_version_separator(), str(), and version_info().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:17:54 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs