/usr/include/x86_64-linux-gnu/zypp/TmpPath.h is in libzypp-dev 15.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
/** \file zypp/TmpPath.h
*
*/
#ifndef ZYPP_TMPPATH_H
#define ZYPP_TMPPATH_H
#include <iosfwd>
#include "zypp/Pathname.h"
#include "zypp/base/PtrTypes.h"
namespace zypp {
namespace filesystem {
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : TmpPath
/**
* @short Automaticaly deletes files or directories when no longer needed.
*
* TmpPath is constructed from a Pathname. Multiple TmpPath instances
* created by copy and assign, share the same reference counted internal
* repesentation.
*
* When the last reference drops any file or directory located at the path
* passed to the ctor is deleted (recursivly in case of directories). This
* behavior can be canged by calling \ref autoCleanup.
*
* Principally serves as base class, but standalone usable.
**/
class TmpPath
{
public:
/**
* Default Ctor. An empty Pathname.
**/
TmpPath();
/**
* Ctor. Takes a Pathname.
**/
explicit
TmpPath( const Pathname & tmpPath_r );
/**
* Dtor.
**/
virtual
~TmpPath();
/**
* Test whether the Pathname is valid (i.e. not empty. NOT whether
* it really denotes an existing file or directory).
**/
explicit operator bool() const;
/**
* @return The Pathname.
**/
Pathname
path() const;
/**
* Type conversion to Pathname.
**/
operator Pathname() const
{ return path(); }
/**
* Whether path is valid and deleted when the last reference drops.
*/
bool autoCleanup() const;
/**
* Turn \ref autoCleanup on/off if path is valid.
*/
void autoCleanup( bool yesno_r );
public:
/**
* @return The default directory where temporary
* files should be are created (/var/tmp).
**/
static const Pathname &
defaultLocation();
protected:
class Impl;
RW_pointer<Impl> _impl;
};
///////////////////////////////////////////////////////////////////
/**
* Stream output as pathname.
**/
inline std::ostream &
operator<<( std::ostream & str, const TmpPath & obj )
{ return str << static_cast<Pathname>(obj); }
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : TmpFile
/**
* @short Provide a new empty temporary file and delete it when no
* longer needed.
*
* The temporary file is per default created in '/var/tmp' and named
* 'TmpFile.XXXXXX', with XXXXXX replaced by a string which makes the
* name unique. Different location and file prefix may be passed to
* the ctor. TmpFile is created with mode 0600.
*
* TmpFile provides the Pathname of the temporary file, or an empty
* path in case of any error.
**/
class TmpFile : public TmpPath
{
public:
/**
* Ctor. Takes a Pathname.
**/
explicit
TmpFile( const Pathname & inParentDir_r = defaultLocation(),
const std::string & prefix_r = defaultPrefix() );
/** Provide a new empty temporary directory as sibling.
* \code
* TmpFile s = makeSibling( "/var/lib/myfile" );
* // returns: /var/lib/myfile.XXXXXX
* \endcode
* If \c sibling_r exists, sibling is created using the same mode.
*/
static TmpFile makeSibling( const Pathname & sibling_r );
public:
/**
* @return The default prefix for temporary files (TmpFile.)
**/
static const std::string &
defaultPrefix();
};
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : TmpDir
/**
* @short Provide a new empty temporary directory and recursively
* delete it when no longer needed.
*
* The temporary directory is per default created in '/var/tmp' and
* named 'TmpDir.XXXXXX', with XXXXXX replaced by a string which makes
* the name unique. Different location and file prefix may be passed
* to the ctor. TmpDir is created with mode 0700.
*
* TmpDir provides the Pathname of the temporary directory , or an empty
* path in case of any error.
**/
class TmpDir : public TmpPath
{
public:
/**
* Ctor. Takes a Pathname.
**/
explicit
TmpDir( const Pathname & inParentDir_r = defaultLocation(),
const std::string & prefix_r = defaultPrefix() );
/** Provide a new empty temporary directory as sibling.
* \code
* TmpDir s = makeSibling( "/var/lib/mydir" );
* // returns: /var/lib/mydir.XXXXXX
* \endcode
* If \c sibling_r exists, sibling is created using the same mode.
*/
static TmpDir makeSibling( const Pathname & sibling_r );
public:
/**
* @return The default prefix for temporary directories (TmpDir.)
**/
static const std::string &
defaultPrefix();
};
///////////////////////////////////////////////////////////////////
} // namespace filesystem
} // namespace zypp
#endif // ZYPP_TMPPATH_H
|