summaryrefslogtreecommitdiffstats
path: root/source/core/slang-io.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-12-10 10:02:19 -0500
committerGitHub <noreply@github.com>2019-12-10 10:02:19 -0500
commit79ec0cfdb5f3461c763e0bf712cf42eb87fccb90 (patch)
treecf0c3c0b6e7f10d3a29930cd3aeef586298d4234 /source/core/slang-io.h
parent2e52217cb870b4101c1639fed78224f89bf119b3 (diff)
DownstreamCompiler abstraction (#1149)
* CPPCompiler -> DownstreamCompiler * Added DownstreamCompileResult to start abstraction such that we don't need files. * * Split out slang-blob.cpp * Made CompileResult hold a DownstreamCompileResult - for access to binary or ISlangSharedLibrary * Keep temporary files in scope. * Add a hash to the hex dump stream. * Move all file tracking into DownstreamCompiler.
Diffstat (limited to 'source/core/slang-io.h')
-rw-r--r--source/core/slang-io.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/core/slang-io.h b/source/core/slang-io.h
index 758a05edb..a42a6991b 100644
--- a/source/core/slang-io.h
+++ b/source/core/slang-io.h
@@ -91,8 +91,12 @@ namespace Slang
};
// Helper class to clean up temporary files on dtor
- struct TemporaryFileSet
+ class TemporaryFileSet: public RefObject
{
+ public:
+ typedef RefObject Super;
+ typedef TemporaryFileSet ThisType;
+
void remove(const String& path)
{
if (const Index index = m_paths.indexOf(path) >= 0)
@@ -119,6 +123,12 @@ namespace Slang
{
m_paths.clear();
}
+
+ void swapWith(ThisType& rhs)
+ {
+ m_paths.swapWith(rhs.m_paths);
+ }
+
~TemporaryFileSet()
{
for (const auto& path : m_paths)
@@ -126,7 +136,15 @@ namespace Slang
File::remove(path);
}
}
+ /// Default Ctor
+ TemporaryFileSet() {}
+
List<String> m_paths;
+
+ private:
+ // Disable ctor/assignment
+ TemporaryFileSet(const ThisType& rhs) = delete;
+ void operator=(const ThisType& rhs) = delete;
};
}