libzypp 17.31.23
zypp::Edition Class Reference

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

#include <Edition.h>

Inheritance diagram for zypp::Edition:

Classes

struct  Match
 match functor. More...
 

Public Types

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

Public Member Functions

 Edition ()
 Default ctor: noedition.
 
 Edition (IdString::IdType id_r)
 Ctor taking edition as string.
 
 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.
 
 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.
 
 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.
 
 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.
 
epoch_t epoch () const
 Epoch.
 
std::string version () const
 Version.
 
std::string release () const
 Release.
 
- Public Member Functions inherited from zypp::IdStringType< Edition >
IdString idStr () 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() ).
 
 operator IdString () const
 Explicit conversion to IdString.
 
 operator std::string () const
 Explicit conversion to std::string.
 
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.
 
static const Edition noedition
 Value representing noedition ("") This is in fact a valid Edition.
 

Related Functions

(Note that these are not member functions.)

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

Match two Editions

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

typedef Range< Edition, MatchMatchRange
 Edition Range based on Match.
 
class IdStringType< Edition >
 
IdString _str
 
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)
 
static int _doCompare (const char *lhs, const char *rhs)
 
static int _doMatch (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 \reg 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 (==)
    static int compare(const Edition &lhs, const Edition &rhs)
    Definition: IdStringType.h:127
    unsigned short a
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

◆ epoch_t

typedef unsigned zypp::Edition::epoch_t

Type of an epoch.

Definition at line 64 of file Edition.h.

◆ Compare

◆ CompareRange

◆ MatchRange

Constructor & Destructor Documentation

◆ Edition() [1/9]

zypp::Edition::Edition ( )
inline

Default ctor: noedition.

Definition at line 77 of file Edition.h.

◆ Edition() [2/9]

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

Ctor taking edition as string.

Definition at line 80 of file Edition.h.

◆ Edition() [3/9]

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

Definition at line 81 of file Edition.h.

◆ Edition() [4/9]

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

Definition at line 82 of file Edition.h.

◆ Edition() [5/9]

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

Definition at line 83 of file Edition.h.

◆ Edition() [6/9]

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.

◆ Edition() [7/9]

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.

◆ Edition() [8/9]

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.

◆ Edition() [9/9]

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

◆ epoch()

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

Epoch.

Definition at line 82 of file Edition.cc.

◆ version()

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

Version.

Definition at line 94 of file Edition.cc.

◆ release()

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

Release.

Definition at line 110 of file Edition.cc.

◆ match() [1/20]

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

Definition at line 130 of file Edition.h.

◆ match() [2/20]

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

Definition at line 131 of file Edition.h.

◆ match() [3/20]

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

Definition at line 132 of file Edition.h.

◆ match() [4/20]

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

Definition at line 133 of file Edition.h.

◆ match() [5/20]

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

Definition at line 135 of file Edition.h.

◆ match() [6/20]

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

Definition at line 136 of file Edition.h.

◆ match() [7/20]

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

Definition at line 138 of file Edition.h.

◆ match() [8/20]

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

Definition at line 139 of file Edition.h.

◆ match() [9/20]

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

Definition at line 141 of file Edition.h.

◆ match() [10/20]

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

Definition at line 142 of file Edition.h.

◆ match() [11/20]

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

Definition at line 143 of file Edition.h.

◆ match() [12/20]

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

Definition at line 144 of file Edition.h.

◆ match() [13/20]

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

Definition at line 146 of file Edition.h.

◆ match() [14/20]

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

Definition at line 147 of file Edition.h.

◆ match() [15/20]

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

Definition at line 148 of file Edition.h.

◆ match() [16/20]

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

Definition at line 149 of file Edition.h.

◆ match() [17/20]

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

Definition at line 151 of file Edition.h.

◆ match() [18/20]

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

Definition at line 152 of file Edition.h.

◆ match() [19/20]

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

Definition at line 153 of file Edition.h.

◆ match() [20/20]

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

Definition at line 154 of file Edition.h.

◆ _doCompare()

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

Definition at line 120 of file Edition.cc.

◆ _doMatch()

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

Definition at line 127 of file Edition.cc.

Friends And Related Function Documentation

◆ IdStringType< Edition >

friend class IdStringType< Edition >
friend

Definition at line 173 of file Edition.h.

◆ dumpAsXmlOn()

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

XML output.

Definition at line 182 of file Edition.h.

Member Data Documentation

◆ noepoch

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

Value representing noepoch.

Definition at line 67 of file Edition.h.

◆ noedition

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.

◆ _str

IdString zypp::Edition::_str
private

Definition at line 177 of file Edition.h.


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