libzypp  12.16.5
Target.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_TARGET_H
13 #define ZYPP_TARGET_H
14 
15 #include <iosfwd>
16 
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/APIConfig.h"
21 
22 #include "zypp/Product.h"
23 #include "zypp/Pathname.h"
24 #include "zypp/ResPool.h"
25 
27 namespace zypp
28 {
29  namespace target
30  {
31  class TargetImpl;
32  namespace rpm {
33  class RpmDb;
34  }
35  }
36  namespace zypp_detail
37  {
38  class ZYppImpl;
39  }
40 
42 
44  //
45  // CLASS NAME : Target
46  //
50  {
51  public:
53  typedef intrusive_ptr<Impl> Impl_Ptr;
54  typedef std::list<PoolItem> PoolItemList;
55 
56  public:
57 
61  void buildCache();
62 
66  void cleanCache();
67 
71  void load();
72 
73  void reload();
74 
79  void unload();
80 
82  static Target_Ptr nullimpl();
83 
86 
89  bool providesFile (const std::string & name_str, const std::string & path_str) const;
90 
94  std::string whoOwnsFile (const std::string & path_str) const;
95 
97  Pathname root() const;
98 
100  Pathname assertRootPrefix( const Pathname & path_r ) const
101  { return Pathname::assertprefix( root(), path_r ); }
102 
104  Date timestamp() const;
105 
123 
128  LocaleSet requestedLocales() const;
131  static LocaleSet requestedLocales( const Pathname & root_r );
132 
133  public:
145  std::string targetDistribution() const;
147  static std::string targetDistribution( const Pathname & root_r );
148 
152  std::string targetDistributionRelease() const;
154  static std::string targetDistributionRelease( const Pathname & root_r );
155 
156  struct DistributionLabel { std::string shortName; std::string summary; };
162  static DistributionLabel distributionLabel( const Pathname & root_r );
163 
168  std::string distributionVersion() const;
170  static std::string distributionVersion( const Pathname & root_r );
171 
179  std::string distributionFlavor() const;
181  static std::string distributionFlavor( const Pathname & root_r );
182 
191  std::string anonymousUniqueId() const;
193  static std::string anonymousUniqueId( const Pathname & root_r );
195 
196  public:
200  explicit
201  Target( const Pathname & root = "/", bool doRebuild_r = false );
203  explicit
204  Target( const Impl_Ptr & impl_r );
205 
206  private:
207  friend std::ostream & operator<<( std::ostream & str, const Target & obj );
209  std::ostream & dumpOn( std::ostream & str ) const;
210 
211  private:
213  friend class zypp_detail::ZYppImpl;
214 
217 
218  static Target_Ptr _nullimpl;
219  };
221 
223  inline std::ostream & operator<<( std::ostream & str, const Target & obj )
224  { return obj.dumpOn( str ); }
225 
233  std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
234 
236 } // namespace zypp
238 #endif // ZYPP_TARGET_H