libzypp 17.38.6
lookupattr.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8----------------------------------------------------------------------*/
9#include "lookupattr.h"
10#include <iostream>
11
14#include <zypp/ng/idstring.h>
15
18
19extern "C"
20{
21#include <solv/pool.h>
22}
23
24namespace zyppng::log {
25
26 std::ostream &formatter<sat::LookupAttr>::stream(std::ostream &str, const sat::LookupAttr &obj)
27 {
28 if ( obj.attr() == sat::SolvAttr::noAttr )
29 return str << "search nothing";
30
31 if ( obj.attr() )
32 str << "search " << obj.attr() << " in ";
33 else
34 str << "search ALL in ";
35
36 if ( obj.solvable() )
37 return str << obj.solvable();
38 if ( obj.repo() )
39 return str << obj.repo();
40 return str << "pool";
41 }
42
43#if 0
44 std::ostream & dumpOn( std::ostream & str, const sat::LookupAttr & obj )
45 {
46 return zypp::dumpRange( str << obj, obj.begin(), obj.end() );
47 }
48#endif
49
50 std::ostream &formatter<sat::detail::DIWrap>::stream(std::ostream &str, const sat::detail::DIWrap &obj)
51 { return str << obj.get(); }
52
53
55 {
56 const sat::detail::CDataiterator * dip = obj.get();
57 if ( ! dip )
58 return str << "EndOfQuery";
59
60 if ( obj.inSolvable() )
61 str << obj.inSolvable();
62 else if ( obj.inRepo() )
63 str << obj.inRepo();
64
65 str << '<' << obj.inSolvAttr() << (obj.solvAttrSubEntry() ? ">(*" : ">(")
66 << IdString(obj.solvAttrType()) << ") = " << obj.asString();
67 return str;
68 }
69
71 {
72 str << "detail::CDataiterator(";
73 if ( ! obj )
74 {
75 str << "NULL";
76 }
77 else
78 {
79 str << "|" << sat::Repository(obj->repo);
80 str << "|" << sat::Solvable(obj->solvid);
81 str << "|" << IdString(obj->key->name);
82 str << "|" << IdString(obj->key->type);
83 str << "|" << obj->repodataid;
84 str << "|" << obj->repoid;
85 }
86 return str << ")";
87 }
88
89}
detail::IdType solvAttrType() const
The current SolvAttr type.
Repository inRepo() const
The current Repository.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
SolvAttr inSolvAttr() const
The current SolvAttr.
detail::CDataiterator * get() const
Expert backdoor.
Definition lookupattr.h:564
Solvable inSolvable() const
The current Solvable.
Lightweight attribute value lookup.
Definition lookupattr.h:112
iterator end() const
Iterator behind the end of query results.
iterator begin() const
Iterator to the begin of query results.
SolvAttr attr() const
The SolvAttr to search.
Solvable solvable() const
Whether to search in one Solvable.
Repository repo() const
Whether to search in one Repository.
static const SolvAttr noAttr
Value representing noAttr ("").
Definition SolvAttr.h:48
A Solvable object within the sat Pool.
Definition solvable.h:65
Wrapper around sat detail::CDataiterator.
Definition lookupattr.h:292
detail::CDataiterator * get() const
Definition lookupattr.h:332
String related utilities and Regular expression matching.
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\n ", const std::string &sep="\n ", const std::string &sfx="\n", const std::string &extro="}")
Print range defined by iterators (multiline style).
Definition LogTools.h:409
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
relates: Capability Detailed stream output
zypp::sat::detail::CDataiterator CDataiterator
zypp::IdString IdString
Definition idstring.h:16
Primary trait for object formatting.
Definition format.h:67