zypp::Edition Class Reference

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

#include <Edition.h>

List of all members.

Public Types

typedef unsigned epoch_t
 Type of an epoch.
typedef Compare< EditionCompare
 compare functor.
typedef Range< EditionCompareRange
 Edition Range based on Compare.
typedef Range< Edition, MatchMatchRange
 Edition Range based on Match.

Public Member Functions

 Edition ()
 Default ctor: noedition.
 Edition (const std::string &edition_r)
 Ctor taking edition as string.
 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 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 ()
 Dtor.
epoch_t epoch () const
 Epoch.
const std::string & version () const
 Version.
const std::string & release () const
 Release.
std::string asString () const
 String representation of Edition.
int compare (const Edition &rhs) const
int match (const Edition &rhs) const

Static Public Member Functions

static int compare (const Edition &lhs, const Edition &rhs)
 Compare two Editions returning -1,0,1.
static int match (const Edition &lhs, const Edition &rhs)
 Match two Editions returning -1,0,1, treating empty strings as ANY.

Static Public Attributes

static const epoch_t noepoch = 0
 Value representing noepoch.
static const Edition noedition
 Value representing noedition.

Private Attributes

RW_pointer< Impl_pimpl
 Pointer to implementation.

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const Edition &obj)
Comaprison based on epoch, version, and release.
bool operator== (const Edition &lhs, const Edition &rhs)
bool operator!= (const Edition &lhs, const Edition &rhs)
bool operator< (const Edition &lhs, const Edition &rhs)
bool operator<= (const Edition &lhs, const Edition &rhs)
bool operator> (const Edition &lhs, const Edition &rhs)
bool operator>= (const Edition &lhs, const Edition &rhs)

Classes

struct  Impl
 Edition implementation. More...
struct  Match
 match functor. More...


Detailed Description

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

Comparison is actually g_BackendSpecific.

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.
If Edition is used as key in a std::container, per default plain string comparison is used. If you want to compare by version, let the container use CompareByLT<Edition> to compare.

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.

Todo:
Define exceptions.

optimize implementation(e.g don't store epoch if noepoch)

implement debian comparison and make choice backend specific

optimize noedition. unified Impl and quick check in compare.

Definition at line 68 of file Edition.h.


Member Typedef Documentation

typedef unsigned zypp::Edition::epoch_t
 

Type of an epoch.

Definition at line 72 of file Edition.h.

typedef Compare<Edition> zypp::Edition::Compare
 

compare functor.

See also:
Comparison using relational operator zypp::Rel..

Definition at line 140 of file Edition.h.

typedef Range<Edition> zypp::Edition::CompareRange
 

Edition Range based on Compare.

See also:
Comparison using relational operator zypp::Rel..

Definition at line 145 of file Edition.h.

typedef Range<Edition, Match> zypp::Edition::MatchRange
 

Edition Range based on Match.

See also:
Comparison using relational operator zypp::Rel..

Definition at line 170 of file Edition.h.


Constructor & Destructor Documentation

zypp::Edition::Edition  ) 
 

Default ctor: noedition.

Definition at line 236 of file Edition.cc.

zypp::Edition::Edition const std::string &  edition_r  ) 
 

Ctor taking edition as string.

Exceptions:
INTERNAL if edition_r does not make a valid Edition.

Definition at line 240 of file Edition.cc.

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.

Exceptions:
INTERNAL if version_r or release_r are not valid.

Definition at line 244 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.

Exceptions:
INTERNAL if version_r or release_r epoch_r are not valid.

Definition at line 250 of file Edition.cc.

zypp::Edition::~Edition  ) 
 

Dtor.

Definition at line 256 of file Edition.cc.


Member Function Documentation

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

Epoch.

Definition at line 259 of file Edition.cc.

References _pimpl.

Referenced by compare(), and match().

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

Version.

Definition at line 262 of file Edition.cc.

References _pimpl.

Referenced by compare(), match(), and zypp::storage::toXML().

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

Release.

Definition at line 265 of file Edition.cc.

References _pimpl.

Referenced by compare(), match(), and zypp::storage::toXML().

std::string zypp::Edition::asString  )  const
 

String representation of Edition.

Definition at line 268 of file Edition.cc.

References _pimpl, and zypp::str::form().

Referenced by operator<<().

int zypp::Edition::compare const Edition lhs,
const Edition rhs
[static]
 

Compare two Editions returning -1,0,1.

Returns:
-1,0,1 if editions are <,==,>.
Attention:
An empty version or release string is not treated specialy. It's the least possible value. If you want an empty string treated as ANY, use match.

Definition at line 289 of file Edition.cc.

References epoch(), release(), zypp::rpmverscmp(), and version().

Referenced by zypp::NVR::compare(), and compare().

int zypp::Edition::compare const Edition rhs  )  const [inline]
 

Definition at line 134 of file Edition.h.

References compare().

int zypp::Edition::match const Edition lhs,
const Edition rhs
[static]
 

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

Returns:
-1,0,1 if editions match <,==,>.

Definition at line 303 of file Edition.cc.

References epoch(), release(), zypp::rpmverscmp(), and version().

Referenced by match(), and zypp::Edition::Match::operator()().

int zypp::Edition::match const Edition rhs  )  const [inline]
 

Definition at line 155 of file Edition.h.

References match().


Friends And Related Function Documentation

std::ostream & operator<< std::ostream &  str,
const Edition obj
[related]
 

Stream output.

Definition at line 181 of file Edition.h.

References asString().

bool operator== const Edition lhs,
const Edition rhs
[related]
 

Definition at line 187 of file Edition.h.

References zypp::compareByRel(), and zypp::Rel::EQ.

bool operator!= const Edition lhs,
const Edition rhs
[related]
 

Definition at line 191 of file Edition.h.

References zypp::compareByRel(), and zypp::Rel::NE.

bool operator< const Edition lhs,
const Edition rhs
[related]
 

Definition at line 195 of file Edition.h.

References zypp::compareByRel(), and zypp::Rel::LT.

bool operator<= const Edition lhs,
const Edition rhs
[related]
 

Definition at line 199 of file Edition.h.

References zypp::compareByRel(), and zypp::Rel::LE.

bool operator> const Edition lhs,
const Edition rhs
[related]
 

Definition at line 203 of file Edition.h.

References zypp::compareByRel(), and zypp::Rel::GT.

bool operator>= const Edition lhs,
const Edition rhs
[related]
 

Definition at line 207 of file Edition.h.

References zypp::compareByRel(), and zypp::Rel::GE.


Member Data Documentation

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

Value representing noepoch.

Definition at line 75 of file Edition.h.

Referenced by zypp::Edition::Impl::validateE().

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 81 of file Edition.h.

Referenced by zypp::source::yum::YUMSourceImpl::createGroup(), zypp::capability::CapabilityImpl::edition(), zypp::target::rpm::RpmDb::fileList(), zypp::storage::XMLFilesBackend::fileNameForResolvable(), zypp::CapFactory::Impl::isEditionSpec(), zypp::target::rpm::RpmDb::pubkeyEditions(), and zypp::target::rpm::RpmDb::pubkeys().

RW_pointer<Impl> zypp::Edition::_pimpl [private]
 

Pointer to implementation.

Definition at line 174 of file Edition.h.

Referenced by asString(), epoch(), release(), and version().


The documentation for this class was generated from the following files:
Generated on Thu Jul 6 00:07:30 2006 for zypp by  doxygen 1.4.6