2025-02-15 17:26:37 +01:00
|
|
|
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
2010-07-22 01:46:14 -05:00
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
#ifndef TIER0_ICOMMANDLINE_H
|
|
|
|
#define TIER0_ICOMMANDLINE_H
|
|
|
|
#ifdef _WIN32
|
|
|
|
#pragma once
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "tier0/platform.h"
|
2024-10-04 00:39:08 +03:00
|
|
|
#include "tier1/utlstringtoken.h"
|
2010-07-22 01:46:14 -05:00
|
|
|
|
2024-02-07 01:55:45 -08:00
|
|
|
class CBufferString;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: Interface to engine command line
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
abstract_class ICommandLine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void CreateCmdLine( const char *commandline ) = 0;
|
|
|
|
virtual void CreateCmdLine( int argc, char **argv ) = 0;
|
2024-02-07 01:55:45 -08:00
|
|
|
virtual void CreateCmdLinePrependAppName( const char *commandline ) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
// Check whether a particular parameter exists
|
2024-10-04 00:39:08 +03:00
|
|
|
virtual const char *CheckParm( CUtlStringToken param, const char **ppszValue = 0 ) const = 0;
|
|
|
|
virtual bool HasParm( CUtlStringToken param ) const = 0;
|
2013-03-21 21:13:05 -04:00
|
|
|
|
|
|
|
// Gets at particular parameters
|
|
|
|
virtual int ParmCount() const = 0;
|
2024-10-04 00:39:08 +03:00
|
|
|
virtual int FindParm( CUtlStringToken param ) const = 0; // Returns 0 if not found.
|
2013-03-21 21:13:05 -04:00
|
|
|
virtual const char* GetParm( int nIndex ) const = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
// Returns the argument after the one specified, or the default if not found
|
2024-10-04 00:39:08 +03:00
|
|
|
virtual const char *ParmValue( CUtlStringToken param, const char *pDefaultVal = 0 ) const = 0;
|
|
|
|
virtual int ParmValue( CUtlStringToken param, int nDefaultVal ) const = 0;
|
|
|
|
virtual float ParmValue( CUtlStringToken param, float flDefaultVal ) const = 0;
|
|
|
|
virtual bool ParmValue( CUtlStringToken param, const char *pDefaultVal, CBufferString *bufOut ) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
2013-07-12 07:30:00 -05:00
|
|
|
virtual const char **GetParms() const = 0;
|
2024-02-07 01:55:45 -08:00
|
|
|
virtual const char *GetCmdLine( void ) const = 0;
|
2024-10-04 00:39:08 +03:00
|
|
|
virtual void AppendParm( CUtlStringToken param, const char *pszValues ) = 0;
|
2015-09-25 18:42:54 -04:00
|
|
|
|
2024-02-07 01:55:45 -08:00
|
|
|
// Returns true if there's atleast one parm available
|
|
|
|
virtual bool HasParms( void ) const = 0;
|
|
|
|
|
|
|
|
virtual const char *GetUnkString() = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Gets a singleton to the commandline interface
|
|
|
|
// NOTE: The #define trickery here is necessary for backwards compat:
|
|
|
|
// this interface used to lie in the vstdlib library.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
PLATFORM_INTERFACE ICommandLine *CommandLine();
|
|
|
|
|
|
|
|
#endif // TIER0_ICOMMANDLINE_H
|
|
|
|
|