summaryrefslogtreecommitdiff
path: root/slang-com-helper.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-06-22 17:36:59 -0400
committerGitHub <noreply@github.com>2018-06-22 17:36:59 -0400
commit4bbd0e70a246290ce5c0e0a80b951fec504b6844 (patch)
tree76dd986b5db8c6a29adae6b273391898245088c9 /slang-com-helper.h
parent4fa0111bb35f260a06527f52f71552041827c7df (diff)
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.
Diffstat (limited to 'slang-com-helper.h')
-rw-r--r--slang-com-helper.h11
1 files changed, 7 insertions, 4 deletions
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