LibPkg
Classes | Public Member Functions | List of all members
pkg::version Class Reference

A class to represent a package version. More...

#include <version.h>

Classes

class  parse_error
 An exception class for reporting parse errors. More...
 

Public Member Functions

 version ()
 Construct version with default value. More...
 
 version (const string &epoch, const string &upstream_version, const string &package_version)
 Construct version from components. More...
 
 version (string::const_iterator first, string::const_iterator last)
 Construct version from sequence. More...
 
 version (const string &verstr)
 Construct version from string. More...
 
 operator string () const
 Convert version to string. More...
 
string epoch () const
 Get epoch. More...
 
string upstream_version () const
 Get upstream version. More...
 
string package_version () const
 Get package version. More...
 

Detailed Description

A class to represent a package version.

Syntax and semantics are as specified in version 3.8.0 of the Debian Policy Manual.

Constructor & Destructor Documentation

◆ version() [1/4]

pkg::version::version ( )

Construct version with default value.

By default the epoch, upstream version and package version are all empty.

Referenced by pkg::update::poll(), and pkg::binary_control_table::update().

◆ version() [2/4]

pkg::version::version ( const string &  epoch,
const string &  upstream_version,
const string &  package_version 
)

Construct version from components.

If any of these components contain invalid characters then a parse error is thrown.

Parameters
epochthe epoch
upstream_versionthe upstream version
package_versionthe package version

◆ version() [3/4]

pkg::version::version ( string::const_iterator  first,
string::const_iterator  last 
)

Construct version from sequence.

If the version string contains any illegal characters then a parse error is thrown.

Parameters
firstthe beginning of the sequence
lastthe end of the sequence

◆ version() [4/4]

pkg::version::version ( const string &  verstr)

Construct version from string.

If the version string contains any illegal characters then a parse error is thrown.

Parameters
verstrthe version string

Member Function Documentation

◆ operator string()

pkg::version::operator string ( ) const

Convert version to string.

A colon (to terminate the epoch) is included if the epoch is non-empty, or if the upstream version contains one or more colons. A minus sign (to introduce the package version) is included if the package version is non-empty, or if the upstream version contains one or more minus signs.

Returns
the version as a string

◆ epoch()

string pkg::version::epoch ( ) const
inline

Get epoch.

Returns
the epoch

◆ upstream_version()

string pkg::version::upstream_version ( ) const
inline

Get upstream version.

Returns
the upstream version

◆ package_version()

string pkg::version::package_version ( ) const
inline

Get package version.

Returns
the package version

References pkg::operator!=(), pkg::operator<(), pkg::operator<=(), pkg::operator==(), pkg::operator>(), and pkg::operator>=().


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

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)