libzypp  17.14.0
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 
83 
86  bool providesFile (const std::string & name_str, const std::string & path_str) const;
87 
91  std::string whoOwnsFile (const std::string & path_str) const;
92 
94  Pathname root() const;
95 
97  bool chrooted() const
98  { return( ! root().emptyOrRoot() ); }
99 
101  Pathname assertRootPrefix( const Pathname & path_r ) const
102  { return Pathname::assertprefix( root(), path_r ); }
103 
105  Date timestamp() const;
106 
124 
129  LocaleSet requestedLocales() const;
132  static LocaleSet requestedLocales( const Pathname & root_r );
133 
137  void updateAutoInstalled();
138 
139  public:
151  std::string targetDistribution() const;
153  static std::string targetDistribution( const Pathname & root_r );
154 
158  std::string targetDistributionRelease() const;
160  static std::string targetDistributionRelease( const Pathname & root_r );
161 
166  std::string targetDistributionFlavor() const;
168  static std::string targetDistributionFlavor( const Pathname & root_r );
169 
170  struct DistributionLabel { std::string shortName; std::string summary; };
176  static DistributionLabel distributionLabel( const Pathname & root_r );
177 
182  std::string distributionVersion() const;
184  static std::string distributionVersion( const Pathname & root_r );
185 
194  std::string distributionFlavor() const;
196  static std::string distributionFlavor( const Pathname & root_r );
197 
206  std::string anonymousUniqueId() const;
208  static std::string anonymousUniqueId( const Pathname & root_r );
210 
211  public:
215  explicit
216  Target( const Pathname & root = "/", bool doRebuild_r = false );
218  explicit
219  Target( const Impl_Ptr & impl_r );
220 
221  private:
222  friend std::ostream & operator<<( std::ostream & str, const Target & obj );
224  std::ostream & dumpOn( std::ostream & str ) const;
225 
226  private:
228  friend class zypp_detail::ZYppImpl;
229 
232  };
234 
236  inline std::ostream & operator<<( std::ostream & str, const Target & obj )
237  { return obj.dumpOn( str ); }
238 
246  std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
247 
249 } // namespace zypp
251 #endif // ZYPP_TARGET_H