libzypp 17.35.19
TmpPath.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_CORE_FS_TMPPATH_H
13#define ZYPP_CORE_FS_TMPPATH_H
14
15#include <iosfwd>
16
17#include <zypp-core/Pathname.h>
20
21namespace zypp {
22 namespace filesystem {
23
25 //
26 // CLASS NAME : TmpPath
41 {
42 public:
46 TmpPath();
47
51 explicit
52 TmpPath( Pathname tmpPath_r );
53
57 virtual
58 ~TmpPath();
59
64 explicit operator bool() const;
65
70 path() const;
71
75 operator Pathname() const
76 { return path(); }
77
81 bool autoCleanup() const;
82
86 void autoCleanup( bool yesno_r );
87
88 public:
93 static const Pathname &
94 defaultLocation();
95
96 protected:
97 class Impl;
99
100 };
102
106 inline std::ostream &
107 operator<<( std::ostream & str, const TmpPath & obj )
108 { return str << static_cast<Pathname>(obj); }
109
111
113 //
114 // CLASS NAME : TmpFile
127 class ZYPP_API TmpFile : public TmpPath
128 {
129 public:
133 explicit
134 TmpFile( const Pathname & inParentDir_r = defaultLocation(),
135 const std::string & prefix_r = defaultPrefix() );
136
144 static TmpFile makeSibling( const Pathname & sibling_r );
148 static TmpFile makeSibling( const Pathname & sibling_r, unsigned mode );
149
154 static ManagedFile asManagedFile ();
155
156 public:
160 static const std::string &
161 defaultPrefix();
162
163 };
165
167 //
168 // CLASS NAME : TmpDir
181 class ZYPP_API TmpDir : public TmpPath
182 {
183 public:
187 explicit
188 TmpDir( const Pathname & inParentDir_r = defaultLocation(),
189 const std::string & prefix_r = defaultPrefix() );
190
198 static TmpDir makeSibling( const Pathname & sibling_r );
202 static TmpDir makeSibling( const Pathname & sibling_r, unsigned mode );
203
204 public:
208 static const std::string &
209 defaultPrefix();
210 };
212
213 } // namespace filesystem
214
216 Pathname myTmpDir() ZYPP_API; // implemented in ZYppImpl.cc
217
218} // namespace zypp
219
220#endif // ZYPP_CORE_FS_TMPPATH_H
Provide a new empty temporary directory and recursively delete it when no longer needed.
Definition TmpPath.h:182
Provide a new empty temporary file and delete it when no longer needed.
Definition TmpPath.h:128
Automaticaly deletes files or directories when no longer needed.
Definition TmpPath.h:41
RW_pointer< Impl > _impl
Definition TmpPath.h:98
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const Glob &obj)
Definition Glob.cc:53
Easy-to use interface to the ZYPP dependency resolver.
Pathname myTmpDir()
Global access to the zypp.TMPDIR (created on demand, deleted when libzypp is unloaded)
Definition ZYppImpl.cc:343
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293