Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / Pattern.h
index 136f3c5..36b14a5 100644 (file)
 #define ZYPP_PATTERN_H
 
 #include "zypp/ResObject.h"
-#include "zypp/detail/PatternImplIf.h"
 #include "zypp/Pathname.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
+  DEFINE_PTR_TYPE(Pattern);
+
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Pattern
@@ -28,40 +29,79 @@ namespace zypp
   */
   class Pattern : public ResObject
   {
-  public:
-    typedef detail::PatternImplIf  Impl;
-    typedef Pattern                Self;
-    typedef ResTraits<Self>          TraitsType;
-    typedef TraitsType::PtrType      Ptr;
-    typedef TraitsType::constPtrType constPtr;
+    public:
+      typedef Pattern                  Self;
+      typedef ResTraits<Self>          TraitsType;
+      typedef TraitsType::PtrType      Ptr;
+      typedef TraitsType::constPtrType constPtr;
+
+    public:
+      typedef sat::ArrayAttr<IdString,IdString> NameList;
+      typedef sat::SolvableSet                  Contents;
+
+    public:
+      /** */
+      bool isDefault() const;
+      /** */
+      bool userVisible() const;
+      /** */
+      std::string category( const Locale & lang_r = Locale() ) const;
+      /** */
+      Pathname icon() const;
+      /** */
+      Pathname script() const;
+      /** */
+      std::string order() const;
+
+    public:
+      /** \name Auto pattens (libyzpp-14)
+       * Patterns are no longer defined by separate metadate files, but via
+       * special dependencies provided by a corresponding patterns- package.
+       * The pattern itself requires only it's patterns- package, the package
+       * contains all further dependencies.
+       * This way pattens are no longer pseudo installed objects with a computed
+       * status, but installed, iff the corresponding patterns- package is
+       * installed.
+       */
+      //@{
+      /** This patterns is auto-defined by a patterns- package. */
+      bool isAutoPattern() const;
+      /** The corresponding patterns- package if \ref isAutoPattern. */
+      sat::Solvable autoPackage() const;
+      //@}
+    public:
+      /** Ui hint: included patterns. */
+      NameList includes() const;
+
+      /** Ui hint: patterns this one extends. */
+      NameList extends() const;
+
+      /** Ui hint: Required Packages. */
+      Contents core() const;
 
-  public:
-    /** */
-    std::string patternId() const;
-    /** */
-    bool isDefault() const;
-    /** */
-    bool userVisible() const;
-    /** */
-    std::string category() const;
-    /** */
-    Pathname icon() const;
-    /** */
-    Pathname script() const;
-    /** */
-    // data here:
+      /** Ui hint: Dependent packages.
+       * This also includes recommended and suggested (optionally exclude) packages.
+      */
+      Contents depends( bool includeSuggests_r = true ) const;
+      /** \overload Without SUGGESTS. */
+      Contents dependsNoSuggests() const
+      { return depends( false ); }
 
-  protected:
-    /** Ctor */
-    Pattern( const NVRAD & nvrad_r );
-    /** Dtor */
-    virtual ~Pattern();
+      /** The collection of packages associated with this pattern.
+       * This also evaluates the patterns includes/extends relation.
+       * Optionally exclude \c SUGGESTED packages.
+       */
+      Contents contents( bool includeSuggests_r = true ) const;
+      /** \overload Without SUGGESTS. */
+      Contents contentsNoSuggests() const
+      { return contents( false ); }
 
-  private:
-    /** Access implementation */
-    virtual Impl & pimpl() = 0;
-    /** Access implementation */
-    virtual const Impl & pimpl() const = 0;
+    protected:
+      friend Ptr make<Self>( const sat::Solvable & solvable_r );
+      /** Ctor */
+      Pattern( const sat::Solvable & solvable_r );
+      /** Dtor */
+      virtual ~Pattern();
   };
   ///////////////////////////////////////////////////////////////////