libzypp  13.10.6
zypp::Edition Class Reference

Edition represents [epoch:]version[-release] More...

#include <Edition.h>

Inheritance diagram for zypp::Edition:
zypp::IdStringType< Edition > zypp::sat::detail::PoolMember

Classes

struct  Match
 match functor. More...
 

Public Types

typedef unsigned epoch_t
 Type of an epoch. More...
 
typedef zypp::Compare< EditionCompare
 compare functor. More...
 
typedef Range< EditionCompareRange
 Edition Range based on Compare. More...
 
typedef Range< Edition, MatchMatchRange
 Edition Range based on Match. More...
 
- Public Types inherited from zypp::IdStringType< Edition >
typedef IdString::IdType IdType
 

Public Member Functions

 Edition ()
 Default ctor: noedition. More...
 
 Edition (IdString::IdType id_r)
 Ctor taking edition as string. More...
 
 Edition (const IdString &idstr_r)
 
 Edition (const std::string &str_r)
 
 Edition (const char *cstr_r)
 
 Edition (const std::string &version_r, const std::string &release_r, epoch_t epoch_r=noepoch)
 Ctor taking version_r, release_r and optional epoch_r. More...
 
 Edition (const char *version_r, const char *release_r, epoch_t epoch_r=noepoch)
 
 Edition (const std::string &version_r, const std::string &release_r, const std::string &epoch_r)
 Ctor taking version_r, release_r and optional epoch_r as string. More...
 
 Edition (const char *version_r, const char *release_r, const char *epoch_r)
 
epoch_t epoch () const
 Epoch. More...
 
std::string version () const
 Version. More...
 
std::string release () const
 Release. More...
 
- Public Member Functions inherited from zypp::IdStringType< Edition >
const IdStringidStr () const
 
bool empty () const
 
unsigned size () const
 
const char * c_str () const
 
std::string asString () const
 
IdType id () const
 
 operator bool () const
 Evaluate in a boolean context ( ! empty() ). More...
 
int compare (const Edition &rhs) const
 
int compare (const IdStringType &rhs) const
 
int compare (const IdString &rhs) const
 
int compare (const std::string &rhs) const
 
int compare (const char *rhs) const
 

Static Public Attributes

static const epoch_t noepoch = 0
 Value representing noepoch. More...
 
static const Edition noedition
 Value representing noedition ("") This is in fact a valid Edition. More...
 

Static Private Member Functions

static int _doCompare (const char *lhs, const char *rhs)
 
static int _doMatch (const char *lhs, const char *rhs)
 

Private Attributes

IdString _str
 

Friends

class IdStringType< Edition >
 

Related Functions

(Note that these are not member functions.)

std::ostream & dumpAsXmlOn (std::ostream &str, const Edition &obj)
 

Match two Editions

Match two Editions returning -1,0,1, treating empty version/release strings as ANY.

int match (const Edition &rhs) const
 
int match (const IdString &rhs) const
 
int match (const std::string &rhs) const
 
int match (const char *rhs) const
 
static int match (const Edition &lhs, const Edition &rhs)
 
static int match (const Edition &lhs, const IdString &rhs)
 
static int match (const Edition &lhs, const std::string &rhs)
 
static int match (const Edition &lhs, const char *rhs)
 
static int match (const IdString &lhs, const Edition &rhs)
 
static int match (const IdString &lhs, const IdString &rhs)
 
static int match (const IdString &lhs, const std::string &rhs)
 
static int match (const IdString &lhs, const char *rhs)
 
static int match (const std::string &lhs, const Edition &rhs)
 
static int match (const std::string &lhs, const IdString &rhs)
 
static int match (const std::string &lhs, const std::string &rhs)
 
static int match (const std::string &lhs, const char *rhs)
 
static int match (const char *lhs, const Edition &rhs)
 
static int match (const char *lhs, const IdString &rhs)
 
static int match (const char *lhs, const std::string &rhs)
 
static int match (const char *lhs, const char *rhs)
 

Additional Inherited Members

- Static Public Member Functions inherited from zypp::IdStringType< Edition >
static int compare (const Edition &lhs, const Edition &rhs)
 
static int compare (const Edition &lhs, const IdString &rhs)
 
static int compare (const Edition &lhs, const std::string &rhs)
 
static int compare (const Edition &lhs, const char *rhs)
 
static int compare (const IdString &lhs, const Edition &rhs)
 
static int compare (const IdString &lhs, const IdString &rhs)
 
static int compare (const IdString &lhs, const std::string &rhs)
 
static int compare (const IdString &lhs, const char *rhs)
 
static int compare (const std::string &lhs, const Edition &rhs)
 
static int compare (const std::string &lhs, const IdString &rhs)
 
static int compare (const std::string &lhs, const std::string &rhs)
 
static int compare (const std::string &lhs, const char *rhs)
 
static int compare (const char *lhs, const Edition &rhs)
 
static int compare (const char *lhs, const IdString &rhs)
 
static int compare (const char *lhs, const std::string &rhs)
 
static int compare (const char *lhs, const char *rhs)
 
- Protected Member Functions inherited from zypp::IdStringType< Edition >
 IdStringType ()
 
 IdStringType (const IdStringType &)
 
void operator= (const IdStringType &)
 
 ~IdStringType ()
 
- Static Protected Member Functions inherited from zypp::sat::detail::PoolMember
static PoolImplmyPool ()
 

Detailed Description

Edition represents [epoch:]version[-release]

  • epoch (optional) number, Edition::noepoch if not supplied
  • version (required) string, may not contain '-'
  • release (optional) string, may not contain '-'

Comparison is actually g_BackendSpecific.

  • RPM: Edition are ordered according to epoch, then version, then release. Version and release strings are compared by splitting them into segments of alpha or digit sequences. Segments are compared according to their type. On mixed types a string compares less than a number.
    * compare( 1.a, 1.0 ) == -1 (<)
    * compare( 1.0, 1.a ) == 1 (>)
    * compare( 1.0, 1_0 ) == 0 (==)
    *
Attention
operator< defines equivalence classes of version strings, as non alphanumeric chars are ignored. That' why 1.0 and 1_0 compare equal in the example.
Edition::match compares two editions, treating empty version or release strings as wildcard. Thus match is not transitive, and you don't want to use it to order keys in a a std::container.

Definition at line 60 of file Edition.h.

Member Typedef Documentation

typedef unsigned zypp::Edition::epoch_t

Type of an epoch.

Definition at line 64 of file Edition.h.

Constructor & Destructor Documentation

zypp::Edition::Edition ( )
inline

Default ctor: noedition.

Definition at line 77 of file Edition.h.

zypp::Edition::Edition ( IdString::IdType  id_r)
inlineexplicit

Ctor taking edition as string.

Definition at line 80 of file Edition.h.

zypp::Edition::Edition ( const IdString idstr_r)
inlineexplicit

Definition at line 81 of file Edition.h.

zypp::Edition::Edition ( const std::string &  str_r)
inlineexplicit

Definition at line 82 of file Edition.h.

zypp::Edition::Edition ( const char *  cstr_r)
inlineexplicit

Definition at line 83 of file Edition.h.

zypp::Edition::Edition ( const std::string &  version_r,
const std::string &  release_r,
epoch_t  epoch_r = noepoch 
)

Ctor taking version_r, release_r and optional epoch_r.

Definition at line 58 of file Edition.cc.

zypp::Edition::Edition ( const char *  version_r,
const char *  release_r,
epoch_t  epoch_r = noepoch 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 64 of file Edition.cc.

zypp::Edition::Edition ( const std::string &  version_r,
const std::string &  release_r,
const std::string &  epoch_r 
)

Ctor taking version_r, release_r and optional epoch_r as string.

Definition at line 70 of file Edition.cc.

zypp::Edition::Edition ( const char *  version_r,
const char *  release_r,
const char *  epoch_r 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 76 of file Edition.cc.

Member Function Documentation

Edition::epoch_t zypp::Edition::epoch ( ) const

Epoch.

Definition at line 82 of file Edition.cc.

std::string zypp::Edition::version ( ) const

Version.

Definition at line 94 of file Edition.cc.

std::string zypp::Edition::release ( ) const

Release.

Definition at line 110 of file Edition.cc.

static int zypp::Edition::match ( const Edition lhs,
const Edition rhs 
)
inlinestatic

Definition at line 130 of file Edition.h.

static int zypp::Edition::match ( const Edition lhs,
const IdString rhs 
)
inlinestatic

Definition at line 131 of file Edition.h.

static int zypp::Edition::match ( const Edition lhs,
const std::string &  rhs 
)
inlinestatic

Definition at line 132 of file Edition.h.

static int zypp::Edition::match ( const Edition lhs,
const char *  rhs 
)
inlinestatic

Definition at line 133 of file Edition.h.

static int zypp::Edition::match ( const IdString lhs,
const Edition rhs 
)
inlinestatic

Definition at line 135 of file Edition.h.

static int zypp::Edition::match ( const IdString lhs,
const IdString rhs 
)
inlinestatic

Definition at line 136 of file Edition.h.

static int zypp::Edition::match ( const IdString lhs,
const std::string &  rhs 
)
inlinestatic

Definition at line 138 of file Edition.h.

static int zypp::Edition::match ( const IdString lhs,
const char *  rhs 
)
inlinestatic

Definition at line 139 of file Edition.h.

static int zypp::Edition::match ( const std::string &  lhs,
const Edition rhs 
)
inlinestatic

Definition at line 141 of file Edition.h.

static int zypp::Edition::match ( const std::string &  lhs,
const IdString rhs 
)
inlinestatic

Definition at line 142 of file Edition.h.

static int zypp::Edition::match ( const std::string &  lhs,
const std::string &  rhs 
)
inlinestatic

Definition at line 143 of file Edition.h.

static int zypp::Edition::match ( const std::string &  lhs,
const char *  rhs 
)
inlinestatic

Definition at line 144 of file Edition.h.

static int zypp::Edition::match ( const char *  lhs,
const Edition rhs 
)
inlinestatic

Definition at line 146 of file Edition.h.

static int zypp::Edition::match ( const char *  lhs,
const IdString rhs 
)
inlinestatic

Definition at line 147 of file Edition.h.

static int zypp::Edition::match ( const char *  lhs,
const std::string &  rhs 
)
inlinestatic

Definition at line 148 of file Edition.h.

static int zypp::Edition::match ( const char *  lhs,
const char *  rhs 
)
inlinestatic

Definition at line 149 of file Edition.h.

int zypp::Edition::match ( const Edition rhs) const
inline

Definition at line 151 of file Edition.h.

int zypp::Edition::match ( const IdString rhs) const
inline

Definition at line 152 of file Edition.h.

int zypp::Edition::match ( const std::string &  rhs) const
inline

Definition at line 153 of file Edition.h.

int zypp::Edition::match ( const char *  rhs) const
inline

Definition at line 154 of file Edition.h.

int zypp::Edition::_doCompare ( const char *  lhs,
const char *  rhs 
)
staticprivate

Definition at line 120 of file Edition.cc.

int zypp::Edition::_doMatch ( const char *  lhs,
const char *  rhs 
)
staticprivate

Definition at line 127 of file Edition.cc.

Friends And Related Function Documentation

friend class IdStringType< Edition >
friend

Definition at line 176 of file Edition.h.

std::ostream & dumpAsXmlOn ( std::ostream &  str,
const Edition obj 
)
related

XML output.

Definition at line 182 of file Edition.h.

Member Data Documentation

const epoch_t zypp::Edition::noepoch = 0
static

Value representing noepoch.

Definition at line 67 of file Edition.h.

const Edition zypp::Edition::noedition
static

Value representing noedition ("") This is in fact a valid Edition.

It's what the default ctor creates or will be parsed from an empty string.

Definition at line 73 of file Edition.h.

IdString zypp::Edition::_str
private

Definition at line 177 of file Edition.h.


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