31#include <simgear/misc/strutils.hxx>
94 std::string
valueForOption(
const std::string& key,
const std::string& defValue = std::string())
const;
147 int addOption(
const std::string& key,
const std::string& value);
152 int setOption(
const std::string& key,
const std::string& value);
194 static bool checkForArg(
int argc,
char* argv[],
const char* arg);
216 static std::optional<bool>
checkForBoolArg(
int argc,
char* argv[],
const std::string& checkArg);
222 static bool checkForArgEnable(
int argc,
char* argv[],
const std::string& checkArg);
238 static std::string
getArgValue(
int argc,
char* argv[],
const char* checkArg);
263 void showUsage()
const;
264 void showVersion()
const;
269 void showInfo()
const;
273 void printJSONReport()
const;
277 int parseOption(
const std::string& s,
const std::optional<std::string>& val,
bool fromConfigFile);
279 int parseConfigOption(
const SGPath& path,
bool fromConfigFile);
281 std::string getValueForBooleanOption(
const std::string& str,
const std::string& option,
const std::optional<std::string>& value);
288 static std::optional<std::string> getValueFromNextParam(
int index,
int argc,
char** argv);
290 void processArgResult(
int result);
303 std::unique_ptr<OptionsPrivate> p;
static std::optional< bool > checkForBoolArg(int argc, char *argv[], const std::string &checkArg)
Check if the user has specified a given boolean option.
void setShouldLoadDefaultConfig(bool load)
when using the built-in launcher, we disable the default config files.
int addOption(const std::string &key, const std::string &value)
set an option value, assuming it is not already set (or multiple values are permitted) This can be us...
static void reset()
Delete the entire options object.
OptionResult init(int argc, char *argv[], const SGPath &appDataPath)
pass command line arguments, read default config files
int setOption(const std::string &key, const std::string &value)
set an option, overwriting any existing value which might be set
SGPath platformDefaultRoot() const
OptionResult processOptions()
apply option values to the simulation state (set properties, etc).
string_list extractOptions() const
extractOptions - extract the currently set options as a string array.
static bool checkForArgEnable(int argc, char *argv[], const std::string &checkArg)
Return true when user explicitly enabled boolean option, otherwise false.
void initPaths()
process command line options relating to scenery / aircraft / data paths
string_list valuesForOption(const std::string &key) const
return all values for a multi-valued option
static std::string getArgValue(int argc, char *argv[], const char *checkArg)
getArgValue - get the value of an argument if it exists, or an empty string otherwise
bool isBoolOptionDisable(const std::string &key) const
An overlay on checkBoolOptionSet, to check whether user used the option with explicitly disable it.
void readConfig(const SGPath &path)
parse a config file (eg, .fgfsrc)
static bool paramToBool(const std::string ¶m)
Convert string to bool for boolean options.
bool isBoolOptionEnable(const std::string &key) const
An overlay on checkBoolOptionSet, except that when the user has not used the option at all then false...
static bool checkForArg(int argc, char *argv[], const char *arg)
Check if the arguments array contains a particular string (with a '–' or '-' prefix).
SGPath actualDownloadDir()
the actual download dir in use, which may be the default or a user-supplied value
OptionResult initAircraft()
init the aircraft options
std::string valueForOption(const std::string &key, const std::string &defValue=std::string()) const
read the value for an option, if it has been set
static bool checkForArgDisable(int argc, char *argv[], const std::string &checkArg)
Return true when user explicitly disabled boolean option by set false value.
bool shouldLoadDefaultConfig() const
should defualt configuration files be loaded and processed or not?
std::optional< bool > checkBoolOptionSet(const std::string &key) const
Check if the user has specified a given boolean option.
bool isOptionSet(const std::string &key) const
Check if a particular option has been set (so far).
static Options * sharedInstance()
void clearOption(const std::string &key)
std::vector< std::string > string_list
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
SGPath defaultDownloadDir()
return the default platform dependant download directory.
OptionResult
option processing can have various result values depending on what the user requested.
@ FG_OPTIONS_VERBOSE_HELP
@ FG_OPTIONS_SHOW_AIRCRAFT
@ FG_OPTIONS_SHOW_SOUND_DEVICES
@ FG_OPTIONS_NO_DEFAULT_CONFIG
void fgSetDefaults()
Set a few fail-safe default property values.