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