summaryrefslogtreecommitdiff
path: root/public/datamodel/dmelementhandle.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/datamodel/dmelementhandle.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'public/datamodel/dmelementhandle.h')
-rw-r--r--public/datamodel/dmelementhandle.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/public/datamodel/dmelementhandle.h b/public/datamodel/dmelementhandle.h
new file mode 100644
index 0000000..319f308
--- /dev/null
+++ b/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