ORTS
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions

Options Class Reference

Command line option parser. More...

#include <Options.H>

List of all members.

Classes

struct  Type

Public Types

typedef std::map< std::string,
Opt * > 
OMap
typedef OMap::iterator OMapIt
typedef OMap::const_iterator OMapCIt

Public Member Functions

template<class T >
void put (const char *skey, T v, const char *remark=0)
 Add an option that takes a parameter.
void put (const char *skey, const char *remark=0)
 Add a flag - does not take any parameters.
 Options (std::string heading="")
virtual ~Options ()

Static Public Member Functions

template<class T >
static bool get (const std::string &key, T &v, bool bReportErr=true)
 Get value of option.
template<class T >
static bool set (const std::string &key, T v, bool bReportErr=true)
static void write (std::ostream &os)
static void reset ()
static bool process (sint4 argc, char **argv, std::ostream &oserr, const char *remark=0)
static bool process2 (sint4 argc, char **argv, std::ostream &oserr, Vector< std::string > &rest)
static bool process (const std::string &args, std::ostream &oserr, const char *remark)

Protected Attributes

OMapomap

Static Protected Attributes

static Vector< std::string > heading_name
static Vector< OMapoptions
static OMap s_omap

Private Member Functions

 Options (const Options &)

Detailed Description

Command line option parser.

Definition at line 57 of file Options.H.


Member Typedef Documentation

typedef std::map<std::string, Opt*> Options::OMap

Definition at line 61 of file Options.H.

typedef OMap::const_iterator Options::OMapCIt

Definition at line 63 of file Options.H.

typedef OMap::iterator Options::OMapIt

Definition at line 62 of file Options.H.


Constructor & Destructor Documentation

Options::Options ( std::string  heading = "")

Definition at line 32 of file Options.C.

Options::~Options ( ) [virtual]

Definition at line 14 of file Options.C.

Options::Options ( const Options ) [inline, private]

Definition at line 255 of file Options.H.


Member Function Documentation

template<class T >
static bool Options::get ( const std::string &  key,
T &  v,
bool  bReportErr = true 
) [inline, static]

Get value of option.

Parameters:
keyName of the option to extract.
vLocation to store the retrieved value.
bReportErrIf true, then function reports errors (ERR iff illegal). If false, the function returns true on errors. This is useful in cases where we would like to fail silently or report/handle the error in the calling code.

Definition at line 178 of file Options.H.

References ERR, errstr, s_omap, and OptT< T >::value.

Referenced by BaseDefense::BaseDefense(), Worlded::change_tiles(), TR_EventHandler::compute_actions(), SampleEventHandler::compute_actions(), SquadCombatAI::compute_influence(), SquadCombatAI::compute_squad_motion2(), GameStateModule::connect(), create_orts_world(), FFLocPath::FFLocPath(), Worlded::generate_map(), MapTool::Options::get(), Game::get_client_world(), GUI::GUI(), Simul::SimulationAI::handle_event(), PathFinder::handle_event(), GfxEventHandler::handle_event(), SimpleTerrain::ST_ForceField::init(), SimpleTerrain::ST_Terrain::init(), FileLoader::init(), FFLocPath::init(), Tokenizer::init_cmd_def(), PathFinder::init_env(), Worlded::initialize(), SimpleTerrain::ST_Terrain::PFEngine::Map::insert_boundary(), polypath_looper::loop(), Looper::loop(), PolypathLooper::loop(), main(), Server::Options::Options(), ViewReplayer::Options::Options(), Replayer::Options::Options(), GfxModule::Options::Options(), GameStateModule::Options::Options(), Game::Options::Options(), ortsgLooper::ortsgLooper(), GfxModule::process_changes(), VecField::Randomizer::Randomizer(), Net_Worker::run(), SquadCombatAI::ShooterData::ShooterData(), SquadCombatAI::SquadCombatAI(), SimpleTerrain::ST_ForceField::ST_ForceField(), SimpleTerrain::ST_Terrain::ST_Terrain(), Decomp::test(), and Minimap::update_texture().

bool Options::process ( const std::string &  args,
std::ostream &  oserr,
const char *  remark 
) [static]

Definition at line 247 of file Options.C.

References FORALL, form(), Opt::from_string(), and Opt::param.

bool Options::process ( sint4  argc,
char **  argv,
std::ostream &  oserr,
const char *  remark = 0 
) [static]

Definition at line 171 of file Options.C.

References Opt::from_string(), and Opt::param.

Referenced by main(), and Net_Worker::run().

bool Options::process2 ( sint4  argc,
char **  argv,
std::ostream &  oserr,
Vector< std::string > &  rest 
) [static]

Definition at line 210 of file Options.C.

References Vector< T >::find(), Opt::from_string(), and Opt::param.

Referenced by main().

void Options::put ( const char *  skey,
const char *  remark = 0 
) [inline]

Add a flag - does not take any parameters.

Definition at line 126 of file Options.H.

References ERR, errstr, Opt::param, Opt::remark, s_omap, and OptT< T >::value.

template<class T >
void Options::put ( const char *  skey,
v,
const char *  remark = 0 
) [inline]

Add an option that takes a parameter.

Definition at line 82 of file Options.H.

References ERR, errstr, Opt::remark, s_omap, OptT< T >::to_string(), and OptT< T >::value.

Referenced by Worlded::add_options(), tmanager::add_options(), GUI::add_options(), add_options(), main(), and path_add_options().

void Options::reset ( ) [static]

Definition at line 152 of file Options.C.

References FORALL.

template<class T >
static bool Options::set ( const std::string &  key,
v,
bool  bReportErr = true 
) [inline, static]

Definition at line 209 of file Options.H.

References ERR, errstr, s_omap, and OptT< T >::value.

Referenced by Worlded::generate_map(), Worlded::initialize(), main(), and MapTool::read_height_map().

void Options::write ( std::ostream &  os) [static]

Definition at line 140 of file Options.C.

References FORALL, and form().

Referenced by tmanager::Error().


Member Data Documentation

Vector< string > Options::heading_name [static, protected]

Definition at line 67 of file Options.H.

OMap* Options::omap [protected]

Definition at line 71 of file Options.H.

Vector< Options::OMap > Options::options [static, protected]

Definition at line 68 of file Options.H.

Options::OMap Options::s_omap [static, protected]

Definition at line 69 of file Options.H.

Referenced by get(), put(), and set().


The documentation for this class was generated from the following files:


Generated on Fri May 18 2012 03:03:04 for ORTS by Doxygen1.7.3