libzypp  17.23.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 
60  public:
62  void parse( const C_Str & spec_r );
63 
65  void parseFrom( const InputStream & istr_r );
66 
68  template <class TIterator>
69  void parseFrom( TIterator begin, TIterator end )
70  { for_( it, begin, end ) parse( *it ); }
71 
73  void splitParseFrom( const C_Str & multispec_r );
74 
75  public:
81  bool contains( const sat::Solvable & solv_r ) const;
83  template <class Derived>
84  bool contains( const SolvableType<Derived> & solv_r ) const
85  { return contains( solv_r.satSolvable() ); }
86 
88  bool dirty() const;
89 
95  void setDirty() const;
96 
97  public:
99  bool containsIdent( const IdString & ident_r ) const;
100 
102  bool containsProvides( const Capability & provides_r ) const;
103 
104  public:
105  class Impl;
106  private:
108  friend std::ostream & operator<<( std::ostream & str, const SolvableSpec & obj );
109  };
110 
112  std::ostream & operator<<( std::ostream & str, const SolvableSpec & obj );
113 
114  } // namespace sat
116 } // namespace zypp
118 #endif // ZYPP_SAT_SOLVABLESPEC_H
zypp::sat::SolvableSpec::containsProvides
bool containsProvides(const Capability &provides_r) const
Whether provides_r has been added to the sepcs (mainly for parser tests).
Definition: SolvableSpec.cc:158
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition: Solvable.h:53
zypp::sat::SolvableSpec::contains
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:84
zypp::sat::SolvableSpec::dirty
bool dirty() const
Whether the cache is needed and dirty.
Definition: SolvableSpec.cc:149
zypp::sat::SolvableType::satSolvable
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57
zypp::sat::SolvableSpec::operator<<
friend std::ostream & operator<<(std::ostream &str, const SolvableSpec &obj)
Definition: SolvableSpec.cc:161
zypp::sat::SolvableSpec::addProvides
void addProvides(Capability provides_r)
A all sat::Solvable matching this provides_r.
Definition: SolvableSpec.cc:123
PtrTypes.h
zypp::sat::SolvableSpec
Define a set of Solvables by ident and provides.
Definition: SolvableSpec.h:44
zypp::sat::SolvableSpec::setDirty
void setDirty() const
Explicitly flag the cache as dirty, so it will be rebuilt on the next request.
Definition: SolvableSpec.cc:152
zypp::IdString
Access to the sat-pools string space.
Definition: IdString.h:41
zypp::sat::SolvableSpec::parseFrom
void parseFrom(const InputStream &istr_r)
Parse file istr_r and add it's specs (one per line, #-comments).
Definition: SolvableSpec.cc:129
zypp::sat::SolvableSpec::containsIdent
bool containsIdent(const IdString &ident_r) const
Whether ident_r has been added to the specs (mainly for parser tests).
Definition: SolvableSpec.cc:155
zypp::sat::SolvableSpec::_pimpl
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: SolvableSpec.h:105
zypp::sat::operator<<
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
Definition: FileConflicts.cc:109
zypp::InputStream
Helper to create and pass std::istream.
Definition: InputStream.h:56
zypp::sat::SolvableSpec::~SolvableSpec
~SolvableSpec()
Dtor.
Definition: SolvableSpec.cc:117
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
SolvableType.h
zypp::C_Str
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition: String.h:90
zypp::sat::SolvableSpec::contains
bool contains(const sat::Solvable &solv_r) const
Test whether solv_r matches the spec.
Definition: SolvableSpec.cc:146
zypp::sat::SolvableType
Base class for creating Solvable based types.
Definition: SolvableType.h:54
zypp::Capability
A sat capability.
Definition: Capability.h:59
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
zypp::sat::SolvableSpec::Impl
SolvableSpec implementation.
Definition: SolvableSpec.cc:31
String.h
zypp::sat::SolvableSpec::splitParseFrom
void splitParseFrom(const C_Str &multispec_r)
Convenience using str::splitEscaped(", \t") to parse multiple specs from one line.
Definition: SolvableSpec.cc:139
zypp::sat::SolvableSpec::addIdent
void addIdent(IdString ident_r)
Add all sat::Solvable with this ident_r.
Definition: SolvableSpec.cc:120
zypp::sat::SolvableSpec::parse
void parse(const C_Str &spec_r)
Parse and add spec from a string (IDENT or provides:CAPABILITY`).
Definition: SolvableSpec.cc:126
InputStream.h
zypp::RWCOW_pointer< Impl >
str
String related utilities and Regular expression matching.
zypp::sat::SolvableSpec::parseFrom
void parseFrom(TIterator begin, TIterator end)
Parse and add specs from iterator range.
Definition: SolvableSpec.h:69
zypp::sat::SolvableSpec::SolvableSpec
SolvableSpec()
Default ctor.
Definition: SolvableSpec.cc:113