|
ORTS
|
Command line option parser. More...
#include <Options.H>
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 | |
| OMap * | omap |
Static Protected Attributes | |
| static Vector< std::string > | heading_name |
| static Vector< OMap > | options |
| static OMap | s_omap |
Private Member Functions | |
| Options (const Options &) | |
| typedef std::map<std::string, Opt*> Options::OMap |
| typedef OMap::const_iterator Options::OMapCIt |
| typedef OMap::iterator Options::OMapIt |
| static bool Options::get | ( | const std::string & | key, |
| T & | v, | ||
| bool | bReportErr = true |
||
| ) | [inline, static] |
Get value of option.
| key | Name of the option to extract. |
| v | Location to store the retrieved value. |
| bReportErr | If 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.
| void Options::put | ( | const char * | skey, |
| T | 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().
| static bool Options::set | ( | const std::string & | key, |
| T | 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().
Vector< string > Options::heading_name [static, protected] |
OMap* Options::omap [protected] |
Vector< Options::OMap > Options::options [static, protected] |
Options::OMap Options::s_omap [static, protected] |