libzypp  10.5.0
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 
00126     LocaleSet requestedLocales() const;
00129     static LocaleSet requestedLocales( const Pathname & root_r );
00130 
00131   public:
00143     std::string targetDistribution() const;
00145     static std::string targetDistribution( const Pathname & root_r );
00146 
00150     std::string targetDistributionRelease() const;
00152     static std::string targetDistributionRelease( const Pathname & root_r );
00153 
00154     struct DistributionLabel { std::string shortName; std::string summary; };
00158     DistributionLabel distributionLabel() const;
00160     static DistributionLabel distributionLabel( const Pathname & root_r );
00161 
00166     std::string distributionVersion() const;
00168     static std::string distributionVersion( const Pathname & root_r );
00169 
00177     std::string distributionFlavor() const;
00179     static std::string distributionFlavor( const Pathname & root_r );
00180 
00189     std::string anonymousUniqueId() const;
00191     static std::string anonymousUniqueId( const Pathname & root_r );
00193 
00194   public:
00198     explicit
00199     Target( const Pathname & root = "/", bool doRebuild_r = false );
00201     explicit
00202     Target( const Impl_Ptr & impl_r );
00203 
00204   private:
00205     friend std::ostream & operator<<( std::ostream & str, const Target & obj );
00207     std::ostream & dumpOn( std::ostream & str ) const;
00208 
00209   private:
00211     friend class zypp_detail::ZYppImpl;
00212 
00214     RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
00215 
00216     static Target_Ptr _nullimpl;
00217   };
00219 
00221   inline std::ostream & operator<<( std::ostream & str, const Target & obj )
00222   { return obj.dumpOn( str ); }
00223 
00231   std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
00232 
00234 } // namespace zypp
00236 #endif // ZYPP_TARGET_H