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.

56 lines
2.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef VSTDLIB_IKEYVALUESSYSTEM_H
  8. #define VSTDLIB_IKEYVALUESSYSTEM_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "vstdlib/vstdlib.h"
  13. // handle to a KeyValues key name symbol
  14. typedef int HKeySymbol;
  15. #define INVALID_KEY_SYMBOL (-1)
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Interface to shared data repository for KeyValues (included in vgui_controls.lib)
  18. // allows for central data storage point of KeyValues symbol table
  19. //-----------------------------------------------------------------------------
  20. class IKeyValuesSystem
  21. {
  22. public:
  23. // registers the size of the KeyValues in the specified instance
  24. // so it can build a properly sized memory pool for the KeyValues objects
  25. // the sizes will usually never differ but this is for versioning safety
  26. virtual void RegisterSizeofKeyValues(int size) = 0;
  27. // allocates/frees a KeyValues object from the shared mempool
  28. virtual void *AllocKeyValuesMemory(int size) = 0;
  29. virtual void FreeKeyValuesMemory(void *pMem) = 0;
  30. // symbol table access (used for key names)
  31. virtual HKeySymbol GetSymbolForString( const char *name, bool bCreate = true ) = 0;
  32. virtual const char *GetStringForSymbol(HKeySymbol symbol) = 0;
  33. // for debugging, adds KeyValues record into global list so we can track memory leaks
  34. virtual void AddKeyValuesToMemoryLeakList(void *pMem, HKeySymbol name) = 0;
  35. virtual void RemoveKeyValuesFromMemoryLeakList(void *pMem) = 0;
  36. // set/get a value for keyvalues resolution symbol
  37. // e.g.: SetKeyValuesExpressionSymbol( "LOWVIOLENCE", true ) - enables [$LOWVIOLENCE]
  38. virtual void SetKeyValuesExpressionSymbol( const char *name, bool bValue ) = 0;
  39. virtual bool GetKeyValuesExpressionSymbol( const char *name ) = 0;
  40. // symbol table access from code with case-preserving requirements (used for key names)
  41. virtual HKeySymbol GetSymbolForStringCaseSensitive( HKeySymbol &hCaseInsensitiveSymbol, const char *name, bool bCreate = true ) = 0;
  42. };
  43. VSTDLIB_INTERFACE IKeyValuesSystem *KeyValuesSystem();
  44. // #define KEYVALUESSYSTEM_INTERFACE_VERSION "KeyValuesSystem002"
  45. #endif // VSTDLIB_IKEYVALUESSYSTEM_H