libzypp  17.38.7
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 
12 #include <zypp/ng/sat/repository.h>
13 #include <zypp/ng/sat/solvable.h>
14 #include <zypp/ng/idstring.h>
15 
18 
19 extern "C"
20 {
21 #include <solv/pool.h>
22 }
23 
24 namespace 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 }
A Solvable object within the sat Pool.
Definition: solvable.h:64
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\ ", const std::string &sep="\ ", const std::string &sfx="\, const std::string &extro="}")
Print range defined by iterators (multiline style).
Definition: LogTools.h:409
Lightweight attribute value lookup.
Definition: lookupattr.h:111
String related utilities and Regular expression matching.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: lookupattr.cc:566
SolvAttr inSolvAttr() const
The current SolvAttr.
Definition: lookupattr.cc:327
detail::CDataiterator * get() const
Definition: lookupattr.h:332
Repository repo() const
Whether to search in one Repository.
Definition: lookupattr.cc:222
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
Definition: lookupattr.cc:416
detail::IdType solvAttrType() const
The current SolvAttr type.
Definition: lookupattr.cc:345
iterator begin() const
Iterator to the begin of query results.
Definition: lookupattr.cc:240
zypp::sat::detail::CDataiterator CDataiterator
Definition: poolconstants.h:33
std::ostream & dumpOn(std::ostream &str, const ProvideFileSpec::Impl &obj)
relates: ProvideSpec::Impl Verbose stream output
Definition: providespec.cc:188
detail::CDataiterator * get() const
Expert backdoor.
Definition: lookupattr.h:559
Solvable inSolvable() const
The current Solvable.
Definition: lookupattr.cc:324
Wrapper around sat detail::CDataiterator.
Definition: lookupattr.h:291
iterator end() const
Iterator behind the end of query results.
Definition: lookupattr.cc:243
Solvable solvable() const
Whether to search in one Solvable.
Definition: lookupattr.cc:228
Repository inRepo() const
The current Repository.
Definition: lookupattr.cc:321
Primary trait for object formatting.
Definition: format.h:67
zypp::IdString IdString
Definition: idstring.h:16
SolvAttr attr() const
The SolvAttr to search.
Definition: lookupattr.cc:204