libzypp  17.3.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 
82  target::rpm::RpmDb & rpmDb();
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  Pathname assertRootPrefix( const Pathname & path_r ) const
98  { return Pathname::assertprefix( root(), path_r ); }
99 
101  Date timestamp() const;
102 
119  Product::constPtr baseProduct() const;
120 
125  LocaleSet requestedLocales() const;
128  static LocaleSet requestedLocales( const Pathname & root_r );
129 
133  void updateAutoInstalled();
134 
135  public:
147  std::string targetDistribution() const;
149  static std::string targetDistribution( const Pathname & root_r );
150 
154  std::string targetDistributionRelease() const;
156  static std::string targetDistributionRelease( const Pathname & root_r );
157 
162  std::string targetDistributionFlavor() const;
164  static std::string targetDistributionFlavor( const Pathname & root_r );
165 
166  struct DistributionLabel { std::string shortName; std::string summary; };
170  DistributionLabel distributionLabel() const;
172  static DistributionLabel distributionLabel( const Pathname & root_r );
173 
178  std::string distributionVersion() const;
180  static std::string distributionVersion( const Pathname & root_r );
181 
190  std::string distributionFlavor() const;
192  static std::string distributionFlavor( const Pathname & root_r );
193 
202  std::string anonymousUniqueId() const;
204  static std::string anonymousUniqueId( const Pathname & root_r );
206 
207  public:
211  explicit
212  Target( const Pathname & root = "/", bool doRebuild_r = false );
214  explicit
215  Target( const Impl_Ptr & impl_r );
216 
217  private:
218  friend std::ostream & operator<<( std::ostream & str, const Target & obj );
220  std::ostream & dumpOn( std::ostream & str ) const;
221 
222  private:
224  friend class zypp_detail::ZYppImpl;
225 
228  };
230 
232  inline std::ostream & operator<<( std::ostream & str, const Target & obj )
233  { return obj.dumpOn( str ); }
234 
242  std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj );
243 
245 } // namespace zypp
247 #endif // ZYPP_TARGET_H
std::ostream & operator<<(std::ostream &str, const librpmDb::DbDirInfo &obj)
Definition: librpmDb.cc:544
Interface to the rpm program.
Definition: RpmDb.h:47
std::ostream & operator<<(std::ostream &str, const Target &obj)
Definition: Target.h:232
String related utilities and Regular expression matching.
DEFINE_PTR_TYPE(TargetImpl)
TraitsType::constPtrType constPtr
Definition: Product.h:38
target::TargetImpl Impl
Definition: Target.h:52
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
Store and operate on date (time_t).
Definition: Date.h:32
Base class for concrete Target implementations.
Definition: TargetImpl.h:53
Provides API related macros.
RW_pointer< Impl, rw_pointer::Intrusive< Impl > > _pimpl
Pointer to implementation.
Definition: Target.h:227
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Return path_r prefixed with root_r, unless it is already prefixed.
Definition: Pathname.cc:235
intrusive_ptr< Impl > Impl_Ptr
Definition: Target.h:53
Base class for reference counted objects.
Pathname assertRootPrefix(const Pathname &path_r) const
Return the path prefixed by the target root, unless it already is prefixed.
Definition: Target.h:97
std::ostream & dumpOn(std::ostream &str, const RpmPostTransCollector &obj)
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
std::ostream & dumpOn(std::ostream &str) const
Stream output.
Definition: Target.cc:88
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
std::list< PoolItem > PoolItemList
Definition: Target.h:54