libzypp 17.38.7
zypp::PoolQueryResult Class Reference

Helper class to collect (not only) PoolQuery results. More...

#include <zypp/PoolQueryResult.h>

Inheritance diagram for zypp::PoolQueryResult:
zypp::sat::SolvIterMixin< PoolQueryResult, std::unordered_set< sat::Solvable >::const_iterator >

Public Types

using ResultSet = std::unordered_set<sat::Solvable>
using size_type = ResultSet::size_type
using const_iterator = ResultSet::const_iterator
Public Types inherited from zypp::sat::SolvIterMixin< PoolQueryResult, std::unordered_set< sat::Solvable >::const_iterator >
using size_type
using Solvable_iterator
using PoolItem_iterator
using Selectable_iterator

Public Member Functions

 PoolQueryResult ()
 Default ctor (empty result).
 PoolQueryResult (sat::Solvable result_r)
 Ctor adding one sat::Solvable.
 PoolQueryResult (const PoolItem &result_r)
 Ctor adding one PoolItem.
 PoolQueryResult (const PoolQuery &query_r)
 Ctor adding one PoolQuery result.
template<class TQueryResultIter>
 PoolQueryResult (TQueryResultIter begin_r, TQueryResultIter end_r)
 Ctor adding a range of items for which operator+= is defined.
bool empty () const
 Whether the result is empty.
size_type size () const
 The number of sat::Solvables.
const_iterator begin () const
const_iterator end () const
bool contains (sat::Solvable result_r) const
 Test whether some item is in the result set.
bool contains (const PoolItem &result_r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void clear ()
 Clear the result.
PoolQueryResultoperator+= (const PoolQueryResult &query_r)
 Add items to the result.
PoolQueryResultoperator+= (const PoolQuery &query_r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResultoperator+= (sat::Solvable result_r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResultoperator+= (const PoolItem &result_r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResultoperator-= (const PoolQueryResult &query_r)
 Remove Items from the result.
PoolQueryResultoperator-= (const PoolQuery &query_r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResultoperator-= (sat::Solvable result_r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResultoperator-= (const PoolItem &result_r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResult operator+ (const PoolQueryResult &query_r) const
 Combine results.
PoolQueryResult operator+ (const PoolQuery &query_r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResult operator+ (sat::Solvable result_r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResult operator- (const PoolQueryResult &query_r) const
 Intersect results.
PoolQueryResult operator- (const PoolQuery &query_r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
PoolQueryResult operator- (sat::Solvable result_r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Public Member Functions inherited from zypp::sat::SolvIterMixin< PoolQueryResult, std::unordered_set< sat::Solvable >::const_iterator >
bool empty () const
 Whether the collection is epmty.
size_type size () const
 Size of the collection.
bool contains (const TSolv &solv_r) const
 Whether collection contains a specific Solvable.
Solvable_iterator solvableBegin () const
Solvable_iterator solvableEnd () const
Iterable< Solvable_iteratorsolvable () const
PoolItem_iterator poolItemBegin () const
PoolItem_iterator poolItemEnd () const
Iterable< PoolItem_iteratorpoolItem () const
Selectable_iterator selectableBegin () const
Selectable_iterator selectableEnd () const
Iterable< Selectable_iteratorselectable () const

Private Attributes

ResultSet _result

Additional Inherited Members

 SolvIterMixin ()
 ~SolvIterMixin ()
SolvIterMixinoperator= (const SolvIterMixin &)=default

Detailed Description

Helper class to collect (not only) PoolQuery results.

Note
Unfortunately PoolQuery::begin might throw. Exceptions are caught and the query is treated as empty.

PoolQueryResult maintains a set of sat::Solvable. You can add/remove solvables to/from the set defined by:

The class is a sat::SolvIterMixin, so you can iterate the result not just as sat::Solvable, but also as PoolItem or ui::Selectable.

// Constructed from PoolItem iterator pair
PoolQueryResult result( pool.byKindBegin<Package>(), pool.byKindEnd<Package>() );
MIL << result.size() << endl;
{
// Removing a PoolQuery result
q.addAttribute( sat::SolvAttr::name, "[a-zA-Z]*" );
result -= q;
MIL << result.size() << endl;
}
MIL << result << endl;
// Removing a range of sat::Solvables
sat::WhatProvides poviders( Capability("3ddiag") );
result -= PoolQueryResult( poviders.begin(), poviders.end() );
// packages not starting with a letter, except 3ddiag
MIL << result << endl;
#define MIL
Definition Logger.h:103
A sat capability.
Definition Capability.h:63
Package interface.
Definition Package.h:34
PoolQueryResult()
Default ctor (empty result).
Meta-data query API.
Definition PoolQuery.h:91
void addAttribute(const sat::SolvAttr &attr, const std::string &value="")
Filter by the value of the specified attr attribute.
Definition PoolQuery.cc:885
void setMatchGlob()
Set to match globs.
Definition PoolQuery.cc:966
static const SolvAttr name
Definition SolvAttr.h:52
Container of Solvable providing a Capability (read only).

Definition at line 75 of file PoolQueryResult.h.

Member Typedef Documentation

◆ ResultSet

using zypp::PoolQueryResult::ResultSet = std::unordered_set<sat::Solvable>

Definition at line 78 of file PoolQueryResult.h.

◆ size_type

using zypp::PoolQueryResult::size_type = ResultSet::size_type

Definition at line 79 of file PoolQueryResult.h.

◆ const_iterator

using zypp::PoolQueryResult::const_iterator = ResultSet::const_iterator

Definition at line 80 of file PoolQueryResult.h.

Constructor & Destructor Documentation

◆ PoolQueryResult() [1/5]

zypp::PoolQueryResult::PoolQueryResult ( )
inline

Default ctor (empty result).

Definition at line 84 of file PoolQueryResult.h.

◆ PoolQueryResult() [2/5]

zypp::PoolQueryResult::PoolQueryResult ( sat::Solvable result_r)
inlineexplicit

Ctor adding one sat::Solvable.

Definition at line 88 of file PoolQueryResult.h.

◆ PoolQueryResult() [3/5]

zypp::PoolQueryResult::PoolQueryResult ( const PoolItem & result_r)
inlineexplicit

Ctor adding one PoolItem.

Definition at line 92 of file PoolQueryResult.h.

◆ PoolQueryResult() [4/5]

zypp::PoolQueryResult::PoolQueryResult ( const PoolQuery & query_r)
inlineexplicit

Ctor adding one PoolQuery result.

Definition at line 96 of file PoolQueryResult.h.

◆ PoolQueryResult() [5/5]

template<class TQueryResultIter>
zypp::PoolQueryResult::PoolQueryResult ( TQueryResultIter begin_r,
TQueryResultIter end_r )
inline

Ctor adding a range of items for which operator+= is defined.

Definition at line 101 of file PoolQueryResult.h.

Member Function Documentation

◆ empty()

bool zypp::PoolQueryResult::empty ( ) const
inline

Whether the result is empty.

Definition at line 111 of file PoolQueryResult.h.

◆ size()

size_type zypp::PoolQueryResult::size ( ) const
inline

The number of sat::Solvables.

Definition at line 114 of file PoolQueryResult.h.

◆ begin()

const_iterator zypp::PoolQueryResult::begin ( ) const
inline

Definition at line 117 of file PoolQueryResult.h.

◆ end()

const_iterator zypp::PoolQueryResult::end ( ) const
inline

Definition at line 120 of file PoolQueryResult.h.

◆ contains() [1/2]

bool zypp::PoolQueryResult::contains ( sat::Solvable result_r) const
inline

Test whether some item is in the result set.

Definition at line 124 of file PoolQueryResult.h.

◆ contains() [2/2]

bool zypp::PoolQueryResult::contains ( const PoolItem & result_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 127 of file PoolQueryResult.h.

◆ clear()

void zypp::PoolQueryResult::clear ( )
inline

Clear the result.

Definition at line 132 of file PoolQueryResult.h.

◆ operator+=() [1/4]

PoolQueryResult & zypp::PoolQueryResult::operator+= ( const PoolQueryResult & query_r)
inline

Add items to the result.

Definition at line 136 of file PoolQueryResult.h.

◆ operator+=() [2/4]

PoolQueryResult & zypp::PoolQueryResult::operator+= ( const PoolQuery & query_r)
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 143 of file PoolQueryResult.h.

◆ operator+=() [3/4]

PoolQueryResult & zypp::PoolQueryResult::operator+= ( sat::Solvable result_r)
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 155 of file PoolQueryResult.h.

◆ operator+=() [4/4]

PoolQueryResult & zypp::PoolQueryResult::operator+= ( const PoolItem & result_r)
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 161 of file PoolQueryResult.h.

◆ operator-=() [1/4]

PoolQueryResult & zypp::PoolQueryResult::operator-= ( const PoolQueryResult & query_r)
inline

Remove Items from the result.

Definition at line 168 of file PoolQueryResult.h.

◆ operator-=() [2/4]

PoolQueryResult & zypp::PoolQueryResult::operator-= ( const PoolQuery & query_r)
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 178 of file PoolQueryResult.h.

◆ operator-=() [3/4]

PoolQueryResult & zypp::PoolQueryResult::operator-= ( sat::Solvable result_r)
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 190 of file PoolQueryResult.h.

◆ operator-=() [4/4]

PoolQueryResult & zypp::PoolQueryResult::operator-= ( const PoolItem & result_r)
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 196 of file PoolQueryResult.h.

◆ operator+() [1/3]

PoolQueryResult zypp::PoolQueryResult::operator+ ( const PoolQueryResult & query_r) const
inline

Combine results.

Definition at line 204 of file PoolQueryResult.h.

◆ operator+() [2/3]

PoolQueryResult zypp::PoolQueryResult::operator+ ( const PoolQuery & query_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 207 of file PoolQueryResult.h.

◆ operator+() [3/3]

PoolQueryResult zypp::PoolQueryResult::operator+ ( sat::Solvable result_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 210 of file PoolQueryResult.h.

◆ operator-() [1/3]

PoolQueryResult zypp::PoolQueryResult::operator- ( const PoolQueryResult & query_r) const
inline

Intersect results.

Definition at line 214 of file PoolQueryResult.h.

◆ operator-() [2/3]

PoolQueryResult zypp::PoolQueryResult::operator- ( const PoolQuery & query_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 217 of file PoolQueryResult.h.

◆ operator-() [3/3]

PoolQueryResult zypp::PoolQueryResult::operator- ( sat::Solvable result_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 220 of file PoolQueryResult.h.

Member Data Documentation

◆ _result

ResultSet zypp::PoolQueryResult::_result
private

Definition at line 224 of file PoolQueryResult.h.


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