1#ifndef SLANG_COM_HELPER_H
2#define SLANG_COM_HELPER_H
17#ifndef SLANG_HANDLE_RESULT_FAIL
18 #define SLANG_HANDLE_RESULT_FAIL(x)
23#define SLANG_RETURN_ON_FAIL(x) \
25 SlangResult _res = (x); \
26 if (SLANG_FAILED(_res)) \
28 SLANG_HANDLE_RESULT_FAIL(_res); \
34#define SLANG_RETURN_VOID_ON_FAIL(x) \
36 SlangResult _res = (x); \
37 if (SLANG_FAILED(_res)) \
39 SLANG_HANDLE_RESULT_FAIL(_res); \
44#define SLANG_RETURN_FALSE_ON_FAIL(x) \
46 SlangResult _res = (x); \
47 if (SLANG_FAILED(_res)) \
49 SLANG_HANDLE_RESULT_FAIL(_res); \
54#define SLANG_RETURN_NULL_ON_FAIL(x) \
56 SlangResult _res = (x); \
57 if (SLANG_FAILED(_res)) \
59 SLANG_HANDLE_RESULT_FAIL(_res); \
66#define SLANG_ASSERT_ON_FAIL(x) \
68 SlangResult _res = (x); \
69 if (SLANG_FAILED(_res)) \
76#define SLANG_ASSERT_VOID_ON_FAIL(x) \
78 SlangResult _res = (x); \
79 if (SLANG_FAILED(_res)) \
88#if defined(__cplusplus)
103 return aIn.
data1 == bIn.data1 && aIn.data2 == bIn.data2 && aIn.data3 == bIn.data3 &&
104 std::equal(aIn.data4, aIn.data4 + std::size(aIn.data4), bIn.data4);
118 #define SLANG_IUNKNOWN_QUERY_INTERFACE \
119 SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface( \
120 SlangUUID const& uuid, \
121 void** outObject) SLANG_OVERRIDE \
123 ISlangUnknown* intf = getInterface(uuid); \
130 return SLANG_E_NO_INTERFACE; \
133 #define SLANG_IUNKNOWN_ADD_REF \
134 SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE \
136 return ++m_refCount; \
139 #define SLANG_IUNKNOWN_RELEASE \
140 SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE \
143 if (m_refCount == 0) \
151 #define SLANG_IUNKNOWN_ALL \
152 SLANG_IUNKNOWN_QUERY_INTERFACE \
153 SLANG_IUNKNOWN_ADD_REF \
154 SLANG_IUNKNOWN_RELEASE
158 #define SLANG_REF_OBJECT_IUNKNOWN_QUERY_INTERFACE \
159 SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface( \
160 SlangUUID const& uuid, \
161 void** outObject) SLANG_OVERRIDE \
163 void* intf = getInterface(uuid); \
170 return SLANG_E_NO_INTERFACE; \
173 #define SLANG_REF_OBJECT_IUNKNOWN_ADD_REF \
174 SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE \
176 return (uint32_t)addReference(); \
178 #define SLANG_REF_OBJECT_IUNKNOWN_RELEASE \
179 SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE \
181 return (uint32_t)releaseReference(); \
184 #define SLANG_REF_OBJECT_IUNKNOWN_ALL \
185 SLANG_REF_OBJECT_IUNKNOWN_QUERY_INTERFACE \
186 SLANG_REF_OBJECT_IUNKNOWN_ADD_REF \
187 SLANG_REF_OBJECT_IUNKNOWN_RELEASE
bool operator==(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition json.hpp:14737
bool operator!=(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition json.hpp:14762
Definition slang-com-ptr.h:10
int32_t SlangResult
Definition slang-cpp-prelude.h:300
#define SLANG_FORCE_INLINE
Definition slang-cpp-prelude.h:286
Definition slang-cpp-prelude.h:293
uint32_t data1
Definition slang-cpp-prelude.h:294