Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / PoolQuery.h
index 8f783fa..aeb3b4b 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "zypp/sat/SolvIterMixin.h"
 #include "zypp/sat/LookupAttr.h"
-#include "zypp/sat/AttrMatcher.h"
+#include "zypp/base/StrMatcher.h"
 #include "zypp/sat/Pool.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -53,6 +53,12 @@ namespace zypp
    * objects. Additionally, thanx to the \ref sat::SolvIterMixin, a Selectable
    * and PoolItem iterators are automatically available.
    *
+   * \note You will sometimes face the problem, that when using the \ref PoolItem
+   * iterator you hit multiple version of the same package, while when using the
+   * \ref ui::Selectable iterator the information which of the available candidates
+   * actually matched got lost. In this case class \ref PoolItemBest may help you.
+   * Use it to pick the best version only.
+   *
    * <code>
    * PoolQuery q;
    * q.addAttribute(sat::SolvAttr::name, "zypp*");
@@ -210,17 +216,20 @@ namespace zypp
      */
     void addAttribute( const sat::SolvAttr & attr, const std::string & value = "" );
 
-    /** \name Filter by dependencies matching a broken down capability <tt>name [op edition]</tt>.
+    /** \name Filter by dependencies matching a broken down capability <tt>name [op edition]</tt> and/or architecture.
      *
      * The capabilities \c name part may be defined as query string
      * like with \ref addAttribute. Globing and regex are supported.
      * Global query strings defined by \ref addString are considered.
      *
-     * So without any <tt>op edition</tt> addDependency behaves the
+     * So without any <tt>op edition arch</tt> addDependency behaves the
      * same as \ref addAttribute. If an edition range is given, matches
-     * are restricted accordingly. Thete are various overloads, so pick
+     * are restricted accordingly. There are various overloads, so pick
      * the one you like best.
      *
+     * An optional \c arch argument will additionally require the matching
+     * solvable to be of this arch.
+     *
      * \code
      * {
      *   setMatchGlob();
@@ -269,26 +278,43 @@ namespace zypp
     //@{
     /** Query <tt>"name|global op edition"</tt>. */
     void addDependency( const sat::SolvAttr & attr, const std::string & name, const Rel & op, const Edition & edition );
+    /**  \overload also restricting architecture */
+    void addDependency( const sat::SolvAttr & attr, const std::string & name, const Rel & op, const Edition & edition, const Arch & arch );
 
     /** \overload Query <tt>"name|global == edition"</tt>. */
     void addDependency( const sat::SolvAttr & attr, const std::string & name, const Edition & edition )
     { addDependency( attr, name, Rel::EQ, edition ); }
+    /**  \overload also restricting architecture */
+    void addDependency( const sat::SolvAttr & attr, const std::string & name, const Edition & edition, const Arch & arch )
+    { addDependency( attr, name, Rel::EQ, edition, arch ); }
 
     /** \overload Query <tt>"name|global"</tt>. */
     void addDependency( const sat::SolvAttr & attr, const std::string & name )
     { addDependency( attr, name, Rel::ANY, Edition() ); }
+    /**  \overload also restricting architecture */
+    void addDependency( const sat::SolvAttr & attr, const std::string & name, const Arch & arch )
+    { addDependency( attr, name, Rel::ANY, Edition(), arch ); }
 
     /** \overload Query <tt>"global op edition"</tt>.*/
     void addDependency( const sat::SolvAttr & attr, const Rel & op, const Edition & edition )
     { addDependency( attr, std::string(), op, edition ); }
+    /**  \overload also restricting architecture */
+    void addDependency( const sat::SolvAttr & attr, const Rel & op, const Edition & edition, const Arch & arch )
+    { addDependency( attr, std::string(), op, edition, arch ); }
 
     /** \overload Query <tt>"global == edition"</tt>. */
     void addDependency( const sat::SolvAttr & attr, const Edition & edition )
     { addDependency( attr, std::string(), Rel::EQ, edition ); }
+    /**  \overload also restricting architecture */
+    void addDependency( const sat::SolvAttr & attr, const Edition & edition, const Arch & arch )
+    { addDependency( attr, std::string(), Rel::EQ, edition, arch ); }
 
     /** \overload Query <tt>"global"</tt>. */
     void addDependency( const sat::SolvAttr & attr )
     { addDependency( attr, std::string(), Rel::ANY, Edition() ); }
+    /**  \overload also restricting architecture */
+    void addDependency( const sat::SolvAttr & attr, const Arch & arch )
+    { addDependency( attr, std::string(), Rel::ANY, Edition(), arch ); }
 
     /** \overload Query taking a \ref Capability (always exact name match).
      * \note If a non dependency attribute is passed, the \ref Capability
@@ -436,7 +462,7 @@ namespace zypp
     // low level API
 
     /**
-     * Free function to get the satsolver repo search
+     * Free function to get libsolv repo search
      * flags.
      *
      * \see \ref Match
@@ -444,7 +470,7 @@ namespace zypp
     Match flags() const;
 
     /**
-     * Free function to set the satsolver repo search
+     * Free function to set libsolv repo search
      * flags.
      *
      * \see \ref Match
@@ -462,6 +488,9 @@ namespace zypp
   /** \relates PoolQuery Stream output. */
   std::ostream & operator<<( std::ostream & str, const PoolQuery & obj );
 
+  /** \relates PoolQuery Detailed stream output. */
+  std::ostream & dumpOn( std::ostream & str, const PoolQuery & obj );
+
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////