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/Pathname.h"
23 #include "zypp/ResPool.h"
25 ///////////////////////////////////////////////////////////////////
27 { /////////////////////////////////////////////////////////////////
40 DEFINE_PTR_TYPE(Target);
42 ///////////////////////////////////////////////////////////////////
44 // CLASS NAME : Target
48 class Target : public base::ReferenceCounted, public base::NonCopyable
51 typedef target::TargetImpl Impl;
52 typedef intrusive_ptr<Impl> Impl_Ptr;
53 typedef std::list<PoolItem> PoolItemList;
58 * builds or refreshes the target cache
63 * cleans the target cache (.solv files)
68 * load resolvables into the pool
73 * unload target resolvables from the
80 ZYPP_DEPRECATED void reset() {}
82 /** Null implementation */
83 static Target_Ptr nullimpl();
85 /** Refference to the RPM database */
86 target::rpm::RpmDb & rpmDb();
88 /** If the package is installed and provides the file
89 Needed to evaluate split provides during Resolver::Upgrade() */
90 bool providesFile (const std::string & name_str, const std::string & path_str) const;
92 /** Return name of package owning \a path_str
93 * or empty string if no installed package owns \a path_str.
95 std::string whoOwnsFile (const std::string & path_str) const;
97 /** Set the log file for target */
98 bool setInstallationLogfile(const Pathname & path_r);
100 /** Return the root set for this target */
101 Pathname root() const;
103 /** return the last modification date of the target */
104 Date timestamp() const;
106 /** The targets distribution release string.
108 * openSUSE 10.3 (i586)
111 std::string release() const;
114 * anonymous unique id
116 * This id is generated once and stays in the
117 * saved in the target.
118 * It is unique and is used only for statistics.
121 std::string anonymousUniqueId() const;
124 /** Ctor. If \c doRebuild_r is \c true, an already existing
125 * database is rebuilt (rpm --rebuilddb ).
128 Target( const Pathname & root = "/", bool doRebuild_r = false );
131 Target( const Impl_Ptr & impl_r );
134 friend std::ostream & operator<<( std::ostream & str, const Target & obj );
135 /** Stream output. */
136 std::ostream & dumpOn( std::ostream & str ) const;
139 /** Direct access to Impl. */
140 friend class zypp_detail::ZYppImpl;
142 /** Pointer to implementation */
143 RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
145 static Target_Ptr _nullimpl;
147 ///////////////////////////////////////////////////////////////////
149 /** \relates Target Stream output. */
150 inline std::ostream & operator<<( std::ostream & str, const Target & obj )
151 { return obj.dumpOn( str ); }
154 /////////////////////////////////////////////////////////////////
156 ///////////////////////////////////////////////////////////////////
157 #endif // ZYPP_TARGET_H