FlightGear next
options.cxx File Reference
#include <config.h>
#include <ostream>
#include <simgear/compiler.h>
#include <simgear/structure/exception.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/timing/sg_time.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <cJSON.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <sstream>
#include <simgear/io/HTTPClient.hxx>
#include <simgear/io/HTTPFileRequest.hxx>
#include <simgear/math/sg_random.hxx>
#include <simgear/props/props_io.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/scene/material/mat.hxx>
#include <simgear/sound/soundmgr.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/timing/timestamp.hxx>
#include <Autopilot/route_mgr.hxx>
#include <Aircraft/replay.hxx>
#include <Aircraft/initialstate.hxx>
#include <GUI/gui.h>
#include <GUI/MessageBox.hxx>
#include "AircraftDirVisitorBase.hxx"
#include "fg_init.hxx"
#include "fg_os.hxx"
#include "fg_props.hxx"
#include "globals.hxx"
#include "locale.hxx"
#include "main.hxx"
#include "options.hxx"
#include <AIModel/AIManager.hxx>
#include <Add-ons/AddonManager.hxx>
#include <Environment/presets.hxx>
#include <Main/sentryIntegration.hxx>
#include <Navaids/NavDataCache.hxx>
#include <Network/HTTPClient.hxx>
#include <Network/http/httpd.hxx>
#include <Viewer/view.hxx>
#include <Viewer/viewmgr.hxx>
#include <osg/Version>
#include <flightgearBuildId.h>
#include <simgear/version.h>

Go to the source code of this file.

Classes

class  ShowAircraft
 
struct  OptionDesc
 
class  flightgear::OptionValue
 internal storage of a value->option binding More...
 
class  flightgear::Options::OptionsPrivate
 

Namespaces

namespace  flightgear
 FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information and waypoints.
 

Macros

#define NEW_DEFAULT_MODEL_HZ   120
 

Typedefs

typedef std::vector< OptionValueflightgear::OptionValueVec
 
typedef std::map< string, const OptionDesc * > flightgear::OptionDescDict
 

Enumerations

enum  ParamType { NONE = 0 , VAL_BOOL , REGULAR }
 
enum  OptionType {
  OPT_BOOL = 0 , OPT_STRING , OPT_DOUBLE , OPT_INT ,
  OPT_CHANNEL , OPT_FUNC , OPT_IGNORE
}
 

Functions

static double atof (const string &str)
 
static int atoi (const string &str)
 
static int fgSetupProxy (const char *arg)
 
void fgSetDefaults ()
 Set a few fail-safe default property values.
 
void fgShowAircraft (const vector< SGPath > &path_list)
 
static bool parse_wind (const string &wind, double *min_hdg, double *max_hdg, double *speed, double *gust)
 
static bool parseIntValue (char **ppParserPos, int *pValue, int min, int max, const char *field, const char *argument)
 
static double parse_time (const string &time_in)
 
static long int parse_date (const string &date, const char *timeType)
 
static double parse_degree (const string &degree_str)
 
static long int parse_time_offset (const string &time_str)
 
static double parse_fov (const string &arg)
 
static bool add_channel (const string &type, const string &channel_str)
 
static void clearLocation ()
 
static int fgOptAddon (const char *arg)
 
static int fgOptAdditionalDataDir (const char *arg)
 
static int fgOptVOR (const char *arg)
 
static int fgOptNDB (const char *arg)
 
static int fgOptCarrier (const char *arg)
 
static int fgOptCarrierPos (const char *arg)
 
static int fgOptParkpos (const char *arg)
 
static int fgOptFIX (const char *arg)
 
static int fgOptLon (const char *arg)
 
static int fgOptLat (const char *arg)
 
static int fgOptTACAN (const char *arg)
 
static int fgOptAltitude (const char *arg)
 
static int fgOptUBody (const char *arg)
 
static int fgOptVBody (const char *arg)
 
static int fgOptWBody (const char *arg)
 
static int fgOptVNorth (const char *arg)
 
static int fgOptVEast (const char *arg)
 
static int fgOptVDown (const char *arg)
 
static int fgOptVc (const char *arg)
 
static int fgOptMach (const char *arg)
 
static int fgOptRoc (const char *arg)
 
static int fgOptFgScenery (const char *arg)
 
static int fgOptAllowNasalRead (const char *arg)
 
static int fgOptFov (const char *arg)
 
static int fgOptGeometry (const char *arg)
 
static int fgOptBpp (const char *arg)
 
static int fgOptTimeOffset (const char *arg)
 
static int fgOptStartDateSys (const char *arg)
 
static int fgOptStartDateLat (const char *arg)
 
static int fgOptStartDateGmt (const char *arg)
 
static int fgOptJpgHttpd (const char *arg)
 
static int fgOptHttpd (const char *arg)
 
static int fgOptTraceRead (const char *arg)
 
static int fgOptLogLevel (const char *arg)
 
static int fgOptLogClasses (const char *arg)
 
static int fgOptLogDir (const char *arg)
 
static int fgOptTraceWrite (const char *arg)
 
static int fgOptViewOffset (const char *arg)
 
static int fgOptVisibilityMeters (const char *arg)
 
static int fgOptVisibilityMiles (const char *arg)
 
static int fgOptMetar (const char *arg)
 
static int fgOptConsole (const char *arg)
 
static int fgOptRandomWind (const char *arg)
 
static int fgOptWind (const char *arg)
 
static int fgOptTurbulence (const char *arg)
 
static int fgOptCeiling (const char *arg)
 
static int fgOptWp (const char *arg)
 
static bool parse_colon (const string &s, double *val1, double *val2)
 
static int fgOptFailure (const char *arg)
 
static int fgOptNAV1 (const char *arg)
 
static int fgOptNAV2 (const char *arg)
 
static int fgOptADF (const char *arg)
 
static int fgOptADF1 (const char *arg)
 
static int fgOptADF2 (const char *arg)
 
static int fgOptDME (const char *arg)
 
static int fgOptLivery (const char *arg)
 
static int fgOptScenario (const char *arg)
 
static int fgOptAirport (const char *arg)
 
static int fgOptRunway (const char *arg)
 
static int fgOptCallSign (const char *arg)
 
static int fgOptIgnoreAutosave (const char *arg)
 
static int fgOptFreeze (const char *arg)
 
static int fgOptSetProperty (const char *raw)
 
static std::string urlToLocalPath (const char *url)
 
static int fgOptLoadTape (const char *arg)
 
static int fgOptGUI (const char *arg)
 
static int fgOptHoldShort (const char *arg)
 
static int fgOptNoTrim (const char *arg)
 
static int fgOptInAir (const char *arg)
 
static int flightgear::getOptionParamType (string option)
 
SGPath flightgear::defaultDownloadDir ()
 return the default platform dependant download directory.
 
SGPath flightgear::defaultTextureCacheDir ()
 

Variables

static flightgear::Optionsshared_instance = nullptr
 
static std::string g_load_tape_aircraft
 
static std::string g_load_tape_airport
 
const int OPTION_MULTI = 1 << 17
 
const std::initializer_list< OptionDescfgOptionArray
 

Macro Definition Documentation

◆ NEW_DEFAULT_MODEL_HZ

#define NEW_DEFAULT_MODEL_HZ   120

Definition at line 102 of file options.cxx.

Enumeration Type Documentation

◆ OptionType

enum OptionType
Enumerator
OPT_BOOL 
OPT_STRING 
OPT_DOUBLE 
OPT_INT 
OPT_CHANNEL 
OPT_FUNC 
OPT_IGNORE 

Definition at line 1815 of file options.cxx.

◆ ParamType

enum ParamType
Enumerator
NONE 
VAL_BOOL 
REGULAR 

Definition at line 1814 of file options.cxx.

Function Documentation

◆ add_channel()

static bool add_channel ( const string & type,
const string & channel_str )
static

Definition at line 667 of file options.cxx.

◆ atof()

static double atof ( const string & str)
static

Definition at line 107 of file options.cxx.

◆ atoi()

static int atoi ( const string & str)
static

Definition at line 113 of file options.cxx.

◆ clearLocation()

static void clearLocation ( )
static

Definition at line 682 of file options.cxx.

◆ fgOptAdditionalDataDir()

static int fgOptAdditionalDataDir ( const char * arg)
static

Definition at line 726 of file options.cxx.

◆ fgOptAddon()

static int fgOptAddon ( const char * arg)
static

Definition at line 708 of file options.cxx.

◆ fgOptADF()

static int fgOptADF ( const char * arg)
static

Definition at line 1358 of file options.cxx.

◆ fgOptADF1()

static int fgOptADF1 ( const char * arg)
static

Definition at line 1367 of file options.cxx.

◆ fgOptADF2()

static int fgOptADF2 ( const char * arg)
static

Definition at line 1377 of file options.cxx.

◆ fgOptAirport()

static int fgOptAirport ( const char * arg)
static

Definition at line 1452 of file options.cxx.

◆ fgOptAllowNasalRead()

static int fgOptAllowNasalRead ( const char * arg)
static

Definition at line 930 of file options.cxx.

◆ fgOptAltitude()

static int fgOptAltitude ( const char * arg)
static

Definition at line 814 of file options.cxx.

◆ fgOptBpp()

static int fgOptBpp ( const char * arg)
static

Definition at line 984 of file options.cxx.

◆ fgOptCallSign()

static int fgOptCallSign ( const char * arg)
static

Definition at line 1468 of file options.cxx.

◆ fgOptCarrier()

static int fgOptCarrier ( const char * arg)
static

Definition at line 757 of file options.cxx.

◆ fgOptCarrierPos()

static int fgOptCarrierPos ( const char * arg)
static

Definition at line 765 of file options.cxx.

◆ fgOptCeiling()

static int fgOptCeiling ( const char * arg)
static

Definition at line 1273 of file options.cxx.

◆ fgOptConsole()

static int fgOptConsole ( const char * arg)
static

Definition at line 1231 of file options.cxx.

◆ fgOptDME()

static int fgOptDME ( const char * arg)
static

Definition at line 1387 of file options.cxx.

◆ fgOptFailure()

static int fgOptFailure ( const char * arg)
static

Definition at line 1317 of file options.cxx.

◆ fgOptFgScenery()

static int fgOptFgScenery ( const char * arg)
static

Definition at line 923 of file options.cxx.

◆ fgOptFIX()

static int fgOptFIX ( const char * arg)
static

Definition at line 780 of file options.cxx.

◆ fgOptFov()

static int fgOptFov ( const char * arg)
static

Definition at line 943 of file options.cxx.

◆ fgOptFreeze()

static int fgOptFreeze ( const char * arg)
static

Definition at line 1500 of file options.cxx.

◆ fgOptGeometry()

static int fgOptGeometry ( const char * arg)
static

Definition at line 950 of file options.cxx.

◆ fgOptGUI()

static int fgOptGUI ( const char * arg)
static

Definition at line 1746 of file options.cxx.

◆ fgOptHoldShort()

static int fgOptHoldShort ( const char * arg)
static

Definition at line 1755 of file options.cxx.

◆ fgOptHttpd()

static int fgOptHttpd ( const char * arg)
static

Definition at line 1054 of file options.cxx.

◆ fgOptIgnoreAutosave()

static int fgOptIgnoreAutosave ( const char * arg)
static

Definition at line 1489 of file options.cxx.

◆ fgOptInAir()

static int fgOptInAir ( const char * arg)
static

Definition at line 1773 of file options.cxx.

◆ fgOptJpgHttpd()

static int fgOptJpgHttpd ( const char * arg)
static

Definition at line 1045 of file options.cxx.

◆ fgOptLat()

static int fgOptLat ( const char * arg)
static

Definition at line 797 of file options.cxx.

◆ fgOptLivery()

static int fgOptLivery ( const char * arg)
static

Definition at line 1414 of file options.cxx.

◆ fgOptLoadTape()

static int fgOptLoadTape ( const char * arg)
static

Definition at line 1601 of file options.cxx.

◆ fgOptLogClasses()

static int fgOptLogClasses ( const char * arg)
static

Definition at line 1117 of file options.cxx.

◆ fgOptLogDir()

static int fgOptLogDir ( const char * arg)
static

Definition at line 1126 of file options.cxx.

◆ fgOptLogLevel()

static int fgOptLogLevel ( const char * arg)
static

Definition at line 1108 of file options.cxx.

◆ fgOptLon()

static int fgOptLon ( const char * arg)
static

Definition at line 788 of file options.cxx.

◆ fgOptMach()

static int fgOptMach ( const char * arg)
static

Definition at line 908 of file options.cxx.

◆ fgOptMetar()

static int fgOptMetar ( const char * arg)
static

Definition at line 1220 of file options.cxx.

◆ fgOptNAV1()

static int fgOptNAV1 ( const char * arg)
static

Definition at line 1338 of file options.cxx.

◆ fgOptNAV2()

static int fgOptNAV2 ( const char * arg)
static

Definition at line 1348 of file options.cxx.

◆ fgOptNDB()

static int fgOptNDB ( const char * arg)
static

Definition at line 749 of file options.cxx.

◆ fgOptNoTrim()

static int fgOptNoTrim ( const char * arg)
static

Definition at line 1764 of file options.cxx.

◆ fgOptParkpos()

static int fgOptParkpos ( const char * arg)
static

Definition at line 772 of file options.cxx.

◆ fgOptRandomWind()

static int fgOptRandomWind ( const char * arg)
static

Definition at line 1243 of file options.cxx.

◆ fgOptRoc()

static int fgOptRoc ( const char * arg)
static

Definition at line 916 of file options.cxx.

◆ fgOptRunway()

static int fgOptRunway ( const char * arg)
static

Definition at line 1460 of file options.cxx.

◆ fgOptScenario()

static int fgOptScenario ( const char * arg)
static

Definition at line 1423 of file options.cxx.

◆ fgOptSetProperty()

static int fgOptSetProperty ( const char * raw)
static

Definition at line 1513 of file options.cxx.

◆ fgOptStartDateGmt()

static int fgOptStartDateGmt ( const char * arg)
static

Definition at line 1033 of file options.cxx.

◆ fgOptStartDateLat()

static int fgOptStartDateLat ( const char * arg)
static

Definition at line 1021 of file options.cxx.

◆ fgOptStartDateSys()

static int fgOptStartDateSys ( const char * arg)
static

Definition at line 1009 of file options.cxx.

◆ fgOptTACAN()

static int fgOptTACAN ( const char * arg)
static

Definition at line 806 of file options.cxx.

◆ fgOptTimeOffset()

static int fgOptTimeOffset ( const char * arg)
static

Definition at line 1000 of file options.cxx.

◆ fgOptTraceRead()

static int fgOptTraceRead ( const char * arg)
static

Definition at line 1098 of file options.cxx.

◆ fgOptTraceWrite()

static int fgOptTraceWrite ( const char * arg)
static

Definition at line 1170 of file options.cxx.

◆ fgOptTurbulence()

static int fgOptTurbulence ( const char * arg)
static

Definition at line 1266 of file options.cxx.

◆ fgOptUBody()

static int fgOptUBody ( const char * arg)
static

Definition at line 826 of file options.cxx.

◆ fgOptVBody()

static int fgOptVBody ( const char * arg)
static

Definition at line 838 of file options.cxx.

◆ fgOptVc()

static int fgOptVc ( const char * arg)
static

Definition at line 898 of file options.cxx.

◆ fgOptVDown()

static int fgOptVDown ( const char * arg)
static

Definition at line 886 of file options.cxx.

◆ fgOptVEast()

static int fgOptVEast ( const char * arg)
static

Definition at line 874 of file options.cxx.

◆ fgOptViewOffset()

static int fgOptViewOffset ( const char * arg)
static

Definition at line 1180 of file options.cxx.

◆ fgOptVisibilityMeters()

static int fgOptVisibilityMeters ( const char * arg)
static

Definition at line 1206 of file options.cxx.

◆ fgOptVisibilityMiles()

static int fgOptVisibilityMiles ( const char * arg)
static

Definition at line 1213 of file options.cxx.

◆ fgOptVNorth()

static int fgOptVNorth ( const char * arg)
static

Definition at line 862 of file options.cxx.

◆ fgOptVOR()

static int fgOptVOR ( const char * arg)
static

Definition at line 741 of file options.cxx.

◆ fgOptWBody()

static int fgOptWBody ( const char * arg)
static

Definition at line 850 of file options.cxx.

◆ fgOptWind()

static int fgOptWind ( const char * arg)
static

Definition at line 1254 of file options.cxx.

◆ fgOptWp()

static int fgOptWp ( const char * arg)
static

Definition at line 1290 of file options.cxx.

◆ fgSetDefaults()

void fgSetDefaults ( )

Set a few fail-safe default property values.

These should all be set in $FG_ROOT/defaults.xml, but just in case, we provide some initial sane values here. This method should be invoked before reading any init files.

Definition at line 127 of file options.cxx.

◆ fgSetupProxy()

static int fgSetupProxy ( const char * arg)
static

Definition at line 1066 of file options.cxx.

◆ fgShowAircraft()

void fgShowAircraft ( const vector< SGPath > & path_list)

Definition at line 365 of file options.cxx.

◆ parse_colon()

static bool parse_colon ( const string & s,
double * val1,
double * val2 )
static

Definition at line 1302 of file options.cxx.

◆ parse_date()

static long int parse_date ( const string & date,
const char * timeType )
static

Definition at line 536 of file options.cxx.

◆ parse_degree()

static double parse_degree ( const string & degree_str)
static

Definition at line 597 of file options.cxx.

◆ parse_fov()

static double parse_fov ( const string & arg)
static

Definition at line 627 of file options.cxx.

◆ parse_time()

static double parse_time ( const string & time_in)
static

Definition at line 455 of file options.cxx.

◆ parse_time_offset()

static long int parse_time_offset ( const string & time_str)
static

Definition at line 608 of file options.cxx.

◆ parse_wind()

static bool parse_wind ( const string & wind,
double * min_hdg,
double * max_hdg,
double * speed,
double * gust )
static

Definition at line 378 of file options.cxx.

◆ parseIntValue()

static bool parseIntValue ( char ** ppParserPos,
int * pValue,
int min,
int max,
const char * field,
const char * argument )
static

Definition at line 404 of file options.cxx.

◆ urlToLocalPath()

static std::string urlToLocalPath ( const char * url)
static

Definition at line 1557 of file options.cxx.

Variable Documentation

◆ fgOptionArray

const std::initializer_list<OptionDesc> fgOptionArray

Definition at line 1828 of file options.cxx.

◆ g_load_tape_aircraft

std::string g_load_tape_aircraft
static

Definition at line 1597 of file options.cxx.

◆ g_load_tape_airport

std::string g_load_tape_airport
static

Definition at line 1598 of file options.cxx.

◆ OPTION_MULTI

const int OPTION_MULTI = 1 << 17

Definition at line 1816 of file options.cxx.

◆ shared_instance

flightgear::Options* shared_instance = nullptr
static

Definition at line 104 of file options.cxx.