#include <Capability.h>
Classes | |
struct | Matches |
matches functor. More... | |
Public Types | |
enum | CtorFlag { PARSED, UNPARSED } |
Public Member Functions | |
Capability () | |
Default ctor, Empty capability. | |
Capability (sat::detail::IdType id_r) | |
Ctor from id. | |
bool | empty () const |
Whether the Capability is empty. | |
const char * | c_str () const |
Conversion to const char * . | |
std::string | asString () const |
CapDetail | detail () const |
Helper providing more detailed information about a Capability. | |
sat::detail::IdType | id () const |
Expert backdoor. | |
Ctors parsing a Capability: <tt>"name[.arch] [op edition]"</tt> or <tt>( arch, "name [op edition]")</tt> | |
Capability (const char *str_r, const ResKind &prefix_r=ResKind(), CtorFlag flag_r=UNPARSED) | |
Ctor from string. | |
Capability (const std::string &str_r, const ResKind &prefix_r=ResKind(), CtorFlag flag_r=UNPARSED) | |
Capability (const Arch &arch_r, const char *str_r, const ResKind &prefix_r=ResKind(), CtorFlag flag_r=UNPARSED) | |
Capability (const Arch &arch_r, const std::string &str_r, const ResKind &prefix_r=ResKind(), CtorFlag flag_r=UNPARSED) | |
Capability (const char *str_r, CtorFlag flag_r, const ResKind &prefix_r=ResKind()) | |
Capability (const std::string &str_r, CtorFlag flag_r, const ResKind &prefix_r=ResKind()) | |
Capability (const Arch &arch_r, const char *str_r, CtorFlag flag_r, const ResKind &prefix_r=ResKind()) | |
Capability (const Arch &arch_r, const std::string &str_r, CtorFlag flag_r, const ResKind &prefix_r=ResKind()) | |
Ctors parsing a broken down Capability: <tt>( "name[.arch]", op, edition )</tt> | |
Capability (const std::string &name_r, const std::string &op_r, const std::string &ed_r, const ResKind &prefix_r=ResKind()) | |
Ctor from name[.arch] op edition . | |
Capability (const std::string &name_r, Rel op_r, const std::string &ed_r, const ResKind &prefix_r=ResKind()) | |
Capability (const std::string &name_r, Rel op_r, const Edition &ed_r, const ResKind &prefix_r=ResKind()) | |
Ctors taking a broken down Capability: <tt>( arch, name, op, edition )</tt> | |
Capability (const std::string &arch_r, const std::string &name_r, const std::string &op_r, const std::string &ed_r, const ResKind &prefix_r=ResKind()) | |
Ctor from arch name op edition . | |
Capability (const std::string &arch_r, const std::string &name_r, Rel op_r, const std::string &ed_r, const ResKind &prefix_r=ResKind()) | |
Capability (const std::string &arch_r, const std::string &name_r, Rel op_r, const Edition &ed_r, const ResKind &prefix_r=ResKind()) | |
Capability (const Arch &arch_r, const std::string &name_r, const std::string &op_r, const std::string &ed_r, const ResKind &prefix_r=ResKind()) | |
Capability (const Arch &arch_r, const std::string &name_r, Rel op_r, const std::string &ed_r, const ResKind &prefix_r=ResKind()) | |
Capability (const Arch &arch_r, const std::string &name_r, Rel op_r, const Edition &ed_r, const ResKind &prefix_r=ResKind()) | |
Static Public Member Functions | |
static bool | isInterestingFileSpec (const IdString &name_r) |
Test for a filename that is likely being REQUIRED. | |
static bool | isInterestingFileSpec (const std::string &name_r) |
static bool | isInterestingFileSpec (const char *name_r) |
static Capability | guessPackageSpec (const std::string &str_r) |
Capability parser also guessing "libzypp-1.2.3-4.5.x86_64" formats. | |
static Capability | guessPackageSpec (const std::string &str_r, bool &rewrote_r) |
Static Public Attributes | |
static const Capability | Null |
No or Null Capability ( Id 0 ). | |
static const Capability | Empty |
Empty Capability. | |
Private Member Functions | |
friend | base::SafeBool () const |
bool | boolTest () const |
Static Private Member Functions | |
static CapMatch | _doMatch (sat::detail::IdType lhs, sat::detail::IdType rhs) |
Match two Capabilities. | |
Private Attributes | |
sat::detail::IdType | _id |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &str, const Capability &obj) |
std::ostream & | dumpOn (std::ostream &str, const Capability &obj) |
bool | operator== (const Capability &lhs, const Capability &rhs) |
bool | operator!= (const Capability &lhs, const Capability &rhs) |
bool | operator< (const Capability &lhs, const Capability &rhs) |
Match two simple capabilities. | |
Two simple capabilities match if they have the same name and their edition ranges overlap.Where no edition matches ANY edition.
| |
CapMatch | matches (const Capability &rhs) const |
CapMatch | matches (const IdString &rhs) const |
CapMatch | matches (const std::string &rhs) const |
CapMatch | matches (const char *rhs) const |
static CapMatch | matches (const Capability &lhs, const Capability &rhs) |
static CapMatch | matches (const Capability &lhs, const IdString &rhs) |
static CapMatch | matches (const Capability &lhs, const std::string &rhs) |
static CapMatch | matches (const Capability &lhs, const char *rhs) |
static CapMatch | matches (const IdString &lhs, const Capability &rhs) |
static CapMatch | matches (const IdString &lhs, const IdString &rhs) |
static CapMatch | matches (const IdString &lhs, const std::string &rhs) |
static CapMatch | matches (const IdString &lhs, const char *rhs) |
static CapMatch | matches (const std::string &lhs, const Capability &rhs) |
static CapMatch | matches (const std::string &lhs, const IdString &rhs) |
static CapMatch | matches (const std::string &lhs, const std::string &rhs) |
static CapMatch | matches (const std::string &lhs, const char *rhs) |
static CapMatch | matches (const char *lhs, const Capability &rhs) |
static CapMatch | matches (const char *lhs, const IdString &rhs) |
static CapMatch | matches (const char *lhs, const std::string &rhs) |
static CapMatch | matches (const char *lhs, const char *rhs) |
A Capability: "name[.arch] [op edition]"
If a certain ResKind is specified upon construction, the capabilities name part is prefixed, unless it already conatins a well known kind spec. If no ResKind is specified, it's assumed you refer to a package or the name is already prefixed:
Capability( "foo" ) ==> 'foo' Capability( "foo", ResKind::package ) ==> 'foo' Capability( "foo", ResKind::pattern ) ==> 'pattern:foo' Capability( "pattern:foo" ) ==> 'pattern:foo' // in doubt an explicit name prefix wins: Capability( "pattern:foo", ResKind::package ) ==> 'pattern:foo' Capability( "package:foo", ResKind::pattern ) ==> 'foo'
Definition at line 61 of file Capability.h.
zypp::Capability::Capability | ( | ) | [inline] |
Default ctor, Empty capability.
Definition at line 69 of file Capability.h.
Referenced by guessPackageSpec(), and matches().
zypp::Capability::Capability | ( | sat::detail::IdType | id_r | ) | [inline, explicit] |
zypp::Capability::Capability | ( | const char * | str_r, | |
const ResKind & | prefix_r = ResKind() , |
|||
CtorFlag | flag_r = UNPARSED | |||
) | [explicit] |
Ctor from string.
str_r is parsed to check whether it contains an [op edition]
part, unless the PARSED flag is passed to the ctor. In that case "name[.arch]"
is assumed.
Definition at line 233 of file Capability.cc.
zypp::Capability::Capability | ( | const std::string & | str_r, | |
const ResKind & | prefix_r = ResKind() , |
|||
CtorFlag | flag_r = UNPARSED | |||
) | [explicit] |
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 237 of file Capability.cc.
zypp::Capability::Capability | ( | const Arch & | arch_r, | |
const char * | str_r, | |||
const ResKind & | prefix_r = ResKind() , |
|||
CtorFlag | flag_r = UNPARSED | |||
) |
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 241 of file Capability.cc.
zypp::Capability::Capability | ( | const Arch & | arch_r, | |
const std::string & | str_r, | |||
const ResKind & | prefix_r = ResKind() , |
|||
CtorFlag | flag_r = UNPARSED | |||
) |
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 245 of file Capability.cc.
zypp::Capability::Capability | ( | const char * | str_r, | |
CtorFlag | flag_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 249 of file Capability.cc.
zypp::Capability::Capability | ( | const std::string & | str_r, | |
CtorFlag | flag_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 253 of file Capability.cc.
zypp::Capability::Capability | ( | const Arch & | arch_r, | |
const char * | str_r, | |||
CtorFlag | flag_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 257 of file Capability.cc.
zypp::Capability::Capability | ( | const Arch & | arch_r, | |
const std::string & | str_r, | |||
CtorFlag | flag_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 261 of file Capability.cc.
zypp::Capability::Capability | ( | const std::string & | name_r, | |
Rel | op_r, | |||
const std::string & | ed_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 272 of file Capability.cc.
zypp::Capability::Capability | ( | const std::string & | name_r, | |
Rel | op_r, | |||
const Edition & | ed_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 275 of file Capability.cc.
zypp::Capability::Capability | ( | const std::string & | arch_r, | |
const std::string & | name_r, | |||
Rel | op_r, | |||
const std::string & | ed_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 286 of file Capability.cc.
zypp::Capability::Capability | ( | const std::string & | arch_r, | |
const std::string & | name_r, | |||
Rel | op_r, | |||
const Edition & | ed_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 289 of file Capability.cc.
zypp::Capability::Capability | ( | const Arch & | arch_r, | |
const std::string & | name_r, | |||
const std::string & | op_r, | |||
const std::string & | ed_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 292 of file Capability.cc.
zypp::Capability::Capability | ( | const Arch & | arch_r, | |
const std::string & | name_r, | |||
Rel | op_r, | |||
const std::string & | ed_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 295 of file Capability.cc.
zypp::Capability::Capability | ( | const Arch & | arch_r, | |
const std::string & | name_r, | |||
Rel | op_r, | |||
const Edition & | ed_r, | |||
const ResKind & | prefix_r = ResKind() | |||
) |
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 298 of file Capability.cc.
bool zypp::Capability::empty | ( | ) | const [inline] |
Whether the Capability is empty.
This is true for Null and Empty.
Definition at line 144 of file Capability.h.
References _id, zypp::sat::detail::emptyId(), and zypp::sat::detail::noId().
Referenced by boolTest().
const char * zypp::Capability::c_str | ( | ) | const |
Conversion to const char *
.
Definition at line 302 of file Capability.cc.
References _id, and zypp::sat::detail::PoolMember::myPool().
Referenced by asString().
std::string zypp::Capability::asString | ( | ) | const [inline] |
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 152 of file Capability.h.
References c_str().
Referenced by zypp::solver::detail::Helper::capToString(), and zypp::solver::detail::helixXML().
CapDetail zypp::Capability::detail | ( | ) | const [inline] |
Helper providing more detailed information about a Capability.
Definition at line 378 of file Capability.h.
References _id.
Referenced by zypp::dumpOn(), guessPackageSpec(), zypp::solver::detail::helixXML(), and zypp::operator<<().
static CapMatch zypp::Capability::matches | ( | const Capability & | lhs, | |
const Capability & | rhs | |||
) | [inline, static] |
Definition at line 170 of file Capability.h.
References _doMatch(), and id().
Referenced by zypp::Capability::Matches::operator()().
static CapMatch zypp::Capability::matches | ( | const Capability & | lhs, | |
const IdString & | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const Capability & | lhs, | |
const std::string & | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const Capability & | lhs, | |
const char * | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const IdString & | lhs, | |
const Capability & | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const IdString & | lhs, | |
const std::string & | rhs | |||
) | [inline, static] |
Definition at line 177 of file Capability.h.
References _doMatch(), Capability(), and zypp::IdString::id().
static CapMatch zypp::Capability::matches | ( | const IdString & | lhs, | |
const char * | rhs | |||
) | [inline, static] |
Definition at line 178 of file Capability.h.
References _doMatch(), Capability(), and zypp::IdString::id().
static CapMatch zypp::Capability::matches | ( | const std::string & | lhs, | |
const Capability & | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const std::string & | lhs, | |
const IdString & | rhs | |||
) | [inline, static] |
Definition at line 181 of file Capability.h.
References _doMatch(), Capability(), and zypp::IdString::id().
static CapMatch zypp::Capability::matches | ( | const std::string & | lhs, | |
const std::string & | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const std::string & | lhs, | |
const char * | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const char * | lhs, | |
const Capability & | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const char * | lhs, | |
const IdString & | rhs | |||
) | [inline, static] |
Definition at line 186 of file Capability.h.
References _doMatch(), Capability(), and zypp::IdString::id().
static CapMatch zypp::Capability::matches | ( | const char * | lhs, | |
const std::string & | rhs | |||
) | [inline, static] |
static CapMatch zypp::Capability::matches | ( | const char * | lhs, | |
const char * | rhs | |||
) | [inline, static] |
CapMatch zypp::Capability::matches | ( | const Capability & | rhs | ) | const [inline] |
CapMatch zypp::Capability::matches | ( | const std::string & | rhs | ) | const [inline] |
CapMatch zypp::Capability::matches | ( | const char * | rhs | ) | const [inline] |
static bool zypp::Capability::isInterestingFileSpec | ( | const IdString & | name_r | ) | [inline, static] |
Test for a filename that is likely being REQUIRED.
Files below /bin
, /sbin
, /lib
etc. Scanning a packages filelist, an interesting filename might be worth being remembered in PROVIDES.
Definition at line 210 of file Capability.h.
References zypp::IdString::c_str(), and isInterestingFileSpec().
Referenced by isInterestingFileSpec().
static bool zypp::Capability::isInterestingFileSpec | ( | const std::string & | name_r | ) | [inline, static] |
Definition at line 211 of file Capability.h.
References isInterestingFileSpec().
Referenced by isInterestingFileSpec().
bool zypp::Capability::isInterestingFileSpec | ( | const char * | name_r | ) | [static] |
Definition at line 358 of file Capability.cc.
References zypp::str::regex::nosubs, zypp::str::regex::optimize, and zypp::str::regex_match().
Capability zypp::Capability::guessPackageSpec | ( | const std::string & | str_r | ) | [static] |
Capability parser also guessing "libzypp-1.2.3-4.5.x86_64"
formats.
The argument might be in the form "libzypp-devel-1.2.3.x86_64"
. Passed to the Capability ctor, this would correctly be parsed as name capability, because actually the edition part had to be separated by a '='
, and the architecture had to be appended to the name. So this is how it actually had to look like: "libzypp-devel.x86_64=1.2.3"
Obviously we have to guess if, and where to split name and edition. In fact "devel"
could also be the version and "1.2.3"
would be the release then.
Assuming this Capability should be provided by some package in the ResPool, we check this. If unprovided, we substitute the last, (or one but last) '-'
by a '='
. If the name part (without version) of the resulting Capability matches a package name (not provides!) in the ResPool, this Capability is returned.
Otherwise we return the Capability originally created from str_r.
Definition at line 419 of file Capability.cc.
Capability zypp::Capability::guessPackageSpec | ( | const std::string & | str_r, | |
bool & | rewrote_r | |||
) | [static] |
Definition at line 368 of file Capability.cc.
References zypp::CapDetail::arch(), zypp::IdString::asString(), zypp::ResPool::byIdentBegin(), zypp::ResPool::byIdentEnd(), zypp::IdString::c_str(), Capability(), detail(), zypp::ResPool::instance(), zypp::CapDetail::isNamed(), and zypp::CapDetail::name().
sat::detail::IdType zypp::Capability::id | ( | ) | const [inline] |
Expert backdoor.
Definition at line 247 of file Capability.h.
References _id.
Referenced by zypp::sat::detail::_getLocaleDeps(), zypp::solver::detail::helixXML(), matches(), operator!=(), operator<(), operator==(), and zypp::sat::detail::PoolImpl::whatProvides().
CapMatch zypp::Capability::_doMatch | ( | sat::detail::IdType | lhs, | |
sat::detail::IdType | rhs | |||
) | [static, private] |
Match two Capabilities.
Definition at line 305 of file Capability.cc.
References zypp::CapDetail::arch(), zypp::CapDetail::ed(), zypp::IdString::empty(), zypp::CapDetail::EXPRESSION, zypp::CapMatch::irrelevant, zypp::CapDetail::isNamed(), zypp::CapDetail::kind(), zypp::CapDetail::name(), zypp::CapDetail::NAMED, zypp::CapMatch::no, zypp::CapDetail::NOCAP, zypp::CapDetail::op(), zypp::overlaps(), zypp::CapDetail::VERSIONED, and zypp::CapMatch::yes.
Referenced by matches().
zypp::Capability::base::SafeBool | ( | ) | const [private] |
bool zypp::Capability::boolTest | ( | ) | const [inline, private] |
std::ostream & operator<< | ( | std::ostream & | str, | |
const Capability & | obj | |||
) | [related] |
Stream output
Definition at line 430 of file Capability.cc.
std::ostream & dumpOn | ( | std::ostream & | str, | |
const Capability & | obj | |||
) | [related] |
Detailed stream output
Definition at line 435 of file Capability.cc.
bool operator== | ( | const Capability & | lhs, | |
const Capability & | rhs | |||
) | [related] |
bool operator!= | ( | const Capability & | lhs, | |
const Capability & | rhs | |||
) | [related] |
bool operator< | ( | const Capability & | lhs, | |
const Capability & | rhs | |||
) | [related] |
const Capability zypp::Capability::Null [static] |
No or Null Capability ( Id 0
).
Definition at line 131 of file Capability.h.
Referenced by zypp::Capabilities::const_iterator::dereference(), zypp::CapDetail::lhs(), and zypp::CapDetail::rhs().
const Capability zypp::Capability::Empty [static] |
sat::detail::IdType zypp::Capability::_id [private] |