1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ui/PoolQuery.h
15 #include "zypp/ui/Selectable.h"
16 #include "zypp/sat/SolvAttr.h"
18 #include "zypp/base/Function.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////
26 * Meta-data query API for user interfaces.
28 * TODO: details, examples.
34 //typedef SelectableSet::iterator ResultIterator;
35 //typedef constSelectableSet::iterator constResultIterator;
37 typedef function<bool( const ResObject::Ptr & )> ProcessResolvable;
39 PoolQuery(PoolQuery::ProcessResolvable fnc);
45 * executes the query with the current settings
46 * results are yielded on the callback passed on
49 void execute(const std::string &term) const;
52 * Filter by selectable kind.
54 * By default, all kinds will be returned. If addKind() is used,
55 * only the specified kinds will be returned (multiple kinds will be ORed).
57 * Pass ResTraits<T>::kind to this method, where T is one of the
58 * \ref Resolvable child classes (e.g. ResTraits<Pattern>::kind).
60 void addKind(const Resolvable::Kind &kind);
63 * Filter by selectable name.
65 * \param name what to search for
66 * \param isRegex is the value a regex?
68 //void addName(const std::string & name, bool isRegex = false);
72 * Filter by the \a value of any available attribute of selectables.
74 * \note Selectables of a kind not supporting the specified attribute will
75 * <b>not</b> be returned.
77 * \param attrid attribute identfier (sat::SolvAttr or cache::Attribute
78 * or something implementation independent)
79 * \param value what to search for
80 * \param isRegex is the value a regex?
82 //void addAttribute(const solv::SolvAttr & attrid,
83 // const std::string & value,
84 // bool isRegex = false);
87 * Filter by Selectable status.
89 * This should cover also plain 'is installed' and 'not installed' statuses.
91 * \param status Selectable status (zypp::ui::Status enum)
93 //void addStatus(const Status status);
97 * Add dependency filter.
99 * \param dtype depenedcy type
100 * \param name depenency name
101 * \param edition edition for a versioned dependency
102 * \param rel operand for a versioned dependency
104 * \todo maybe a isRegexp bool as in addName() for the name parameter would
105 * be handy here as well.
106 * \todo add more addDependecy() variants
108 //void addDependency(const Dep & dtype,
109 // const std::string & name,
110 // const Edition & edition = Edition(),
111 // const Rel & rel = Rel::EQ);
113 /** \name Text Attributes Matching Options */
116 * Set case sentitive on
117 * ( disables \ref SEARCH_NOCASE flag )
119 void setCaseSensitive(const bool value = true);
122 * Free function to set the satsolver repo search
125 \see SEARCH_STRINGMASK
127 \see SEARCH_SUBSTRING
131 \see SEARCH_NO_STORAGE_SOLVABLE
133 void setFlags(int flags);
134 //void setLocale(const Locale & locale);
137 //void setRequireAll(const bool require_all = true);
139 /** selectable iterator over the result */
140 //ResultIterator resultBegin() const;
141 //ResultIterator resultEnd() const;
143 /** Returns the size of the query result. */
144 //size_t resultSize() const;
146 /** Low-cost empty query result checker */
147 //bool resultEmpty() const;
149 // a forEach method consuming a functor can be added here, too
154 /** Pointer to implementation */
155 RW_pointer<Impl> _pimpl;
159 /////////////////////////////////////////////////////////////////
161 ///////////////////////////////////////////////////////////////////