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.

61 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef TIER0_ICOMMANDLINE_H
  7. #define TIER0_ICOMMANDLINE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier0/platform.h"
  12. //-----------------------------------------------------------------------------
  13. // Purpose: Interface to engine command line
  14. //-----------------------------------------------------------------------------
  15. abstract_class ICommandLine
  16. {
  17. public:
  18. virtual void CreateCmdLine( const char *commandline ) = 0;
  19. virtual void CreateCmdLine( int argc, char **argv ) = 0;
  20. virtual const char *GetCmdLine( void ) const = 0;
  21. // Check whether a particular parameter exists
  22. virtual const char *CheckParm( const char *psz, const char **ppszValue = 0 ) const = 0;
  23. // A bool return of whether param exists, useful for just checking if param that is just a flag is set
  24. virtual bool HasParm( const char *psz ) const = 0;
  25. virtual void RemoveParm( const char *parm ) = 0;
  26. virtual void AppendParm( const char *pszParm, const char *pszValues ) = 0;
  27. // Returns the argument after the one specified, or the default if not found
  28. virtual const char *ParmValue( const char *psz, const char *pDefaultVal = 0 ) const = 0;
  29. virtual int ParmValue( const char *psz, int nDefaultVal ) const = 0;
  30. virtual float ParmValue( const char *psz, float flDefaultVal ) const = 0;
  31. // Gets at particular parameters
  32. virtual int ParmCount() const = 0;
  33. virtual int FindParm( const char *psz ) const = 0; // Returns 0 if not found.
  34. virtual const char* GetParm( int nIndex ) const = 0;
  35. // copies the string passwed
  36. virtual void SetParm( int nIndex, char const *pNewParm ) =0;
  37. virtual const char *ParmValueByIndex( int nIndex, const char *pDefaultVal = 0 ) const = 0;
  38. };
  39. //-----------------------------------------------------------------------------
  40. // Gets a singleton to the commandline interface
  41. // NOTE: The #define trickery here is necessary for backwards compat:
  42. // this interface used to lie in the vstdlib library.
  43. //-----------------------------------------------------------------------------
  44. PLATFORM_INTERFACE ICommandLine *CommandLine_Tier0();
  45. #if !defined( VSTDLIB_BACKWARD_COMPAT )
  46. #define CommandLine CommandLine_Tier0
  47. #endif
  48. #endif // TIER0_ICOMMANDLINE_H