- fixed Target ctor to be 'explicit'. The compiler should not be
[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 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26   namespace target
27   {
28     class TargetImpl;
29     namespace rpm {
30       class RpmDb;
31     }
32   }
33
34   DEFINE_PTR_TYPE(Target);
35
36   ///////////////////////////////////////////////////////////////////
37   //
38   //    CLASS NAME : Target
39   //
40   /**
41   */
42   class Target : public base::ReferenceCounted, public base::NonCopyable
43   {
44   public:
45     typedef target::TargetImpl  Impl;
46     typedef intrusive_ptr<Impl> Impl_Ptr;
47
48   public:
49
50     /** All resolvables provided by the target. */
51     const ResStore & resolvables();
52     /** Null implementation */
53     static Target_Ptr nullimpl();
54     /** Refference to the RPM database */
55     target::rpm::RpmDb & rpmDb();
56     /** Comomit changes in the pool */
57     void commit(ResPool pool_r);
58
59   public:
60     /** Ctor */
61     explicit
62     Target( const Pathname & root = "/" );
63     /** Ctor */
64     explicit
65     Target( const Impl_Ptr & impl_r );
66
67   private:
68     friend std::ostream & operator<<( std::ostream & str, const Target & obj );
69     /** Stream output. */
70     std::ostream & dumpOn( std::ostream & str ) const;
71
72   private:
73     /** Pointer to implementation */
74     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
75
76     static Target_Ptr _nullimpl;
77
78   public:
79   };
80   ///////////////////////////////////////////////////////////////////
81
82   /** \relates Target Stream output. */
83   inline std::ostream & operator<<( std::ostream & str, const Target & obj )
84   { return obj.dumpOn( str ); }
85
86
87   /////////////////////////////////////////////////////////////////
88 } // namespace zypp
89 ///////////////////////////////////////////////////////////////////
90 #endif // ZYPP_TARGET_H