diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /sp/src/public/datamodel/dmelementhandle.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/public/datamodel/dmelementhandle.h')
| -rw-r--r-- | sp/src/public/datamodel/dmelementhandle.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sp/src/public/datamodel/dmelementhandle.h b/sp/src/public/datamodel/dmelementhandle.h new file mode 100644 index 00000000..6a96cc1d --- /dev/null +++ b/sp/src/public/datamodel/dmelementhandle.h @@ -0,0 +1,47 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef DMELEMENTHANDLE_H
+#define DMELEMENTHANDLE_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+//-----------------------------------------------------------------------------
+// handle to an CDmElement
+//-----------------------------------------------------------------------------
+#define PERFORM_HANDLE_TYPECHECKING 0
+#if PERFORM_HANDLE_TYPECHECKING
+
+// this is here to make sure we're being type-safe about element handles
+// otherwise, the compiler lets us cast to bool incorrectly
+// the other solution would be to redefine DmElementHandle_t s.t. DMELEMENT_HANDLE_INVALID==0
+struct DmElementHandle_t
+{
+ DmElementHandle_t() : handle( 0xffffffff ) {}
+ explicit DmElementHandle_t( int h ) : handle( h ) {}
+ inline bool operator==( const DmElementHandle_t &h ) const { return handle == h.handle; }
+ inline bool operator!=( const DmElementHandle_t &h ) const { return handle != h.handle; }
+ inline bool operator<( const DmElementHandle_t &h ) const { return handle < h.handle; }
+// inline operator int() const { return handle; } // if we're okay with implicit int casts, uncomment this method
+ int handle;
+};
+const DmElementHandle_t DMELEMENT_HANDLE_INVALID;
+
+#else // PERFORM_HANDLE_TYPECHECKING
+
+enum DmElementHandle_t
+{
+ DMELEMENT_HANDLE_INVALID = 0xffffffff
+};
+
+#endif // PERFORM_HANDLE_TYPECHECKING
+
+
+
+#endif // DMELEMENTHANDLE_H
|