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;
45 * executes the query with the current settings
46 * results are yielded on the callback passed on
49 void execute(const std::string &term, PoolQuery::ProcessResolvable fnc) 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);
71 * Filter by status (installed uninstalled)
78 void setInstalledOnly();
79 void setUninstalledOnly();
80 void setStatusFilterFlags( int flags );
83 * Filter by the \a value of any available attribute of selectables.
85 * \note Selectables of a kind not supporting the specified attribute will
86 * <b>not</b> be returned.
88 * \param attrid attribute identfier (sat::SolvAttr or cache::Attribute
89 * or something implementation independent)
90 * \param value what to search for
91 * \param isRegex is the value a regex?
93 //void addAttribute(const solv::SolvAttr & attrid,
94 // const std::string & value,
95 // bool isRegex = false);
98 * Filter by Selectable status.
100 * This should cover also plain 'is installed' and 'not installed' statuses.
102 * \param status Selectable status (zypp::ui::Status enum)
104 //void addStatus(const Status status);
108 * Add dependency filter.
110 * \param dtype depenedcy type
111 * \param name depenency name
112 * \param edition edition for a versioned dependency
113 * \param rel operand for a versioned dependency
115 * \todo maybe a isRegexp bool as in addName() for the name parameter would
116 * be handy here as well.
117 * \todo add more addDependecy() variants
119 //void addDependency(const Dep & dtype,
120 // const std::string & name,
121 // const Edition & edition = Edition(),
122 // const Rel & rel = Rel::EQ);
124 /** \name Text Attributes Matching Options */
127 * Set case sentitive on
128 * ( disables \ref SEARCH_NOCASE flag )
130 void setCaseSensitive(const bool value = true);
133 * Set match exact string
135 void setMatchExact(const bool value = true);
138 * Free function to set the satsolver repo search
141 \see SEARCH_STRINGMASK
143 \see SEARCH_SUBSTRING
147 \see SEARCH_NO_STORAGE_SOLVABLE
149 void setFlags(int flags);
150 //void setLocale(const Locale & locale);
153 //void setRequireAll(const bool require_all = true);
155 /** selectable iterator over the result */
156 //ResultIterator resultBegin() const;
157 //ResultIterator resultEnd() const;
159 /** Returns the size of the query result. */
160 //size_t resultSize() const;
162 /** Low-cost empty query result checker */
163 //bool resultEmpty() const;
165 // a forEach method consuming a functor can be added here, too
170 /** Pointer to implementation */
171 RW_pointer<Impl> _pimpl;
175 /////////////////////////////////////////////////////////////////
177 ///////////////////////////////////////////////////////////////////