libzypp  11.13.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 
77  void unload();
78 
80  static Target_Ptr nullimpl();
81 
84 
87  bool providesFile (const std::string & name_str, const std::string & path_str) const;
88 
92  std::string whoOwnsFile (const std::string & path_str) const;
93 
95  Pathname root() const;
96 
98  Pathname assertRootPrefix( const Pathname & path_r ) const
99  { return Pathname::assertprefix( root(), path_r ); }
100 
102  Date timestamp() const;
103 
121 
126  LocaleSet requestedLocales() const;
129  static LocaleSet requestedLocales( const Pathname & root_r );
130 
131  public:
143  std::string targetDistribution() const;
145  static std::string targetDistribution( const Pathname & root_r );
146 
150  std::string targetDistributionRelease() const;
152  static std::string targetDistributionRelease( const Pathname & root_r );
153 
154  struct DistributionLabel { std::string shortName; std::string summary; };
160  static DistributionLabel distributionLabel( const Pathname & root_r );
161 
166  std::string distributionVersion() const;
168  static std::string distributionVersion( const Pathname & root_r );
169 
177  std::string distributionFlavor() const;
179  static std::string distributionFlavor( const Pathname & root_r );
180 
189  std::string anonymousUniqueId() const;
191  static std::string anonymousUniqueId( const Pathname & root_r );
193 
194  public:
198  explicit
199  Target( const Pathname & root = "/", bool doRebuild_r = false );
201  explicit
202  Target( const Impl_Ptr & impl_r );
203 
204  private:
205  friend std::ostream & operator<<( std::ostream & str, const Target & obj );
207  std::ostream & dumpOn( std::ostream & str ) const;
208 
209  private:
211  friend class zypp_detail::ZYppImpl;
212 
215 
216  static Target_Ptr _nullimpl;
217  };
219 
221  inline std::ostream & operator<<( std::ostream & str, const Target & obj )
222  { return obj.dumpOn( str ); }
223 
231  std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
232 
234 } // namespace zypp
236 #endif // ZYPP_TARGET_H