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.

52 lines
1.7 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #if !defined( UTIL_REGISTRY_H )
  8. #define UTIL_REGISTRY_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tier0/platform.h"
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Interface to registry
  15. //-----------------------------------------------------------------------------
  16. abstract_class IRegistry
  17. {
  18. public:
  19. // We have to have a virtual destructor since otherwise the derived class destructors
  20. // will not be called.
  21. virtual ~IRegistry() {}
  22. // Init/shutdown
  23. virtual bool Init( const char *platformName ) = 0;
  24. virtual void Shutdown( void ) = 0;
  25. // Read/write integers
  26. virtual int ReadInt( const char *key, int defaultValue = 0 ) = 0;
  27. virtual void WriteInt( const char *key, int value ) = 0;
  28. // Read/write strings
  29. virtual const char *ReadString( const char *key, const char *defaultValue = 0 ) = 0;
  30. virtual void WriteString( const char *key, const char *value ) = 0;
  31. // Read/write helper methods
  32. virtual int ReadInt( const char *pKeyBase, const char *pKey, int defaultValue = 0 ) = 0;
  33. virtual void WriteInt( const char *pKeyBase, const char *key, int value ) = 0;
  34. virtual const char *ReadString( const char *pKeyBase, const char *key, const char *defaultValue ) = 0;
  35. virtual void WriteString( const char *pKeyBase, const char *key, const char *value ) = 0;
  36. };
  37. extern IRegistry *registry;
  38. // Creates it and calls Init
  39. IRegistry *InstanceRegistry( char const *subDirectoryUnderValve );
  40. // Calls Shutdown and deletes it
  41. void ReleaseInstancedRegistry( IRegistry *reg );
  42. #endif // UTIL_REGISTRY_H