libzypp  17.25.1
zypp::sat::SolvableSpec Class Reference

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

#include <SolvableSpec.h>

Classes

class  Impl
 SolvableSpec implementation. More...
 

Public Member Functions

 SolvableSpec ()
 Default ctor. More...
 
 ~SolvableSpec ()
 Dtor. More...
 
void addIdent (IdString ident_r)
 Add all sat::Solvable with this ident_r. More...
 
void addProvides (Capability provides_r)
 A all sat::Solvable matching this provides_r. More...
 
void parse (const C_Str &spec_r)
 Parse and add spec from a string (IDENT or provides:CAPABILITY`). More...
 
void parseFrom (const InputStream &istr_r)
 Parse file istr_r and add it's specs (one per line, #-comments). More...
 
template<class TIterator >
void parseFrom (TIterator begin, TIterator end)
 Parse and add specs from iterator range. More...
 
void splitParseFrom (const C_Str &multispec_r)
 Convenience using str::splitEscaped(", \t") to parse multiple specs from one line. More...
 
bool contains (const sat::Solvable &solv_r) const
 Test whether solv_r matches the spec. More...
 
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. More...
 
bool dirty () const
 Whether the cache is needed and dirty. More...
 
void setDirty () const
 Explicitly flag the cache as dirty, so it will be rebuilt on the next request. More...
 
bool containsIdent (const IdString &ident_r) const
 Whether ident_r has been added to the specs (mainly for parser tests). More...
 
bool containsProvides (const Capability &provides_r) const
 Whether provides_r has been added to the sepcs (mainly for parser tests). More...
 

Private Attributes

RWCOW_pointer< Impl_pimpl
 Implementation class. More...
 

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)
 

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 113 of file SolvableSpec.cc.

◆ ~SolvableSpec()

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

Dtor.

Definition at line 117 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 120 of file SolvableSpec.cc.

◆ addProvides()

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

A all sat::Solvable matching this provides_r.

Definition at line 123 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 126 of file SolvableSpec.cc.

◆ parseFrom() [1/2]

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

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

Definition at line 129 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 69 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 139 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 146 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 84 of file SolvableSpec.h.

◆ dirty()

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

Whether the cache is needed and dirty.

Definition at line 149 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 152 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 155 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 158 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 161 of file SolvableSpec.cc.

◆ operator<<() [2/2]

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

Stream output

Definition at line 161 of file SolvableSpec.cc.

Member Data Documentation

◆ _pimpl

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

Implementation class.

Pointer to implementation.

Definition at line 105 of file SolvableSpec.h.


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