add providesFile()
[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     /** Commit changes in the pool */
57     void commit(ResPool pool_r);
58
59       /** If the package is installed and provides the file
60           Needed to evaluate split provides during Resolver::Upgrade() */
61       bool providesFile (const std::string & name_str, const std::string & path_str) const;
62
63   public:
64     /** Ctor */
65     explicit
66     Target( const Pathname & root = "/" );
67     /** Ctor */
68     explicit
69     Target( const Impl_Ptr & impl_r );
70
71   private:
72     friend std::ostream & operator<<( std::ostream & str, const Target & obj );
73     /** Stream output. */
74     std::ostream & dumpOn( std::ostream & str ) const;
75
76   private:
77     /** Pointer to implementation */
78     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
79
80     static Target_Ptr _nullimpl;
81
82   public:
83   };
84   ///////////////////////////////////////////////////////////////////
85
86   /** \relates Target Stream output. */
87   inline std::ostream & operator<<( std::ostream & str, const Target & obj )
88   { return obj.dumpOn( str ); }
89
90
91   /////////////////////////////////////////////////////////////////
92 } // namespace zypp
93 ///////////////////////////////////////////////////////////////////
94 #endif // ZYPP_TARGET_H