Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / ZYpp.h
index 88381c6..46af218 100644 (file)
 
 #include <iosfwd>
 
-#include "zypp/base/ReferenceCounted.h"
 #include "zypp/base/NonCopyable.h"
 #include "zypp/base/PtrTypes.h"
-#include "zypp/base/Deprecated.h"
+#include "zypp/APIConfig.h"
 
 #include "zypp/ZConfig.h"
+#include "zypp/ManagedFile.h"
 
 #include "zypp/ZYppCommit.h"
 #include "zypp/ResTraits.h"
@@ -51,12 +51,14 @@ namespace zypp
    * \todo define Exceptions
    * ZYpp API main interface
    */
-  class ZYpp : public base::ReferenceCounted, private base::NonCopyable
+  class ZYpp : private base::NonCopyable
   {
-  public:
+    friend std::ostream & operator<<( std::ostream & str, const ZYpp & obj );
 
-    typedef intrusive_ptr<ZYpp>       Ptr;
-    typedef intrusive_ptr<const ZYpp> constPtr;
+  public:
+    // can't get swig working if shared_ptr is without namespace here
+    typedef ::boost::shared_ptr<ZYpp>       Ptr;
+    typedef ::boost::shared_ptr<const ZYpp> constPtr;
 
   public:
 
@@ -84,11 +86,18 @@ namespace zypp
      */
     Target_Ptr target() const;
 
+    /** Same as \ref target but returns NULL if target is not
+     *  initialized, instead of throwing.
+     */
+    Target_Ptr getTarget() const;
+
     /**
      * \throws Exception
-     * just init the target, dont populate store or pool
+     * Just init the target, dont populate store or pool.
+     * If \c doRebuild_r is \c true, an already existing
+     * database is rebuilt (rpm --rebuilddb ).
      */
-    void initializeTarget(const Pathname & root);
+    void initializeTarget(const Pathname & root, bool doRebuild_r = false);
 
     /**
      * \throws Exception
@@ -111,46 +120,15 @@ namespace zypp
      */
     void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
 
+    /** Provides a source package on the Target.
+     * \throws Exception
+     */
+    ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r );
+
   public:
     /** */
     Resolver_Ptr resolver() const;
     KeyRing_Ptr keyRing() const;
-  public:
-    /** Set the preferred locale for translated labels, descriptions,
-     *  etc. passed to the UI.
-     * \deprecated Use ZConfig diretcly.
-     */
-    ZYPP_DEPRECATED void setTextLocale( const Locale & textLocale_r )
-    { ZConfig::instance().setTextLocale( textLocale_r ); }
-    /** \deprecated Use ZConfig diretcly. */
-    ZYPP_DEPRECATED Locale getTextLocale() const
-    { return ZConfig::instance().textLocale(); }
-
-  public:
-    /** \name move to pool
-     * \deprecated Use ResPool diretcly.
-    */
-    //@{
-    /** Set the requested locales.
-     * Languages to be supported by the system, e.g. language specific
-     * packages to be installed. This function operates on the pool,
-     * so only the locales that are available as resolvables
-     * are marked as requested. The rest is ignored.
-     * \deprecated Use ResPool diretcly.
-    */
-    void setRequestedLocales( const LocaleSet & locales_r ) ZYPP_DEPRECATED;
-
-    /** \deprecated Use ResPool diretcly. */
-    const LocaleSet & getRequestedLocales() const ZYPP_DEPRECATED;
-
-    /**
-     * Get the set of available locales.
-     * This is computed from the package data so it actually
-     * represents all locales packages claim to support.
-     * \deprecated Use ResPool diretcly.
-     */
-    const LocaleSet & getAvailableLocales() const ZYPP_DEPRECATED;
-    //@}
 
   public:
     /** Get the path where zypp related plugins store persistent data and caches   */
@@ -162,44 +140,18 @@ namespace zypp
     /** set the home, if you need to change it */
     void setHomePath( const Pathname & path );
 
-    /** Get the system architecture.
-      * \deprecated Use ZConfig diretcly.
-    */
-    ZYPP_DEPRECATED Arch architecture() const
-    { return ZConfig::instance().systemArchitecture(); }
-    /** Set the system architecture.
-     * This should be used for testing/debugging only since the Target backend
-     * won't be able to install incompatible packages ;-)
-     * \deprecated Use ZConfig diretcly.
-    */
-    ZYPP_DEPRECATED void setArchitecture( const Arch & arch )
-    { ZConfig::instance().setSystemArchitecture( arch ); }
-
-  public:
-
-   /**
-    * \short Apply persistant locks to current pool.
-    * Call this before solving
-    *
-    * \returns Number of items locked
-    */
-   int applyLocks();
-
-  protected:
-    /** Dtor */
-    virtual ~ZYpp();
-    /** Stream output */
-    virtual std::ostream & dumpOn( std::ostream & str ) const;
   private:
     /** Factory */
     friend class ZYppFactory;
-
-    /** */
     typedef zypp_detail::ZYppImpl Impl;
     typedef shared_ptr<Impl>      Impl_Ptr;
     /** Factory ctor */
-    explicit
-    ZYpp( const Impl_Ptr & impl_r );
+    explicit ZYpp( const Impl_Ptr & impl_r );
+  private:
+    /** Deleted via shared_ptr */
+    friend void ::boost::checked_delete<ZYpp>(ZYpp*);  // template<class T> inline void checked_delete(T * x)
+    /** Dtor */
+    ~ZYpp();
   private:
     /** Pointer to implementation */
     RW_pointer<Impl> _pimpl;