diff options
Diffstat (limited to 'source/compiler-core/slang-artifact-representation-impl.cpp')
| -rw-r--r-- | source/compiler-core/slang-artifact-representation-impl.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source/compiler-core/slang-artifact-representation-impl.cpp b/source/compiler-core/slang-artifact-representation-impl.cpp index 950ce5d7d..3fae154bb 100644 --- a/source/compiler-core/slang-artifact-representation-impl.cpp +++ b/source/compiler-core/slang-artifact-representation-impl.cpp @@ -67,6 +67,52 @@ bool ExtFileArtifactRepresentation::exists() return SLANG_SUCCEEDED(res) && pathType == getPathType(); } +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SourceBlobWithPathArtifactRepresentation !!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +void* SourceBlobWithPathInfoArtifactRepresentation::getInterface(const Guid& guid) +{ + if (guid == ISlangUnknown::getTypeGuid() || + guid == ICastable::getTypeGuid() || + guid == IArtifactRepresentation::getTypeGuid() || + guid == IPathArtifactRepresentation::getTypeGuid()) + { + return static_cast<IPathArtifactRepresentation*>(this); + } + return nullptr; +} + +void* SourceBlobWithPathInfoArtifactRepresentation::getObject(const Guid& guid) +{ + SLANG_UNUSED(guid); + return nullptr; +} + +void* SourceBlobWithPathInfoArtifactRepresentation::castAs(const Guid& guid) +{ + if (auto intf = getInterface(guid)) + { + return intf; + } + return getObject(guid); +} + +SlangResult SourceBlobWithPathInfoArtifactRepresentation::createRepresentation(const Guid& typeGuid, ICastable** outCastable) +{ + // We can convert into a blob only. + if (typeGuid != ISlangBlob::getTypeGuid()) + { + return SLANG_E_NOT_AVAILABLE; + } + + if (!m_blob) + { + return SLANG_E_NOT_AVAILABLE; + } + + *outCastable = CastableUtil::getCastable(m_blob).detach(); + return SLANG_OK; +} + /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FileArtifactRepresentation !!!!!!!!!!!!!!!!!!!!!!!!!!! */ void* OSFileArtifactRepresentation::getInterface(const Guid& guid) |
