libzypp: zypp-core/fs/TmpPath.h Source File

libzypp 17.36.6

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>
18#include <zypp-core/base/PtrTypes.h>
19#include <zypp-core/ManagedFile.h>
20
21namespace zypp {
22 namespace filesystem {
23
25 //
26 // CLASS NAME : TmpPath
40 class ZYPP_API 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
69 Pathname
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;
98 RW_pointer<Impl> _impl;
99
100 };
101
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
160 static ManagedFile asManagedFile ( const Pathname & inParentDir_r, const std::string & prefix_r = defaultPrefix() );
161
162 public:
166 static const std::string &
167 defaultPrefix();
168
169 };
170
171
173 //
174 // CLASS NAME : TmpDir
187 class ZYPP_API TmpDir : public TmpPath
188 {
189 public:
193 explicit
194 TmpDir( const Pathname & inParentDir_r = defaultLocation(),
195 const std::string & prefix_r = defaultPrefix() );
196
204 static TmpDir makeSibling( const Pathname & sibling_r );
208 static TmpDir makeSibling( const Pathname & sibling_r, unsigned mode );
209
210 public:
214 static const std::string &
215 defaultPrefix();
216 };
217
218
219 } // namespace filesystem
220
222 Pathname myTmpDir() ZYPP_API;
223
224} // namespace zypp
225
226#endif // ZYPP_CORE_FS_TMPPATH_H
Impl
bool
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zypp::filesystem::TmpDir::defaultPrefix
static const std::string & defaultPrefix()
Definition TmpPath.cc:332
zypp::filesystem::TmpDir::TmpDir
TmpDir(const Pathname &inParentDir_r=defaultLocation(), const std::string &prefix_r=defaultPrefix())
Ctor.
Definition TmpPath.cc:276
zypp::filesystem::TmpDir::makeSibling
static TmpDir makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
Definition TmpPath.cc:308
zypp::filesystem::TmpFile::TmpFile
TmpFile(const Pathname &inParentDir_r=defaultLocation(), const std::string &prefix_r=defaultPrefix())
Ctor.
Definition TmpPath.cc:187
zypp::filesystem::TmpFile::makeSibling
static TmpFile makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
Definition TmpPath.cc:222
zypp::filesystem::TmpFile::asManagedFile
static ManagedFile asManagedFile()
Create a temporary file and convert it to a automatically cleaned up ManagedFile.
Definition TmpPath.cc:240
zypp::filesystem::TmpFile::defaultPrefix
static const std::string & defaultPrefix()
Definition TmpPath.cc:259
zypp::filesystem::TmpPath
Automaticaly deletes files or directories when no longer needed.
Definition TmpPath.h:41
zypp::filesystem::TmpPath::defaultLocation
static const Pathname & defaultLocation()
Definition TmpPath.cc:163
zypp::filesystem::TmpPath::_impl
RW_pointer< Impl > _impl
Definition TmpPath.h:98
zypp::filesystem::TmpPath::path
Pathname path() const
Definition TmpPath.cc:152
zypp::filesystem::TmpPath::TmpPath
TmpPath()
Default Ctor.
Definition TmpPath.cc:114
str
String related utilities and Regular expression matching.
zypp::filesystem
Types and functions for filesystem operations.
Definition Glob.cc:24
zypp::filesystem::operator<<
std::ostream & operator<<(std::ostream &str, const Glob &obj)
Definition Glob.cc:53
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::myTmpDir
Pathname myTmpDir()
Global access to the zypp.TMPDIR (created on demand, deleted when libzypp is unloaded)
Definition TmpPath.cc:340
zypp::ManagedFile
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Definition ManagedFile.h:27
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
ManagedFile.h
Pathname.h
PtrTypes.h