libzypp: zypp::sat::LookupAttr Class Reference

libzypp 17.36.6

Classes | Public Types | Public Member Functions | Related Symbols | List of all members
zypp::sat::LookupAttr Class Reference

Lightweight attribute value lookup. More...

`#include <zypp/sat/LookupAttr.h>`

Inheritance diagram for zypp::sat::LookupAttr:

## Classes
class | Impl
| LookupAttr implememtation. More...
class | iterator
| Result iterator. More...
class | TransformIterator
| TransformIterator returning an iterator vaue of type `TResult`. More...

## Public Types
enum | Location { SOLV_ATTR = 0 , REPO_ATTR = -1 }
| Specify the where to look for the attribule. More...
using | Exception = MatchException
using | size_type = unsigned int

## Public Member Functions
| LookupAttr ()
| Default ctor finds nothing.
| LookupAttr (const LookupAttr &)=default
| LookupAttr (LookupAttr &&) noexcept=default
LookupAttr & | operator= (const LookupAttr &)=default
LookupAttr & | operator= (LookupAttr &&) noexcept=default
| LookupAttr (SolvAttr attr_r, Location=SOLV_ATTR)
| Lookup SolvAttr in Pool (all repositories).
| LookupAttr (SolvAttr attr_r, SolvAttr parent_r, Location=SOLV_ATTR)
| LookupAttr (SolvAttr attr_r, Repository repo_r, Location=SOLV_ATTR)
| Lookup SolvAttr in oneRepository.
| LookupAttr (SolvAttr attr_r, SolvAttr parent_r, Repository repo_r, Location=SOLV_ATTR)
| LookupAttr (SolvAttr attr_r, Solvable solv_r)
| Lookup SolvAttr in one Solvable.
| LookupAttr (SolvAttr attr_r, SolvAttr parent_r, Solvable solv_r)
Search result.
iterator | begin () const
| Iterator to the begin of query results.
iterator | end () const
| Iterator behind the end of query results.
bool | empty () const
| Whether the query is empty.
size_type | size () const
| Ammount of results.
What to search.
SolvAttr | attr () const
| The SolvAttr to search.
void | setAttr (SolvAttr attr_r)
| Set the SolvAttr to search.
Restrict attributes to match a pattern.
const StrMatcher & | strMatcher () const
| The pattern to match.
void | setStrMatcher (const StrMatcher &matcher_r)
| Set the pattern to match.
void | resetStrMatcher ()
| Reset the pattern to match.

## Related Symbols
(Note that these are not member symbols.)
std::ostream & | operator<< (std::ostream &str, const LookupAttr &obj) ZYPP_API
| Stream output.
std::ostream & | dumpOn (std::ostream &str, const LookupAttr &obj) ZYPP_API
| Verbose stream output including the query result.
std::ostream & | operator<< (std::ostream &str, const LookupAttr::iterator &obj) ZYPP_API
| Stream output.
template<class TResult, class TAttr>
std::ostream & | operator<< (std::ostream &str, const ArrayAttr< TResult, TAttr > &obj)
| Stream output.

## Where to search.
RWCOW_pointer< Impl > | _pimpl
bool | pool () const
| Whether to search in Pool.
void | setPool (Location=SOLV_ATTR)
| Set search in Pool (all repositories).
Repository | repo () const
| Whether to search in one Repository.
void | setRepo (Repository repo_r, Location=SOLV_ATTR)
| Set search in one Repository.
Solvable | solvable () const
| Whether to search in one Solvable.
void | setSolvable (Solvable solv_r)
| Set search in one Solvable.
SolvAttr | parent () const
| Whether to search within a sub-structure (SolvAttr::noAttr if not)
void | setParent (SolvAttr attr_r)
| Set search within a sub-structure (SolvAttr::noAttr for none)

## Detailed Description

Lightweight attribute value lookup.

Search for an attribute in Pool, one Repository or one Solvable. LookupAttr builds the query, LookupAttr::iterator iterates over the result.

Per default LookupAttr looks for attributes associated with a Solvable. But you may also pass REPO_ATTR as Location argument, to lookup attributes associated with the Repository (e.g. DeltaRpm information).

For convenience

See also
  LookupRepoAttr.

Modifying the query will not affect any running iterator.

Use SolvAttr::allAttr to search all attributes.

To search for attributes located in a sub-structure (flexarray) you also have to pass the sub-structures attribute as parent. Passing SolvAttr::allAttr a parent will lookup the attribute in `any` sub-structure. Few attributes are known to have a parent (

See also
  SolvAttr::parent). Setting those attributes will automatically initialize their parent value.

// Lookup all 'name' attributes:
sat::LookupAttr q( sat::SolvAttr::name );
// Lookup all 'name' attributes within a sub-structure 'data':
sat::LookupAttr q( sat::SolvAttr::name, sat::SolvAttr::data );
// Lookup all 'name' attributes within any sub-structure:
sat::LookupAttr q( sat::SolvAttr::name, sat::SolvAttr::allAttr );
zypp::sat::LookupAttr
Lightweight attribute value lookup.
Definition LookupAttr.h:110
zypp::sat::SolvAttr::name
static const SolvAttr name
Definition SolvAttr.h:52
zypp::sat::SolvAttr::allAttr
static const SolvAttr allAttr
Value to request searching all Attributes (0).
Definition SolvAttr.h:46
// look for all attributes of one solvable
void ditest( sat::Solvable slv_r )
{
sat::LookupAttr q( sat::SolvAttr::allAttr, slv_r );
MIL << q << ": " << endl;
for_( it, q.begin(), q.end() )
{
MIL << " " << it.inSolvAttr() << " = " << it.asString() << endl;
}
}
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
MIL
#define MIL
Definition Logger.h:100
// look for an attribute in the pool.
sat::LookupAttr q( sat::SolvAttr("susetags:datadir") );
MIL << q << ": " << endl;
for_( it, q.begin(), q.end() )
{
MIL << " " << it << endl;
}
zypp::sat::SolvAttr
Solvable attribute keys.
Definition SolvAttr.h:41
// look for a repo attribute in the pool.
sat::LookupRepoAttr q( sat::SolvAttr::repositoryAddedFileProvides );
MIL << q << ": " << endl;
for_( it, q.begin(), q.end() )
{
MIL << " " << it << endl;
}
zypp::sat::LookupRepoAttr
Lightweight repository attribute value lookup.
Definition LookupAttr.h:265
zypp::sat::SolvAttr::repositoryAddedFileProvides
static const SolvAttr repositoryAddedFileProvides
Definition SolvAttr.h:182

Definition at line 109 of file LookupAttr.h.

## Member Typedef Documentation

## ◆ Exception

using zypp::sat::LookupAttr::Exception = MatchException

Definition at line 112 of file LookupAttr.h.

## ◆ size_type

using zypp::sat::LookupAttr::size_type = unsigned int

Definition at line 115 of file LookupAttr.h.

## Member Enumeration Documentation

## ◆ Location

enum zypp::sat::LookupAttr::Location

Specify the where to look for the attribule.

Enumerator
SOLV_ATTR | Search for solvable attributes (default)
REPO_ATTR | Search for repository attributes.

Definition at line 118 of file LookupAttr.h.

## Constructor & Destructor Documentation

## ◆ LookupAttr() [1/9]

zypp::sat::LookupAttr::LookupAttr | ( |  | ) |

Default ctor finds nothing.

Definition at line 169 of file LookupAttr.cc.

## ◆ LookupAttr() [2/9]

zypp::sat::LookupAttr::LookupAttr | ( | const LookupAttr & |  | ) |
| default

## ◆ LookupAttr() [3/9]

zypp::sat::LookupAttr::LookupAttr | ( | LookupAttr && |  | ) |
| defaultnoexcept

## ◆ LookupAttr() [4/9]

zypp::sat::LookupAttr::LookupAttr | ( | SolvAttr | attr_r,
|  | Location | loc_r = SOLV_ATTR )
| explicit

Lookup SolvAttr in Pool (all repositories).

Definition at line 173 of file LookupAttr.cc.

## ◆ LookupAttr() [5/9]

zypp::sat::LookupAttr::LookupAttr | ( | SolvAttr | attr_r,
|  | SolvAttr | parent_r,
|  | Location | loc_r = SOLV_ATTR )

Definition at line 176 of file LookupAttr.cc.

## ◆ LookupAttr() [6/9]

zypp::sat::LookupAttr::LookupAttr | ( | SolvAttr | attr_r,
|  | Repository | repo_r,
|  | Location | loc_r = SOLV_ATTR )

Lookup SolvAttr in oneRepository.

Definition at line 180 of file LookupAttr.cc.

## ◆ LookupAttr() [7/9]

zypp::sat::LookupAttr::LookupAttr | ( | SolvAttr | attr_r,
|  | SolvAttr | parent_r,
|  | Repository | repo_r,
|  | Location | loc_r = SOLV_ATTR )

Definition at line 183 of file LookupAttr.cc.

## ◆ LookupAttr() [8/9]

zypp::sat::LookupAttr::LookupAttr | ( | SolvAttr | attr_r,
|  | Solvable | solv_r )

Lookup SolvAttr in one Solvable.

Definition at line 187 of file LookupAttr.cc.

## ◆ LookupAttr() [9/9]

zypp::sat::LookupAttr::LookupAttr | ( | SolvAttr | attr_r,
|  | SolvAttr | parent_r,
|  | Solvable | solv_r )

Definition at line 190 of file LookupAttr.cc.

## Member Function Documentation

## ◆ operator=() [1/2]

LookupAttr & zypp::sat::LookupAttr::operator= | ( | const LookupAttr & |  | ) |
| default

## ◆ operator=() [2/2]

LookupAttr & zypp::sat::LookupAttr::operator= | ( | LookupAttr && |  | ) |
| defaultnoexcept

## ◆ begin()

LookupAttr::iterator zypp::sat::LookupAttr::begin | ( |  | ) | const

Iterator to the begin of query results.

Definition at line 237 of file LookupAttr.cc.

## ◆ end()

LookupAttr::iterator zypp::sat::LookupAttr::end | ( |  | ) | const

Iterator behind the end of query results.

Definition at line 240 of file LookupAttr.cc.

## ◆ empty()

bool zypp::sat::LookupAttr::empty | ( |  | ) | const

Whether the query is empty.

Definition at line 243 of file LookupAttr.cc.

## ◆ size()

LookupAttr::size_type zypp::sat::LookupAttr::size | ( |  | ) | const

Ammount of results.

Note
  This is not a cheap call. It runs the query.

Definition at line 246 of file LookupAttr.cc.

## ◆ attr()

SolvAttr zypp::sat::LookupAttr::attr | ( |  | ) | const

The SolvAttr to search.

Definition at line 197 of file LookupAttr.cc.

## ◆ setAttr()

void zypp::sat::LookupAttr::setAttr | ( | SolvAttr | attr_r | ) |

Set the SolvAttr to search.

Definition at line 200 of file LookupAttr.cc.

## ◆ strMatcher()

const StrMatcher & zypp::sat::LookupAttr::strMatcher | ( |  | ) | const

The pattern to match.

You can also evaluate StrMatcher in a boolean context, in order to test whether an StrMatcher is set:

LookupAttr q;
if ( q.strMatcher() )
...; // an StrMatcher is set
zypp::sat::LookupAttr::strMatcher
const StrMatcher & strMatcher() const
The pattern to match.
Definition LookupAttr.cc:203
zypp::sat::LookupAttr::LookupAttr
LookupAttr()
Default ctor finds nothing.
Definition LookupAttr.cc:169

Definition at line 203 of file LookupAttr.cc.

## ◆ setStrMatcher()

void zypp::sat::LookupAttr::setStrMatcher | ( | const StrMatcher & | matcher_r | ) |

Set the pattern to match.

Exceptions

  MatchException | Any of the exceptions thrown by StrMatcher::compile.

Definition at line 206 of file LookupAttr.cc.

## ◆ resetStrMatcher()

void zypp::sat::LookupAttr::resetStrMatcher | ( |  | ) |

Reset the pattern to match.

## ◆ pool()

bool zypp::sat::LookupAttr::pool | ( |  | ) | const

Whether to search in Pool.

Definition at line 211 of file LookupAttr.cc.

## ◆ setPool()

void zypp::sat::LookupAttr::setPool | ( | Location | loc_r = SOLV_ATTR | ) |

Set search in Pool (all repositories).

Definition at line 214 of file LookupAttr.cc.

## ◆ repo()

Repository zypp::sat::LookupAttr::repo | ( |  | ) | const

Whether to search in one Repository.

Definition at line 217 of file LookupAttr.cc.

## ◆ setRepo()

void zypp::sat::LookupAttr::setRepo | ( | Repository | repo_r,
|  | Location | loc_r = SOLV_ATTR )

Set search in one Repository.

Definition at line 220 of file LookupAttr.cc.

## ◆ solvable()

Solvable zypp::sat::LookupAttr::solvable | ( |  | ) | const

Whether to search in one Solvable.

Definition at line 223 of file LookupAttr.cc.

## ◆ setSolvable()

void zypp::sat::LookupAttr::setSolvable | ( | Solvable | solv_r | ) |

Set search in one Solvable.

Definition at line 226 of file LookupAttr.cc.

## ◆ parent()

SolvAttr zypp::sat::LookupAttr::parent | ( |  | ) | const

Whether to search within a sub-structure (SolvAttr::noAttr if not)

Definition at line 229 of file LookupAttr.cc.

## ◆ setParent()

void zypp::sat::LookupAttr::setParent | ( | SolvAttr | attr_r | ) |

Set search within a sub-structure (SolvAttr::noAttr for none)

Definition at line 232 of file LookupAttr.cc.

## Friends And Related Symbol Documentation

## ◆ operator<<() [1/3]

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

Stream output.

Definition at line 256 of file LookupAttr.cc.

## ◆ dumpOn()

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

Verbose stream output including the query result.

Definition at line 273 of file LookupAttr.cc.

## Member Data Documentation

## ◆ _pimpl

RWCOW_pointer<Impl> zypp::sat::LookupAttr::_pimpl
| private

Definition at line 234 of file LookupAttr.h.

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

- zypp/sat/LookupAttr.h
- zypp/sat/LookupAttr.cc