libzypp  16.22.5
SolvableSpec.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
11 #ifndef ZYPP_SAT_SOLVABLESPEC_H
12 #define ZYPP_SAT_SOLVABLESPEC_H
13 
14 #include <iosfwd>
15 
16 #include <zypp/APIConfig.h>
17 #include <zypp/base/PtrTypes.h>
18 #include <zypp/base/InputStream.h>
19 #include <zypp/base/String.h>
20 
21 #include <zypp/sat/SolvableType.h>
22 
24 namespace zypp
25 {
27  namespace sat
28  {
45  {
46  public:
48  SolvableSpec();
49 
51  ~SolvableSpec();
52 
53  public:
55  void addIdent( IdString ident_r );
56 
58  void addProvides( Capability provides_r );
59 
64  bool addIdenticalInstalledToo() const;
65  void addIdenticalInstalledToo( bool yesno_r );
66 
67  public:
69  void parse( const C_Str & spec_r );
70 
72  void parseFrom( const InputStream & istr_r );
73 
75  template <class TIterator>
76  void parseFrom( TIterator begin, TIterator end )
77  { for_( it, begin, end ) parse( *it ); }
78 
80  void splitParseFrom( const C_Str & multispec_r );
81 
82  public:
88  bool contains( const sat::Solvable & solv_r ) const;
90  template <class Derived>
91  bool contains( const SolvableType<Derived> & solv_r ) const
92  { return contains( solv_r.satSolvable() ); }
93 
95  bool dirty() const;
96 
102  void setDirty() const;
103 
104  public:
106  bool empty() const;
107 
109  bool containsIdent( const IdString & ident_r ) const;
110 
112  bool containsProvides( const Capability & provides_r ) const;
113 
114  public:
115  class Impl;
116  private:
118  friend std::ostream & operator<<( std::ostream & str, const SolvableSpec & obj );
119  };
120 
122  std::ostream & operator<<( std::ostream & str, const SolvableSpec & obj );
123 
124  } // namespace sat
126 } // namespace zypp
128 #endif // ZYPP_SAT_SOLVABLESPEC_H
bool dirty() const
Whether the cache is needed and dirty.
void splitParseFrom(const C_Str &multispec_r)
Convenience using str::splitEscaped(", \t") to parse multiple specs from one line.
A Solvable object within the sat Pool.
Definition: Solvable.h:53
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
bool addIdenticalInstalledToo() const
Extend the provides set to include idential installed items as well.
friend std::ostream & operator<<(std::ostream &str, const SolvableSpec &obj)
void parse(const C_Str &spec_r)
Parse and add spec from a string (IDENT or provides:CAPABILITY`).
SolvableSpec()
Default ctor.
Access to the sat-pools string space.
Definition: IdString.h:41
Helper to create and pass std::istream.
Definition: InputStream.h:56
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
bool contains(const sat::Solvable &solv_r) const
Test whether solv_r matches the spec.
void addIdent(IdString ident_r)
Add all sat::Solvable with this ident_r.
Define a set of Solvables by ident and provides.
Definition: SolvableSpec.h:44
void setDirty() const
Explicitly flag the cache as dirty, so it will be rebuilt on the next request.
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
Definition: String.h:90
void parseFrom(const InputStream &istr_r)
Parse file istr_r and add it's specs (one per line, #-comments).
Provides API related macros.
void parseFrom(TIterator begin, TIterator end)
Parse and add specs from iterator range.
Definition: SolvableSpec.h:76
SolvableSpec implementation.
Definition: SolvableSpec.cc:33
void addProvides(Capability provides_r)
A all sat::Solvable matching this provides_r.
bool empty() const
Whether neither idents nor provides are set.
bool contains(const SolvableType< Derived > &solv_r) const
Definition: SolvableSpec.h:91
A sat capability.
Definition: Capability.h:59
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57
bool containsProvides(const Capability &provides_r) const
Whether provides_r has been added to the sepcs (mainly for parser tests).
Base class for creating Solvable based types.
Definition: SolvableType.h:54
bool containsIdent(const IdString &ident_r) const
Whether ident_r has been added to the specs (mainly for parser tests).
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: SolvableSpec.h:115