The Nebula Device 3: Util::CmdLineArgs Class Reference

The Nebula Device 3

Util::CmdLineArgs Class Reference

#include <cmdlineargs.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

 CmdLineArgs ()
 default constructor
 CmdLineArgs (const String &cmdLine)
 construct from Win32-style command string
 CmdLineArgs (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) const
 get bool value
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

Member Function Documentation

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

get the command name

Returns the command name.

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

return true if arg exists

Returns true if argument exists.