Team Fortress 2 Source Code as on 22/4/2020
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.

66 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef SAVERESTORE_UTLCLASS_H
  7. #define SAVERESTORE_UTLCLASS_H
  8. #if defined( _WIN32 )
  9. #pragma once
  10. #endif
  11. //-------------------------------------
  12. template <int FIELD_TYPE>
  13. class CTypedescDeducer
  14. {
  15. public:
  16. template <class UTLCLASS>
  17. static datamap_t *Deduce( UTLCLASS *p )
  18. {
  19. return NULL;
  20. }
  21. };
  22. template<>
  23. class CTypedescDeducer<FIELD_EMBEDDED>
  24. {
  25. public:
  26. template <class UTLCLASS>
  27. static datamap_t *Deduce( UTLCLASS *p )
  28. {
  29. return &UTLCLASS::ElemType_t::m_DataMap;
  30. }
  31. };
  32. #define UTLCLASS_SAVERESTORE_VALIDATE_TYPE( type ) \
  33. COMPILE_TIME_ASSERT( \
  34. type == FIELD_FLOAT ||\
  35. type == FIELD_STRING ||\
  36. type == FIELD_CLASSPTR ||\
  37. type == FIELD_EHANDLE ||\
  38. type == FIELD_EDICT ||\
  39. type == FIELD_VECTOR ||\
  40. type == FIELD_QUATERNION ||\
  41. type == FIELD_POSITION_VECTOR ||\
  42. type == FIELD_INTEGER ||\
  43. type == FIELD_BOOLEAN ||\
  44. type == FIELD_SHORT ||\
  45. type == FIELD_CHARACTER ||\
  46. type == FIELD_TIME ||\
  47. type == FIELD_TICK ||\
  48. type == FIELD_MODELNAME ||\
  49. type == FIELD_SOUNDNAME ||\
  50. type == FIELD_COLOR32 ||\
  51. type == FIELD_EMBEDDED ||\
  52. type == FIELD_MODELINDEX ||\
  53. type == FIELD_MATERIALINDEX\
  54. )
  55. //-------------------------------------
  56. #endif // SAVERESTORE_UTLCLASS_H