propagate commit() params
[platform/upstream/libzypp.git] / zypp / Target.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Target.h
10  *
11 */
12 #ifndef ZYPP_TARGET_H
13 #define ZYPP_TARGET_H
14
15 #include <iosfwd>
16
17 #include "zypp/base/PtrTypes.h"
18
19 #include "zypp/ResStore.h"
20 #include "zypp/Pathname.h"
21 #include "zypp/ResPool.h"
22
23 #include "zypp/solver/detail/Types.h"
24
25 ///////////////////////////////////////////////////////////////////
26 namespace zypp
27 { /////////////////////////////////////////////////////////////////
28   namespace target
29   {
30     class TargetImpl;
31     namespace rpm {
32       class RpmDb;
33     }
34   }
35
36   DEFINE_PTR_TYPE(Target);
37
38   ///////////////////////////////////////////////////////////////////
39   //
40   //    CLASS NAME : Target
41   //
42   /**
43   */
44   class Target : public base::ReferenceCounted, public base::NonCopyable
45   {
46   public:
47     typedef target::TargetImpl  Impl;
48     typedef intrusive_ptr<Impl> Impl_Ptr;
49
50   public:
51
52     /** All resolvables provided by the target. */
53     const ResStore & resolvables();
54     /** Null implementation */
55     static Target_Ptr nullimpl();
56     /** Refference to the RPM database */
57     target::rpm::RpmDb & rpmDb();
58     /** Commit changes in the pool 
59      *  \param medianr 0 = all/any media
60      *                 > 0 means only the given media number
61     */
62     void commit( ResPool pool_r, int medianr, PoolItemList & errors_r
63         , PoolItemList & remaining_r, PoolItemList & srcremaining_r );
64
65       /** If the package is installed and provides the file
66           Needed to evaluate split provides during Resolver::Upgrade() */
67       bool providesFile (const std::string & name_str, const std::string & path_str) const;
68
69       ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
70
71   public:
72     /** Ctor */
73     explicit
74     Target( const Pathname & root = "/" );
75     /** Ctor */
76     explicit
77     Target( const Impl_Ptr & impl_r );
78
79   private:
80     friend std::ostream & operator<<( std::ostream & str, const Target & obj );
81     /** Stream output. */
82     std::ostream & dumpOn( std::ostream & str ) const;
83
84   private:
85     /** Pointer to implementation */
86     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
87
88     static Target_Ptr _nullimpl;
89
90   public:
91   };
92   ///////////////////////////////////////////////////////////////////
93
94   /** \relates Target Stream output. */
95   inline std::ostream & operator<<( std::ostream & str, const Target & obj )
96   { return obj.dumpOn( str ); }
97
98
99   /////////////////////////////////////////////////////////////////
100 } // namespace zypp
101 ///////////////////////////////////////////////////////////////////
102 #endif // ZYPP_TARGET_H