libzypp  17.30.0
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-core/base/InputStream>
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
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition: String.h:91
A sat capability.
Definition: Capability.h:60
Access to the sat-pools string space.
Definition: IdString.h:43
Helper to create and pass std::istream.
Definition: inputstream.h:57
Define a set of Solvables by ident and provides.
Definition: SolvableSpec.h:45
void parse(const C_Str &spec_r)
Parse and add spec from a string (IDENT or provides:CAPABILITY`).
bool dirty() const
Whether the cache is needed and dirty.
bool containsIdent(const IdString &ident_r) const
Whether ident_r has been added to the specs (mainly for parser tests).
void splitParseFrom(const C_Str &multispec_r)
Convenience using str::splitEscaped(", \t") to parse multiple specs from one line.
void parseFrom(TIterator begin, TIterator end)
Parse and add specs from iterator range.
Definition: SolvableSpec.h:76
bool contains(const SolvableType< Derived > &solv_r) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: SolvableSpec.h:91
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: SolvableSpec.h:115
bool addIdenticalInstalledToo() const
Extend the provides set to include idential installed items as well.
bool contains(const sat::Solvable &solv_r) const
Test whether solv_r matches the spec.
bool containsProvides(const Capability &provides_r) const
Whether provides_r has been added to the sepcs (mainly for parser tests).
bool empty() const
Whether neither idents nor provides are set.
friend std::ostream & operator<<(std::ostream &str, const SolvableSpec &obj)
SolvableSpec()
Default ctor.
void setDirty() const
Explicitly flag the cache as dirty, so it will be rebuilt on the next request.
void addProvides(Capability provides_r)
A all sat::Solvable matching this provides_r.
void addIdent(IdString ident_r)
Add all sat::Solvable with this ident_r.
void parseFrom(const InputStream &istr_r)
Parse file istr_r and add its specs (one per line, #-comments).
A Solvable object within the sat Pool.
Definition: Solvable.h:54
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
Base class for creating Solvable based types.
Definition: SolvableType.h:55
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28