summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-artifact-handler-impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core/slang-artifact-handler-impl.h')
-rw-r--r--source/compiler-core/slang-artifact-handler-impl.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/compiler-core/slang-artifact-handler-impl.h b/source/compiler-core/slang-artifact-handler-impl.h
new file mode 100644
index 000000000..c7861b598
--- /dev/null
+++ b/source/compiler-core/slang-artifact-handler-impl.h
@@ -0,0 +1,45 @@
+// slang-artifact-handler-impl.h
+#ifndef SLANG_ARTIFACT_HANDLER_IMPL_H
+#define SLANG_ARTIFACT_HANDLER_IMPL_H
+
+#include "slang-artifact.h"
+#include "slang-artifact-representation.h"
+
+#include "../core/slang-com-object.h"
+
+namespace Slang
+{
+
+class DefaultArtifactHandler : public ComBaseObject, public IArtifactHandler
+{
+public:
+ SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE { return 1; }
+ SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE { return 1; }
+ SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface(SlangUUID const& uuid, void** outObject) SLANG_OVERRIDE;
+
+ // ICastable
+ SLANG_NO_THROW void* SLANG_MCALL castAs(const Guid& guid) SLANG_OVERRIDE;
+
+ // IArtifactHandler
+ SLANG_NO_THROW SlangResult SLANG_MCALL expandChildren(IArtifactContainer* container) SLANG_OVERRIDE;
+ SLANG_NO_THROW SlangResult SLANG_MCALL getOrCreateRepresentation(IArtifact* artifact, const Guid& guid, ArtifactKeep keep, ICastable** outCastable) SLANG_OVERRIDE;
+ SLANG_NO_THROW SlangResult SLANG_MCALL getOrCreateFileRepresentation(IArtifact* artifact, ArtifactKeep keep, ISlangMutableFileSystem* fileSystem, IFileArtifactRepresentation** outFileRep) SLANG_OVERRIDE;
+
+ static IArtifactHandler* getSingleton() { return &g_singleton; }
+protected:
+
+ SlangResult _loadSharedLibrary(IArtifact* artifact, ArtifactKeep keep, ISlangSharedLibrary** outSharedLibrary);
+ SlangResult _loadBlob(IArtifact* artifact, ArtifactKeep keep, ISlangBlob** outBlob);
+
+ void* getInterface(const Guid& uuid);
+ void* getObject(const Guid& uuid);
+
+ SlangResult _addRepresentation(IArtifact* artifact, ArtifactKeep keep, ISlangUnknown* rep, ICastable** outCastable);
+ SlangResult _addRepresentation(IArtifact* artifact, ArtifactKeep keep, ICastable* castable, ICastable** outCastable);
+
+ static DefaultArtifactHandler g_singleton;
+};
+
+} // namespace Slang
+
+#endif