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.

75 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef DMATTRIBUTEINTERNAL_H
  7. #define DMATTRIBUTEINTERNAL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "datamodel/dmattribute.h"
  12. #include "wchar.h"
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations:
  15. //-----------------------------------------------------------------------------
  16. class IDataModelFactory;
  17. class CUtlBuffer;
  18. class Vector;
  19. class Color;
  20. class CUtlCharConversion;
  21. class CDmElement;
  22. //-----------------------------------------------------------------------------
  23. // Utility class to allow datamodel objects to access private members of CDmAttribute
  24. //-----------------------------------------------------------------------------
  25. class CDmAttributeAccessor
  26. {
  27. public:
  28. static void OnChanged( CDmAttribute *pAttribute, bool bArrayCountChanged = false, bool bIsTopological = false )
  29. {
  30. pAttribute->OnChanged( bArrayCountChanged, bIsTopological );
  31. }
  32. static void DestroyAttribute( CDmAttribute *pOldAttribute )
  33. {
  34. CDmAttribute::DestroyAttribute( pOldAttribute );
  35. }
  36. static bool MarkDirty( CDmAttribute *pAttribute )
  37. {
  38. return pAttribute->MarkDirty();
  39. }
  40. };
  41. //-----------------------------------------------------------------------------
  42. // For serialization, set the delimiter rules
  43. //-----------------------------------------------------------------------------
  44. void SetSerializationDelimiter( CUtlCharConversion *pConv );
  45. void SetSerializationArrayDelimiter( const char *pDelimiter );
  46. //-----------------------------------------------------------------------------
  47. // Skip unserialization for an attribute type (unserialize into a dummy variable)
  48. //-----------------------------------------------------------------------------
  49. bool SkipUnserialize( CUtlBuffer &buf, DmAttributeType_t type );
  50. //-----------------------------------------------------------------------------
  51. // Attribute names/types
  52. //-----------------------------------------------------------------------------
  53. const char *AttributeTypeName( DmAttributeType_t type );
  54. DmAttributeType_t AttributeType( const char *pAttributeType );
  55. //-----------------------------------------------------------------------------
  56. // returns the number of attributes currently allocated
  57. //-----------------------------------------------------------------------------
  58. int GetAllocatedAttributeCount();
  59. #endif // DMATTRIBUTEINTERNAL_H