The Nebula Device 3: Util::CommandLineArgs Class Reference

The Nebula Device 3

Util::CommandLineArgs Class Reference

#include <commandlineargs.h>


Detailed Description

A universal cmd line argument parser. The command line string must have the form

cmd arg0[=]value0 arg1[=]value1 arg2[=]value2

(C) 2006 Radon Labs GmbH

Public Member Functions

 CommandLineArgs ()
 default constructor
 CommandLineArgs (const String &cmdLine)
 construct from Win32-style command string
 CommandLineArgs (int argc, const char **argv)
 construct from posix style command string
const StringGetCmdName () const
 get the command name
bool HasArg (const String &arg) const
 return true if arg exists
const StringGetString (const String &name, const String &defaultValue="") const
 get string value
int GetInt (const String &name, int defaultValue=0) const
 get int value
float GetFloat (const String &name, float defaultValue=0.0f) const
 get float value
bool GetBool (const String &name, bool defaultValue=false) const
 get bool value (key=value)
bool GetBoolFlag (const String &name) const
 get bool flag (args only needs to exist to trigger as true)
Math::float4 GetFloat4 (const String &name, const Math::float4 &defaultValue=Math::float4()) const
 get float4 value
Math::matrix44 GetMatrix44 (const String &name, const Math::matrix44 &defaultValue=Math::matrix44()) const
 get matrix44 value
SizeT GetNumArgs () const
 get number of arguments (exluding command name)
const StringGetStringAtIndex (IndexT index) const
 get string argument at index
int GetIntAtIndex (IndexT index) const
 get int value at index
float GetFloatAtIndex (IndexT index) const
 get float value at index
bool GetBoolAtIndex (IndexT index) const
 get bool value at index
Math::float4 GetFloat4AtIndex (IndexT index) const
 get float4 value at index
Math::matrix44 GetMatrix44AtIndex (IndexT index) const
 get matrix44 value at index
void AppendCommandString (const CommandLineArgs &otherArgs)
 append other command string

Member Function Documentation

const String & Util::CommandLineArgs::GetCmdName (  )  const

get the command name

Returns the command name.

bool Util::CommandLineArgs::HasArg ( const String name  )  const

return true if arg exists

Returns true if argument exists.