libzypp  11.13.5
TmpPath.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_TMPPATH_H
13 #define ZYPP_TMPPATH_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/Pathname.h"
18 #include "zypp/base/PtrTypes.h"
19 
20 namespace zypp {
21  namespace filesystem {
22 
24  //
25  // CLASS NAME : TmpPath
39  class TmpPath
40  {
41  public:
45  TmpPath();
46 
50  explicit
51  TmpPath( const Pathname & tmpPath_r );
52 
56  virtual
57  ~TmpPath();
58 
63  operator const void * () const;
64 
68  Pathname
69  path() const;
70 
74  operator Pathname() const
75  { return path(); }
76 
80  bool autoCleanup() const;
81 
85  void autoCleanup( bool yesno_r );
86 
87  public:
92  static const Pathname &
94 
95  protected:
96  class Impl;
98 
99  };
101 
105  inline std::ostream &
106  operator<<( std::ostream & str, const TmpPath & obj )
107  { return str << static_cast<Pathname>(obj); }
108 
110 
112  //
113  // CLASS NAME : TmpFile
126  class TmpFile : public TmpPath
127  {
128  public:
132  explicit
133  TmpFile( const Pathname & inParentDir_r = defaultLocation(),
134  const std::string & prefix_r = defaultPrefix() );
135 
143  static TmpFile makeSibling( const Pathname & sibling_r );
144 
145  public:
149  static const std::string &
150  defaultPrefix();
151 
152  };
154 
156  //
157  // CLASS NAME : TmpDir
170  class TmpDir : public TmpPath
171  {
172  public:
176  explicit
177  TmpDir( const Pathname & inParentDir_r = defaultLocation(),
178  const std::string & prefix_r = defaultPrefix() );
179 
187  static TmpDir makeSibling( const Pathname & sibling_r );
188 
189  public:
193  static const std::string &
194  defaultPrefix();
195  };
197 
198  } // namespace filesystem
199 } // namespace zypp
200 
201 #endif // ZYPP_TMPPATH_H