libzypp 17.37.10

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-core/Globals.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 {
44 class SolvableSpec
45 {
46 public:
48 SolvableSpec();
49
51 ~SolvableSpec();
52
53 SolvableSpec(const SolvableSpec &) = default;
54 SolvableSpec(SolvableSpec &&) noexcept = default;
55 SolvableSpec &operator=(const SolvableSpec &) = default;
56 SolvableSpec &operator=(SolvableSpec &&) noexcept = default;
57
58 public:
60 void addIdent( IdString ident_r );
61
63 void addProvides( Capability provides_r );
64
69 bool addIdenticalInstalledToo() const;
70 void addIdenticalInstalledToo( bool yesno_r );
71
72 public:
74 void parse( const C_Str & spec_r );
75
77 void parseFrom( const InputStream & istr_r );
78
80 template <class TIterator>
81 void parseFrom( TIterator begin, TIterator end )
82 { for_( it, begin, end ) parse( *it ); }
83
85 void splitParseFrom( const C_Str & multispec_r );
86
87 public:
93 bool contains( const sat::Solvable & solv_r ) const;
95 template <class Derived>
96 bool contains( const SolvableType<Derived> & solv_r ) const
97 { return contains( solv_r.satSolvable() ); }
98
100 bool dirty() const;
101
107 void setDirty() const;
108
109 public:
111 bool empty() const;
112
114 bool containsIdent( const IdString & ident_r ) const;
115
117 bool containsProvides( const Capability & provides_r ) const;
118
119 public:
120 class Impl;
121 private:
122 RWCOW_pointer<Impl> _pimpl;
123 friend std::ostream & operator<<( std::ostream & str, const SolvableSpec & obj );
124 };
125
127 std::ostream & operator<<( std::ostream & str, const SolvableSpec & obj );
128
129 } // namespace sat
131} // namespace zypp
133#endif // ZYPP_SAT_SOLVABLESPEC_H
operator<<
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
Definition LookupAttr.cc:808
SolvableType.h
Impl
zypp::C_Str
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition String.h:92
zypp::Capability
A sat capability.
Definition Capability.h:63
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:44
zypp::InputStream
Helper to create and pass std::istream.
Definition inputstream.h:57
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
str
String related utilities and Regular expression matching.
zypp::sat
Definition Resolver.h:28
zypp::sat::empty
bool empty() const
Whether neither idents nor provides are set.
zypp::sat::~SolvableSpec
~SolvableSpec()
Dtor.
zypp::sat::splitParseFrom
void splitParseFrom(const C_Str &multispec_r)
Convenience using str::splitEscaped(", \t") to parse multiple specs from one line.
zypp::sat::containsIdent
bool containsIdent(const IdString &ident_r) const
Whether ident_r has been added to the specs (mainly for parser tests).
zypp::sat::operator<<
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
Definition FileConflicts.cc:109
zypp::sat::_pimpl
RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition SolvableSpec.h:122
zypp::sat::setDirty
void setDirty() const
Explicitly flag the cache as dirty, so it will be rebuilt on the next request.
zypp::sat::addIdent
void addIdent(IdString ident_r)
Add all sat::Solvable with this ident_r.
zypp::sat::addProvides
void addProvides(Capability provides_r)
A all sat::Solvable matching this provides_r.
zypp::sat::containsProvides
bool containsProvides(const Capability &provides_r) const
Whether provides_r has been added to the sepcs (mainly for parser tests).
zypp::sat::dirty
bool dirty() const
Whether the cache is needed and dirty.
zypp::sat::parse
void parse(const C_Str &spec_r)
Parse and add spec from a string (IDENT or provides:CAPABILITY`).
zypp::sat::parseFrom
void parseFrom(const InputStream &istr_r)
Parse file istr_r and add its specs (one per line, #-comments).
zypp::sat::SolvableSpec
SolvableSpec()
zypp::sat::contains
bool contains(const sat::Solvable &solv_r) const
Test whether solv_r matches the spec.
zypp::sat::addIdenticalInstalledToo
bool addIdenticalInstalledToo() const
Extend the provides set to include idential installed items as well.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
zypp::sat::SolvableType
Base class for creating Solvable based types.
Definition SolvableType.h:55
zypp::sat::SolvableType::satSolvable
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition SolvableType.h:57
Globals.h
Provides API related macros.
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
PtrTypes.h
String.h