1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Target.h
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/base/Deprecated.h"
22 #include "zypp/ResStore.h"
23 #include "zypp/Pathname.h"
24 #include "zypp/ResPool.h"
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
41 DEFINE_PTR_TYPE(Target);
43 ///////////////////////////////////////////////////////////////////
45 // CLASS NAME : Target
49 class Target : public base::ReferenceCounted, public base::NonCopyable
52 typedef target::TargetImpl Impl;
53 typedef intrusive_ptr<Impl> Impl_Ptr;
54 typedef std::list<PoolItem> PoolItemList;
58 /** All resolvables provided by the target. */
59 const ResStore & resolvables();
62 * reload the target in future calls if
64 * note the loading can actually be delayed, but
65 * the next call to resolvables must reflect the
66 * status of the system.
71 * load resolvables of certain kind in the internal store
72 * and return a iterator
73 * successive calls will be faster as resolvables are cached-
75 ResStore::resfilter_const_iterator byKindBegin( const ResObject::Kind & kind_r ) const;
76 ResStore::resfilter_const_iterator byKindEnd( const ResObject::Kind & kind_r ) const;
78 /** Null implementation */
79 static Target_Ptr nullimpl();
81 /** Refference to the RPM database */
82 target::rpm::RpmDb & rpmDb();
84 /** If the package is installed and provides the file
85 Needed to evaluate split provides during Resolver::Upgrade() */
86 bool providesFile (const std::string & name_str, const std::string & path_str) const;
88 ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
90 #ifndef STORAGE_DISABLED
91 /** enables the storage target */
92 bool isStorageEnabled() const;
93 void enableStorage(const Pathname &root_r);
96 /** Set the log file for target */
97 bool setInstallationLogfile(const Pathname & path_r);
99 /** Return the root set for this target */
100 Pathname root() const;
102 /** return the last modification date of the target */
103 Date timestamp() const;
107 Target( const Pathname & root = "/" );
110 Target( const Impl_Ptr & impl_r );
113 friend std::ostream & operator<<( std::ostream & str, const Target & obj );
114 /** Stream output. */
115 std::ostream & dumpOn( std::ostream & str ) const;
118 /** Direct access to Impl. */
119 friend class zypp_detail::ZYppImpl;
121 /** Pointer to implementation */
122 RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
124 static Target_Ptr _nullimpl;
126 ///////////////////////////////////////////////////////////////////
128 /** \relates Target Stream output. */
129 inline std::ostream & operator<<( std::ostream & str, const Target & obj )
130 { return obj.dumpOn( str ); }
133 /////////////////////////////////////////////////////////////////
135 ///////////////////////////////////////////////////////////////////
136 #endif // ZYPP_TARGET_H