libzypp 17.31.23
zypp::sat::SolvableSpec Class Reference

Define a set of Solvables by ident and provides. More...

#include <sat/SolvableSpec.h>

Classes

class  Impl
 SolvableSpec implementation. More...
 

Public Member Functions

 SolvableSpec ()
 Default ctor.
 
 ~SolvableSpec ()
 Dtor.
 
void addIdent (IdString ident_r)
 Add all sat::Solvable with this ident_r.
 
void addProvides (Capability provides_r)
 A all sat::Solvable matching this provides_r.
 
bool addIdenticalInstalledToo () const
 Extend the provides set to include idential installed items as well.
 
void addIdenticalInstalledToo (bool yesno_r)
 
void parse (const C_Str &spec_r)
 Parse and add spec from a string (IDENT or provides:CAPABILITY`).
 
void parseFrom (const InputStream &istr_r)
 Parse file istr_r and add its specs (one per line, #-comments).
 
template<class TIterator >
void parseFrom (TIterator begin, TIterator end)
 Parse and add specs from iterator range.
 
void splitParseFrom (const C_Str &multispec_r)
 Convenience using str::splitEscaped(", \t") to parse multiple specs from one line.
 
bool contains (const sat::Solvable &solv_r) const
 Test whether solv_r matches the spec.
 
template<class Derived >
bool contains (const SolvableType< Derived > &solv_r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool dirty () const
 Whether the cache is needed and dirty.
 
void setDirty () const
 Explicitly flag the cache as dirty, so it will be rebuilt on the next request.
 
bool empty () const
 Whether neither idents nor provides are set.
 
bool containsIdent (const IdString &ident_r) const
 Whether ident_r has been added to the specs (mainly for parser tests).
 
bool containsProvides (const Capability &provides_r) const
 Whether provides_r has been added to the sepcs (mainly for parser tests).
 

Private Attributes

RWCOW_pointer< Impl_pimpl
 Implementation class.
 

Friends

std::ostream & operator<< (std::ostream &str, const SolvableSpec &obj)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const SolvableSpec &obj)
 Stream output.
 

Detailed Description

Define a set of Solvables by ident and provides.

Able to keep the definition of solvable sets like in 'needreboot' or 'multiversion'. The associated file parser allows reading stored definitions (one IDENT or provides:CAPABILITY‘ per line; empty lines and lines starting with ’#' are ignored).

The use of provides requires re-computation of the solvable set, whenever the solvable pool changes. This computation via WhatProvides is expensive, that's why a built in cache is also offered.

Note
contains does not match srcpackage: per default.

Definition at line 44 of file SolvableSpec.h.

Constructor & Destructor Documentation

◆ SolvableSpec()

zypp::sat::SolvableSpec::SolvableSpec ( )

Default ctor.

Definition at line 145 of file SolvableSpec.cc.

◆ ~SolvableSpec()

zypp::sat::SolvableSpec::~SolvableSpec ( )

Dtor.

Definition at line 149 of file SolvableSpec.cc.

Member Function Documentation

◆ addIdent()

void zypp::sat::SolvableSpec::addIdent ( IdString  ident_r)

Add all sat::Solvable with this ident_r.

Definition at line 152 of file SolvableSpec.cc.

◆ addProvides()

void zypp::sat::SolvableSpec::addProvides ( Capability  provides_r)

A all sat::Solvable matching this provides_r.

Definition at line 155 of file SolvableSpec.cc.

◆ addIdenticalInstalledToo() [1/2]

bool zypp::sat::SolvableSpec::addIdenticalInstalledToo ( ) const

Extend the provides set to include idential installed items as well.

Hack for retracted packages, where the indicator provides is injected into the available items, but is not present in the installed items.

Definition at line 158 of file SolvableSpec.cc.

◆ addIdenticalInstalledToo() [2/2]

void zypp::sat::SolvableSpec::addIdenticalInstalledToo ( bool  yesno_r)

Definition at line 160 of file SolvableSpec.cc.

◆ parse()

void zypp::sat::SolvableSpec::parse ( const C_Str spec_r)

Parse and add spec from a string (IDENT or provides:CAPABILITY`).

Definition at line 163 of file SolvableSpec.cc.

◆ parseFrom() [1/2]

void zypp::sat::SolvableSpec::parseFrom ( const InputStream istr_r)

Parse file istr_r and add its specs (one per line, #-comments).

Definition at line 166 of file SolvableSpec.cc.

◆ parseFrom() [2/2]

template<class TIterator >
void zypp::sat::SolvableSpec::parseFrom ( TIterator  begin,
TIterator  end 
)
inline

Parse and add specs from iterator range.

Definition at line 76 of file SolvableSpec.h.

◆ splitParseFrom()

void zypp::sat::SolvableSpec::splitParseFrom ( const C_Str multispec_r)

Convenience using str::splitEscaped(", \t") to parse multiple specs from one line.

Definition at line 176 of file SolvableSpec.cc.

◆ contains() [1/2]

bool zypp::sat::SolvableSpec::contains ( const sat::Solvable solv_r) const

Test whether solv_r matches the spec.

(Re-)builds the WhatProvides cache on demand.

Note
Does not match srcpackage: per default.

Definition at line 183 of file SolvableSpec.cc.

◆ contains() [2/2]

template<class Derived >
bool zypp::sat::SolvableSpec::contains ( const SolvableType< Derived > &  solv_r) 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 91 of file SolvableSpec.h.

◆ dirty()

bool zypp::sat::SolvableSpec::dirty ( ) const

Whether the cache is needed and dirty.

Definition at line 186 of file SolvableSpec.cc.

◆ setDirty()

void zypp::sat::SolvableSpec::setDirty ( ) const

Explicitly flag the cache as dirty, so it will be rebuilt on the next request.

To be called if the ResPool content has changed. Intentionally const as this does not change the set of spects (though the set of matches might change).

Note
This has no effect if no cache is needed (i.e. no provides: are used).

Definition at line 189 of file SolvableSpec.cc.

◆ empty()

bool zypp::sat::SolvableSpec::empty ( ) const

Whether neither idents nor provides are set.

Definition at line 192 of file SolvableSpec.cc.

◆ containsIdent()

bool zypp::sat::SolvableSpec::containsIdent ( const IdString ident_r) const

Whether ident_r has been added to the specs (mainly for parser tests).

Definition at line 195 of file SolvableSpec.cc.

◆ containsProvides()

bool zypp::sat::SolvableSpec::containsProvides ( const Capability provides_r) const

Whether provides_r has been added to the sepcs (mainly for parser tests).

Definition at line 198 of file SolvableSpec.cc.

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  str,
const SolvableSpec obj 
)
friend

Definition at line 201 of file SolvableSpec.cc.

◆ operator<<() [2/2]

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

Stream output.

Definition at line 201 of file SolvableSpec.cc.

Member Data Documentation

◆ _pimpl

RWCOW_pointer<Impl> zypp::sat::SolvableSpec::_pimpl
private

Implementation class.

Pointer to implementation.

Definition at line 117 of file SolvableSpec.h.


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