Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef DMELEMENTHANDLE_H
  7. #define DMELEMENTHANDLE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //-----------------------------------------------------------------------------
  12. // handle to an CDmElement
  13. //-----------------------------------------------------------------------------
  14. #define PERFORM_HANDLE_TYPECHECKING 0
  15. #if PERFORM_HANDLE_TYPECHECKING
  16. // this is here to make sure we're being type-safe about element handles
  17. // otherwise, the compiler lets us cast to bool incorrectly
  18. // the other solution would be to redefine DmElementHandle_t s.t. DMELEMENT_HANDLE_INVALID==0
  19. struct DmElementHandle_t
  20. {
  21. DmElementHandle_t() : handle( 0xffffffff ) {}
  22. explicit DmElementHandle_t( int h ) : handle( h ) {}
  23. inline bool operator==( const DmElementHandle_t &h ) const { return handle == h.handle; }
  24. inline bool operator!=( const DmElementHandle_t &h ) const { return handle != h.handle; }
  25. inline bool operator<( const DmElementHandle_t &h ) const { return handle < h.handle; }
  26. // inline operator int() const { return handle; } // if we're okay with implicit int casts, uncomment this method
  27. int handle;
  28. };
  29. const DmElementHandle_t DMELEMENT_HANDLE_INVALID;
  30. #else // PERFORM_HANDLE_TYPECHECKING
  31. enum DmElementHandle_t
  32. {
  33. DMELEMENT_HANDLE_INVALID = 0xffffffff
  34. };
  35. #endif // PERFORM_HANDLE_TYPECHECKING
  36. #endif // DMELEMENTHANDLE_H