libzypp 17.25.7
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>
19#include <zypp/base/String.h>
20
22
24namespace zypp
25{
27 namespace sat
28 {
45 {
46 public:
49
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
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
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
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`).
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:69
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
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: SolvableSpec.h:107
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).
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 it's 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