diff options
Diffstat (limited to 'source/core/slang-castable-list-impl.cpp')
| -rw-r--r-- | source/core/slang-castable-list-impl.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/core/slang-castable-list-impl.cpp b/source/core/slang-castable-list-impl.cpp index ee10ea995..56f8c7cae 100644 --- a/source/core/slang-castable-list-impl.cpp +++ b/source/core/slang-castable-list-impl.cpp @@ -36,9 +36,10 @@ void* UnknownCastableAdapter::castAs(const Guid& guid) void* UnknownCastableAdapter::getInterface(const Guid& guid) { if (guid == ISlangUnknown::getTypeGuid() || - guid == ICastable::getTypeGuid()) + guid == ICastable::getTypeGuid() || + guid == IUnknownCastableAdapter::getTypeGuid()) { - return static_cast<ICastable*>(this); + return static_cast<IUnknownCastableAdapter*>(this); } return nullptr; } @@ -97,6 +98,18 @@ void* CastableList::find(const Guid& guid) return nullptr; } +ICastable* SLANG_MCALL CastableList::findWithPredicate(FindFunc func, void* data) +{ + for (ICastable* castable : m_list) + { + if (func(castable, data)) + { + return castable; + } + } + return nullptr; +} + Index CastableList::indexOf(ICastable* castable) { const Count count = m_list.getCount(); |
