|
a/src/utils/rclutil.h |
|
b/src/utils/rclutil.h |
|
... |
|
... |
46 |
|
46 |
|
47 |
/// Create temporary directory (inside the temp location)
|
47 |
/// Create temporary directory (inside the temp location)
|
48 |
extern bool maketmpdir(std::string& tdir, std::string& reason);
|
48 |
extern bool maketmpdir(std::string& tdir, std::string& reason);
|
49 |
|
49 |
|
50 |
/// Temporary file class
|
50 |
/// Temporary file class
|
51 |
class TempFileInternal {
|
51 |
class TempFile {
|
52 |
public:
|
52 |
public:
|
53 |
TempFileInternal(const std::string& suffix);
|
53 |
TempFile(const std::string& suffix);
|
54 |
~TempFileInternal();
|
54 |
TempFile();
|
55 |
const char *filename() {
|
55 |
const char *filename() const;
|
56 |
return m_filename.c_str();
|
|
|
57 |
}
|
|
|
58 |
const std::string& getreason() {
|
56 |
const std::string& getreason() const;
|
59 |
return m_reason;
|
|
|
60 |
}
|
|
|
61 |
void setnoremove(bool onoff) {
|
57 |
void setnoremove(bool onoff);
|
62 |
m_noremove = onoff;
|
|
|
63 |
}
|
|
|
64 |
bool ok() {
|
58 |
bool ok() const;
|
65 |
return !m_filename.empty();
|
59 |
class Internal;
|
66 |
}
|
|
|
67 |
private:
|
60 |
private:
|
68 |
std::string m_filename;
|
61 |
std::shared_ptr<Internal> m;
|
69 |
std::string m_reason;
|
|
|
70 |
bool m_noremove;
|
|
|
71 |
};
|
62 |
};
|
72 |
|
|
|
73 |
typedef std::shared_ptr<TempFileInternal> TempFile;
|
|
|
74 |
|
63 |
|
75 |
/// Temporary directory class. Recursively deleted by destructor.
|
64 |
/// Temporary directory class. Recursively deleted by destructor.
|
76 |
class TempDir {
|
65 |
class TempDir {
|
77 |
public:
|
66 |
public:
|
78 |
TempDir();
|
67 |
TempDir();
|