libzypp 17.37.10

zypp::Capability Class Reference

A sat capability. More...

`#include <zypp/Capability.h>`

Inheritance diagram for zypp::Capability:

## 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.
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)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| 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())
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| 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())
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
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())
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| 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.
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())
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| 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.
| 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.
| 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.
| 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.

## Related Symbols
(Note that these are not member symbols.)
std::ostream & | operator<< (std::ostream &str, const Capability &obj) ZYPP_API
| Stream output.
std::ostream & | dumpOn (std::ostream &str, const Capability &obj) ZYPP_API
| Detailed stream output.
bool | operator== (const Capability &lhs, const Capability &rhs)
bool | operator!= (const Capability &lhs, const Capability &rhs)
bool | operator< (const Capability &lhs, const Capability &rhs)
| Arbitrary order.

## Ctor creating a namespace: capability.
An empty value_r (std::string or IdString) will also be mapped to IdString::Null, creating a namespace: capability which in most contexts matches all members of this namespace.
static const Capability | Null
| No or Null Capability ( Id `0` ).
static const Capability | Empty
| Empty Capability.
| Capability (ResolverNamespace namespace_r, IdString value_r=IdString::Null)
| Capability (ResolverNamespace namespace_r, const char *value_r)
| Capability (ResolverNamespace namespace_r, const std::string &value_r)
| operator bool () const
| Evaluate in a boolean context ( !
bool | empty () const
| Whether the Capability is empty.
const char * | c_str () const
| Conversion to const char *
std::string | asString () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CapDetail | detail () const
| Helper providing more detailed information about a Capability.

## 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. See also Edition::match. If a capability expression is involved, matches returns CapMatch::irrelevant.
sat::detail::IdType | _id
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
sat::detail::IdType | id () const
| Expert backdoor.
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)
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 CapMatch | _doMatch (sat::detail::IdType lhs, sat::detail::IdType rhs)
| Match two Capabilities.

## Additional Inherited Members
Static Protected Member Functions inherited from zypp::sat::detail::PoolMember
static PoolImpl & | myPool ()

## Detailed Description

A sat capability.

A Capability: "name[.arch] [op edition]" or a `richdep`[1]

If a certain ResKind is specified upon construction, the capabilities name part is prefixed, unless it already contains 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'
zypp::Capability::Capability
Capability()
Default ctor, Empty capability.
Definition Capability.h:69
zypp::ResKind::pattern
static const ResKind pattern
Definition ResKind.h:42
zypp::ResKind::package
static const ResKind package
Definition ResKind.h:40

[1] https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html

See also
  CapDetail

Definition at line 62 of file Capability.h.

## Member Enumeration Documentation

## ◆ CtorFlag

enum zypp::Capability::CtorFlag

Enumerator
PARSED |
UNPARSED |

Definition at line 65 of file Capability.h.

## Constructor & Destructor Documentation

## ◆ Capability() [1/22]

zypp::Capability::Capability | ( |  | ) |
| inline

Default ctor, Empty capability.

Definition at line 69 of file Capability.h.

## ◆ Capability() [2/22]

zypp::Capability::Capability | ( | sat::detail::IdType | id_r | ) |
| inline explicit

Ctor from id.

Definition at line 72 of file Capability.h.

## ◆ Capability() [3/22]

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 see if it forms a richdep. Subsequent arguments are meaningless in that case. If it's no richdep we continue as described below.

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.

Capability legacy is to parse everything unknown into a NAMED cap. This is often used to turn user supplied search strings with an optional edition range restriction into PoolQuery arguments ('/gcc[0-9]+/ >= 8').

Definition at line 260 of file Capability.cc.

## ◆ Capability() [4/22]

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 264 of file Capability.cc.

## ◆ Capability() [5/22]

zypp::Capability::Capability | ( | const Arch & | arch_r,
|  | const char * | str_r,
|  | const ResKind & | prefix_r = ResKind(),
|  | CtorFlag | flag_r = UNPARSED )

Definition at line 268 of file Capability.cc.

## ◆ Capability() [6/22]

zypp::Capability::Capability | ( | const Arch & | arch_r,
|  | const std::string & | str_r,
|  | const ResKind & | prefix_r = ResKind(),
|  | CtorFlag | flag_r = UNPARSED )

Definition at line 272 of file Capability.cc.

## ◆ Capability() [7/22]

zypp::Capability::Capability | ( | const char * | str_r,
|  | CtorFlag | flag_r,
|  | const ResKind & | prefix_r = ResKind() )

Definition at line 276 of file Capability.cc.

## ◆ Capability() [8/22]

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 280 of file Capability.cc.

## ◆ Capability() [9/22]

zypp::Capability::Capability | ( | const Arch & | arch_r,
|  | const char * | str_r,
|  | CtorFlag | flag_r,
|  | const ResKind & | prefix_r = ResKind() )

Definition at line 284 of file Capability.cc.

## ◆ Capability() [10/22]

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 288 of file Capability.cc.

## ◆ Capability() [11/22]

zypp::Capability::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.

Definition at line 296 of file Capability.cc.

## ◆ Capability() [12/22]

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 299 of file Capability.cc.

## ◆ Capability() [13/22]

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 302 of file Capability.cc.

## ◆ Capability() [14/22]

zypp::Capability::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.

Definition at line 310 of file Capability.cc.

## ◆ Capability() [15/22]

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 313 of file Capability.cc.

## ◆ Capability() [16/22]

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 316 of file Capability.cc.

## ◆ Capability() [17/22]

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 319 of file Capability.cc.

## ◆ Capability() [18/22]

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 322 of file Capability.cc.

## ◆ Capability() [19/22]

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 325 of file Capability.cc.

## ◆ Capability() [20/22]

zypp::Capability::Capability | ( | ResolverNamespace | namespace_r,
|  | IdString | value_r = IdString::Null )

Definition at line 333 of file Capability.cc.

## ◆ Capability() [21/22]

zypp::Capability::Capability | ( | ResolverNamespace | namespace_r,
|  | const char * | value_r )
| inline

Definition at line 142 of file Capability.h.

## ◆ Capability() [22/22]

zypp::Capability::Capability | ( | ResolverNamespace | namespace_r,
|  | const std::string & | value_r )
| inline

Definition at line 143 of file Capability.h.

## Member Function Documentation

## ◆ operator bool()

zypp::Capability::operator bool | ( |  | ) | const
| inline explicit

Evaluate in a boolean context ( !

empty() ).

Definition at line 154 of file Capability.h.

## ◆ empty()

bool zypp::Capability::empty | ( |  | ) | const
| inline

Whether the Capability is empty.

This is true for Null and Empty.

Definition at line 160 of file Capability.h.

## ◆ c_str()

const char * zypp::Capability::c_str | ( |  | ) | const

Conversion to const char *

Definition at line 438 of file Capability.cc.

## ◆ 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 168 of file Capability.h.

## ◆ detail()

CapDetail zypp::Capability::detail | ( |  | ) | const
| inline

Helper providing more detailed information about a Capability.

Definition at line 397 of file Capability.h.

## ◆ matches() [1/20]

CapMatch zypp::Capability::matches | ( | const Capability & | lhs,
|  | const Capability & | rhs )
| inline static

Definition at line 186 of file Capability.h.

## ◆ matches() [2/20]

CapMatch zypp::Capability::matches | ( | const Capability & | lhs,
|  | const IdString & | rhs )
| inline static

Definition at line 187 of file Capability.h.

## ◆ matches() [3/20]

CapMatch zypp::Capability::matches | ( | const Capability & | lhs,
|  | const std::string & | rhs )
| inline static

Definition at line 188 of file Capability.h.

## ◆ matches() [4/20]

CapMatch zypp::Capability::matches | ( | const Capability & | lhs,
|  | const char * | rhs )
| inline static

Definition at line 189 of file Capability.h.

## ◆ matches() [5/20]

CapMatch zypp::Capability::matches | ( | const IdString & | lhs,
|  | const Capability & | rhs )
| inline static

Definition at line 191 of file Capability.h.

## ◆ matches() [6/20]

CapMatch zypp::Capability::matches | ( | const IdString & | lhs,
|  | const IdString & | rhs )
| inline static

Definition at line 192 of file Capability.h.

## ◆ matches() [7/20]

CapMatch zypp::Capability::matches | ( | const IdString & | lhs,
|  | const std::string & | rhs )
| inline static

Definition at line 193 of file Capability.h.

## ◆ matches() [8/20]

CapMatch zypp::Capability::matches | ( | const IdString & | lhs,
|  | const char * | rhs )
| inline static

Definition at line 194 of file Capability.h.

## ◆ matches() [9/20]

CapMatch zypp::Capability::matches | ( | const std::string & | lhs,
|  | const Capability & | rhs )
| inline static

Definition at line 196 of file Capability.h.

## ◆ matches() [10/20]

CapMatch zypp::Capability::matches | ( | const std::string & | lhs,
|  | const IdString & | rhs )
| inline static

Definition at line 197 of file Capability.h.

## ◆ matches() [11/20]

CapMatch zypp::Capability::matches | ( | const std::string & | lhs,
|  | const std::string & | rhs )
| inline static

Definition at line 198 of file Capability.h.

## ◆ matches() [12/20]

CapMatch zypp::Capability::matches | ( | const std::string & | lhs,
|  | const char * | rhs )
| inline static

Definition at line 199 of file Capability.h.

## ◆ matches() [13/20]

CapMatch zypp::Capability::matches | ( | const char * | lhs,
|  | const Capability & | rhs )
| inline static

Definition at line 201 of file Capability.h.

## ◆ matches() [14/20]

CapMatch zypp::Capability::matches | ( | const char * | lhs,
|  | const IdString & | rhs )
| inline static

Definition at line 202 of file Capability.h.

## ◆ matches() [15/20]

CapMatch zypp::Capability::matches | ( | const char * | lhs,
|  | const std::string & | rhs )
| inline static

Definition at line 203 of file Capability.h.

## ◆ matches() [16/20]

CapMatch zypp::Capability::matches | ( | const char * | lhs,
|  | const char * | rhs )
| inline static

Definition at line 204 of file Capability.h.

## ◆ matches() [17/20]

CapMatch zypp::Capability::matches | ( | const Capability & | rhs | ) | const
| inline

Definition at line 206 of file Capability.h.

## ◆ matches() [18/20]

CapMatch zypp::Capability::matches | ( | const IdString & | rhs | ) | const
| inline

Definition at line 207 of file Capability.h.

## ◆ matches() [19/20]

CapMatch zypp::Capability::matches | ( | const std::string & | rhs | ) | const
| inline

Definition at line 208 of file Capability.h.

## ◆ matches() [20/20]

CapMatch zypp::Capability::matches | ( | const char * | rhs | ) | const
| inline

Definition at line 209 of file Capability.h.

## ◆ isInterestingFileSpec() [1/3]

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 226 of file Capability.h.

## ◆ isInterestingFileSpec() [2/3]

bool zypp::Capability::isInterestingFileSpec | ( | const std::string & | name_r | ) |
| inline static

Definition at line 227 of file Capability.h.

## ◆ isInterestingFileSpec() [3/3]

bool zypp::Capability::isInterestingFileSpec | ( | const char * | name_r | ) |
| static

Definition at line 501 of file Capability.cc.

## ◆ guessPackageSpec() [1/2]

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.

Note
  : As this method will access the global pool, the returned result depends on the pools content.

Definition at line 564 of file Capability.cc.

## ◆ guessPackageSpec() [2/2]

Capability zypp::Capability::guessPackageSpec | ( | const std::string & | str_r,
|  | bool & | rewrote_r )
| static

Definition at line 511 of file Capability.cc.

## ◆ id()

sat::detail::IdType zypp::Capability::id | ( |  | ) | const
| inline

Expert backdoor.

Definition at line 263 of file Capability.h.

## ◆ _doMatch()

CapMatch zypp::Capability::_doMatch | ( | sat::detail::IdType | lhs,
|  | sat::detail::IdType | rhs )
| static private

Match two Capabilities.

Definition at line 450 of file Capability.cc.

## Friends And Related Symbol Documentation

## ◆ operator<<()

std::ostream & operator<< | ( | std::ostream & | str,
|  | const Capability & | obj )
| related

Stream output.

Definition at line 575 of file Capability.cc.

## ◆ dumpOn()

std::ostream & dumpOn | ( | std::ostream & | str,
|  | const Capability & | obj )
| related

Detailed stream output.

Definition at line 580 of file Capability.cc.

## ◆ operator==()

bool operator== | ( | const Capability & | lhs,
|  | const Capability & | rhs )
| related

Definition at line 280 of file Capability.h.

## ◆ operator!=()

bool operator!= | ( | const Capability & | lhs,
|  | const Capability & | rhs )
| related

Definition at line 284 of file Capability.h.

## ◆ operator<()

bool operator< | ( | const Capability & | lhs,
|  | const Capability & | rhs )
| related

Arbitrary order.

Definition at line 288 of file Capability.h.

## Member Data Documentation

## ◆ Null

const Capability zypp::Capability::Null
| static

No or Null Capability ( Id `0` ).

Definition at line 147 of file Capability.h.

## ◆ Empty

const Capability zypp::Capability::Empty
| static

Empty Capability.

Definition at line 150 of file Capability.h.

## ◆ _id

sat::detail::IdType zypp::Capability::_id
| private

Definition at line 269 of file Capability.h.

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

- zypp/Capability.h
- zypp/Capability.cc