Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* This file is part of the CernVM File System. |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
#ifndef CVMFS_UTIL_RAII_TEMP_DIR_H_ |
6 |
|
|
#define CVMFS_UTIL_RAII_TEMP_DIR_H_ |
7 |
|
|
|
8 |
|
|
#include <string> |
9 |
|
|
|
10 |
|
|
#include "util/export.h" |
11 |
|
|
|
12 |
|
|
/** |
13 |
|
|
* RAII based temporary directory helper class |
14 |
|
|
* |
15 |
|
|
* Instances of the class create a temporary directory which is then |
16 |
|
|
* deleted by the destructor of the class. |
17 |
|
|
* |
18 |
|
|
* The temporary directory is created using the given prefix string |
19 |
|
|
* ("prefix.<UNIQUE_SUFFIX>") |
20 |
|
|
*/ |
21 |
|
|
class CVMFS_EXPORT RaiiTempDir { |
22 |
|
|
public: |
23 |
|
|
static RaiiTempDir* Create(const std::string& prefix); |
24 |
|
|
|
25 |
|
16 |
std::string dir() const { return dir_; } |
26 |
|
|
|
27 |
|
|
~RaiiTempDir(); |
28 |
|
|
|
29 |
|
|
private: |
30 |
|
|
explicit RaiiTempDir(const std::string& prefix); |
31 |
|
|
|
32 |
|
|
std::string dir_; |
33 |
|
|
}; |
34 |
|
|
|
35 |
|
|
#endif // CVMFS_UTIL_RAII_TEMP_DIR_H_ |
36 |
|
|
|