38aff03a20dc9800a353f7f51045794de458092b
[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/target/TargetImpl.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
57   public:
58     /** Factory ctor */
59     Target( const Pathname & root = "/" );
60     /** Factory ctor */
61     explicit
62     Target( const Impl_Ptr & impl_r );
63
64   private:
65     friend std::ostream & operator<<( std::ostream & str, const Target & obj );
66     /** Stream output. */
67     std::ostream & dumpOn( std::ostream & str ) const;
68
69   private:
70     /** Pointer to implementation */
71     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
72
73     static Target_Ptr _nullimpl;
74
75   public:
76   };
77   ///////////////////////////////////////////////////////////////////
78
79   /** \relates Target Stream output. */
80   inline std::ostream & operator<<( std::ostream & str, const Target & obj )
81   { return obj.dumpOn( str ); }
82
83
84   /////////////////////////////////////////////////////////////////
85 } // namespace zypp
86 ///////////////////////////////////////////////////////////////////
87 #endif // ZYPP_TARGET_H