From 4bbd0e70a246290ce5c0e0a80b951fec504b6844 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 22 Jun 2018 17:36:59 -0400 Subject: Feature/com helper (#606) * Added Result definitions to the slang.h * Removed slang-result.h and added slang-com-helper.h * Move slang-com-ptr.h to be publically available. * Add SLANG_IUNKNOWN macros to simplify implementing interfaces. Use the SLANG_IUNKNOWN macros to in slang.c * Removed slang-defines.h added outstanding defines to slang.h * Include slang-com-ptr.h and slang-com-helper.h in archives built with CI. * Use spaces instead of tabs on appveyor.yml * Put operator== and != for Guid in global namespace. * Fix binary windows archive to have all the slang headers. --- slang-com-helper.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'slang-com-helper.h') diff --git a/slang-com-helper.h b/slang-com-helper.h index 1b4469db1..e108dcf00 100644 --- a/slang-com-helper.h +++ b/slang-com-helper.h @@ -37,8 +37,13 @@ typedef SlangResult Result; // Alias SlangUUID to Slang::Guid typedef SlangUUID Guid; -SLANG_FORCE_INLINE bool operator==(const Guid& aIn, const Guid& bIn) +} // namespace Slang + +// Operator == and != for Guid/SlangUUID + +SLANG_FORCE_INLINE bool operator==(const Slang::Guid& aIn, const Slang::Guid& bIn) { + using namespace Slang; // Use the largest type the honors the alignment of Guid typedef uint32_t CmpType; union GuidCompare @@ -53,12 +58,11 @@ SLANG_FORCE_INLINE bool operator==(const Guid& aIn, const Guid& bIn) return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2]) | (a[3] ^ b[3])) == 0; } -SLANG_FORCE_INLINE bool operator!=(const Guid& a, const Guid& b) +SLANG_FORCE_INLINE bool operator!=(const Slang::Guid& a, const Slang::Guid& b) { return !(a == b); } - /* !!!!!!!! Macros to simplify implementing COM interfaces !!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* Assumes underlying implementation has a member m_refCount that is initialized to 0 and can have ++ and -- operate on it. @@ -101,7 +105,6 @@ SLANG_NO_THROW uint32_t SLANG_MCALL release() \ SLANG_IUNKNOWN_ADD_REF \ SLANG_IUNKNOWN_RELEASE -} // namespace Slang #endif // defined(__cplusplus) #endif -- cgit v1.2.3