1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Target.h
17 #include "zypp/base/PtrTypes.h"
19 #include "zypp/ResStore.h"
20 #include "zypp/Pathname.h"
21 #include "zypp/ResPool.h"
23 #include "zypp/solver/detail/Types.h"
25 ///////////////////////////////////////////////////////////////////
27 { /////////////////////////////////////////////////////////////////
36 DEFINE_PTR_TYPE(Target);
38 ///////////////////////////////////////////////////////////////////
40 // CLASS NAME : Target
44 class Target : public base::ReferenceCounted, public base::NonCopyable
47 typedef target::TargetImpl Impl;
48 typedef intrusive_ptr<Impl> Impl_Ptr;
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 * return number of successfully committed resolvables
63 int commit( ResPool pool_r, int medianr, PoolItemList & errors_r
64 , PoolItemList & remaining_r, PoolItemList & srcremaining_r );
66 /** If the package is installed and provides the file
67 Needed to evaluate split provides during Resolver::Upgrade() */
68 bool providesFile (const std::string & name_str, const std::string & path_str) const;
70 ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
72 /** JUST FOR TESTSUITE */
73 /** Sort according to prereqs and media numbers */
74 void getResolvablesToInsDel ( const ResPool pool_r,
75 PoolItemList & dellist_r,
76 PoolItemList & instlist_r,
77 PoolItemList & srclist_r ) const;
79 #ifndef STORAGE_DISABLED
80 /** enables the storage target */
81 bool isStorageEnabled() const;
82 void enableStorage(const Pathname &root_r);
88 Target( const Pathname & root = "/" );
91 Target( const Impl_Ptr & impl_r );
94 friend std::ostream & operator<<( std::ostream & str, const Target & obj );
96 std::ostream & dumpOn( std::ostream & str ) const;
99 /** Pointer to implementation */
100 RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
102 static Target_Ptr _nullimpl;
106 ///////////////////////////////////////////////////////////////////
108 /** \relates Target Stream output. */
109 inline std::ostream & operator<<( std::ostream & str, const Target & obj )
110 { return obj.dumpOn( str ); }
113 /////////////////////////////////////////////////////////////////
115 ///////////////////////////////////////////////////////////////////
116 #endif // ZYPP_TARGET_H