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.

68 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #if !defined( CVAR_H )
  9. #define CVAR_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations
  15. //-----------------------------------------------------------------------------
  16. class ConVar;
  17. class ConCommandBase;
  18. class CCommand;
  19. class CUtlBuffer;
  20. //-----------------------------------------------------------------------------
  21. // Purpose:
  22. //-----------------------------------------------------------------------------
  23. class CCvarUtilities
  24. {
  25. public:
  26. bool IsCommand( const CCommand &args );
  27. // Writes lines containing "set variable value" for all variables
  28. // with the archive flag set to true.
  29. void WriteVariables( CUtlBuffer &buff, bool bAllVars );
  30. // Returns the # of cvars with the server flag set.
  31. int CountVariablesWithFlags( int flags );
  32. // Lists cvars to console
  33. void CvarList( const CCommand &args );
  34. // Prints help text for cvar
  35. void CvarHelp( const CCommand &args );
  36. // Revert all cvar values
  37. void CvarRevert( const CCommand &args );
  38. // Revert all cvar values
  39. void CvarDifferences( const CCommand &args );
  40. // Toggles a cvar on/off, or cycles through a set of values
  41. void CvarToggle( const CCommand &args );
  42. // Finds commands with a specified flag.
  43. void CvarFindFlags_f( const CCommand &args );
  44. private:
  45. // just like Cvar_set, but optimizes out the search
  46. void SetDirect( ConVar *var, const char *value );
  47. bool IsValidToggleCommand( const char *cmd );
  48. };
  49. extern CCvarUtilities *cv;
  50. #endif // CVAR_H