]> git.tdb.fi Git - libs/core.git/blob - source/fs/redirectedpath.h
Remove deprecated things
[libs/core.git] / source / fs / redirectedpath.h
1 #ifndef MSP_FS_REDIRECTEDPATH_H_
2 #define MSP_FS_REDIRECTEDPATH_H_
3
4 #include "path.h"
5
6 namespace Msp {
7 namespace FS {
8
9 /**
10 Provides a redirected path for the lifetime of the object.  When RedirectedPath
11 goes out of scope, it is renamed to the original path.  If destruction happens
12 due to an exception, it is unlinked instead.  The primary use for this is to
13 atomically overwrite a file with a new version.
14 */
15 class RedirectedPath: public Path
16 {
17 private:
18         Path original;
19
20 public:
21         explicit RedirectedPath(const Path &, const char * = ".tmp");
22         RedirectedPath(const Path &, const std::string &);
23         RedirectedPath(const Path &, const Path &);
24         ~RedirectedPath();
25 };
26
27 } // namespace FS
28 } // namespace Msp
29
30 #endif