init
This commit is contained in:
61
tier1/commandline.cpp
Normal file
61
tier1/commandline.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "tier1/commandline.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
CUtlVector<char*> cl_params;
|
||||
|
||||
void ICommandLine::CreateCommandLine( int argc, char **argv )
|
||||
{
|
||||
cl_params.AppendTail(argv,argc);
|
||||
}
|
||||
|
||||
bool ICommandLine::CheckParam( char *psz )
|
||||
{
|
||||
for (auto szParam: cl_params) {
|
||||
V_printf("%s\n",szParam);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
char *ICommandLine::ParamValue( const char *psz )
|
||||
{
|
||||
int i = 0;
|
||||
for (auto szParam: cl_params) {
|
||||
i++;
|
||||
if (i>=cl_params.GetSize())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (!V_strcmp(szParam, psz))
|
||||
return cl_params[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ICommandLine::AddParam( char *psz )
|
||||
{
|
||||
}
|
||||
|
||||
void ICommandLine::RemoveParam( char *psz )
|
||||
{
|
||||
|
||||
}
|
||||
int ICommandLine::ParamCount()
|
||||
{
|
||||
return cl_params.GetSize();
|
||||
}
|
||||
int ICommandLine::FindParam( const char *psz )
|
||||
{
|
||||
int i = 0;
|
||||
for (auto szParam: cl_params) {
|
||||
if (!V_strcmp(szParam, psz))
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
const char *ICommandLine::GetParam(int nIndex)
|
||||
{
|
||||
return cl_params[nIndex];
|
||||
}
|
||||
|
||||
static ICommandLine g_CommandLine;
|
||||
Reference in New Issue
Block a user