Target.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_TARGET_H
00013 #define ZYPP_TARGET_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/base/ReferenceCounted.h"
00018 #include "zypp/base/NonCopyable.h"
00019 #include "zypp/base/PtrTypes.h"
00020 #include "zypp/base/Deprecated.h"
00021 
00022 #include "zypp/Product.h"
00023 #include "zypp/Pathname.h"
00024 #include "zypp/ResPool.h"
00025 
00027 namespace zypp
00028 { 
00029   namespace target
00030   {
00031     class TargetImpl;
00032     namespace rpm {
00033       class RpmDb;
00034     }
00035   }
00036   namespace zypp_detail
00037   {
00038     class ZYppImpl;
00039   }
00040 
00041   DEFINE_PTR_TYPE(Target);
00042 
00044   //
00045   //    CLASS NAME : Target
00046   //
00049   class Target : public base::ReferenceCounted, public base::NonCopyable
00050   {
00051   public:
00052     typedef target::TargetImpl  Impl;
00053     typedef intrusive_ptr<Impl> Impl_Ptr;
00054     typedef std::list<PoolItem> PoolItemList;
00055 
00056   public:
00057 
00061     void buildCache();
00062 
00066     void cleanCache();
00067 
00071     void load();
00072 
00077     void unload();
00078 
00080     static Target_Ptr nullimpl();
00081 
00083     target::rpm::RpmDb & rpmDb();
00084 
00087     bool providesFile (const std::string & name_str, const std::string & path_str) const;
00088 
00092     std::string whoOwnsFile (const std::string & path_str) const;
00093 
00095     Pathname root() const;
00096 
00098     Pathname assertRootPrefix( const Pathname & path_r ) const
00099     { return Pathname::assertprefix( root(), path_r ); }
00100 
00102     Date timestamp() const;
00103 
00120     Product::constPtr baseProduct() const;
00121 
00122   public:
00134     std::string targetDistribution() const;
00136     static std::string targetDistribution( const Pathname & root_r );
00137 
00141     std::string targetDistributionRelease() const;
00143     static std::string targetDistributionRelease( const Pathname & root_r );
00144 
00145     struct DistributionLabel { std::string shortName; std::string summary; };
00149     DistributionLabel distributionLabel() const;
00151     static DistributionLabel distributionLabel( const Pathname & root_r );
00152 
00157     std::string distributionVersion() const;
00159     static std::string distributionVersion( const Pathname & root_r );
00160 
00168     std::string distributionFlavor() const;
00170     static std::string distributionFlavor( const Pathname & root_r );
00171 
00180     std::string anonymousUniqueId() const;
00182     static std::string anonymousUniqueId( const Pathname & root_r );
00184 
00185   public:
00189     explicit
00190     Target( const Pathname & root = "/", bool doRebuild_r = false );
00192     explicit
00193     Target( const Impl_Ptr & impl_r );
00194 
00195   private:
00196     friend std::ostream & operator<<( std::ostream & str, const Target & obj );
00198     std::ostream & dumpOn( std::ostream & str ) const;
00199 
00200   private:
00202     friend class zypp_detail::ZYppImpl;
00203 
00205     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
00206 
00207     static Target_Ptr _nullimpl;
00208   };
00210 
00212   inline std::ostream & operator<<( std::ostream & str, const Target & obj )
00213   { return obj.dumpOn( str ); }
00214 
00222   std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
00223 
00225 } // namespace zypp
00227 #endif // ZYPP_TARGET_H

doxygen