diff options
Diffstat (limited to 'source/core/slang-castable-list-impl.cpp')
| -rw-r--r-- | source/core/slang-castable-list-impl.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/core/slang-castable-list-impl.cpp b/source/core/slang-castable-list-impl.cpp index 56f8c7cae..dcc58e37b 100644 --- a/source/core/slang-castable-list-impl.cpp +++ b/source/core/slang-castable-list-impl.cpp @@ -3,7 +3,24 @@ namespace Slang { - /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! UnknownCastableAdapter !!!!!!!!!!!!!!!!!!!!!!!!!!! */ +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CastableUtil !!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +/* static */ComPtr<ICastable> CastableUtil::getCastable(ISlangUnknown* unk) +{ + SLANG_ASSERT(unk); + ComPtr<ICastable> castable; + if (SLANG_SUCCEEDED(unk->queryInterface(ICastable::getTypeGuid(), (void**)castable.writeRef()))) + { + SLANG_ASSERT(castable); + } + else + { + castable = new UnknownCastableAdapter(unk); + } + return castable; +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! UnknownCastableAdapter !!!!!!!!!!!!!!!!!!!!!!!!!!! */ void* UnknownCastableAdapter::castAs(const Guid& guid) { |
