aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file-cache.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/file-cache.ixx')
-rw-r--r--libbuild2/file-cache.ixx38
1 files changed, 38 insertions, 0 deletions
diff --git a/libbuild2/file-cache.ixx b/libbuild2/file-cache.ixx
new file mode 100644
index 0000000..259d348
--- /dev/null
+++ b/libbuild2/file-cache.ixx
@@ -0,0 +1,38 @@
+// file : libbuild2/file-cache.ixx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+#include <libbuild2/filesystem.hxx> // try_rmfile()
+
+namespace build2
+{
+ inline file_cache::entry::
+ entry (path_type p, bool t)
+ : temporary (t), path_ (move (p))
+ {
+ }
+
+ inline file_cache::entry::
+ ~entry ()
+ {
+ if (!path_.empty () && temporary)
+ try_rmfile (path_, true /* ignore_errors */);
+ }
+
+ inline file_cache::entry::
+ entry (entry&& e)
+ : temporary (e.temporary), path_ (move (e.path_))
+ {
+ }
+
+ inline file_cache::entry& file_cache::entry::
+ operator= (entry&& e)
+ {
+ if (this != &e)
+ {
+ assert (path_.empty ());
+ temporary = e.temporary;
+ path_ = move (e.path_);
+ }
+ return *this;
+ }
+}