1 // options.hxx -- class to handle command line options
3 // Written by Curtis Olson, started April 1998.
5 // Copyright (C) 1998 Curtis L. Olson - http://www.flightgear.org/~curt
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 #include <simgear/misc/strutils.hxx>
44 static Options* sharedInstance();
49 * pass command line arguments, read default config files
51 void init(int argc, char* argv[], const SGPath& appDataPath);
54 * parse a config file (eg, .fgfsrc)
56 void readConfig(const SGPath& path);
59 * read the value for an option, if it has been set
61 std::string valueForOption(const std::string& key, const std::string& defValue = std::string()) const;
64 * return all values for a multi-valued option
66 string_list valuesForOption(const std::string& key) const;
69 * check if a particular option has been set (so far)
71 bool isOptionSet(const std::string& key) const;
75 * set an option value, assuming it is not already set (or multiple values
77 * This can be used to inject option values, eg based upon environment variables
79 int addOption(const std::string& key, const std::string& value);
82 * apply option values to the simulation state
83 * (set properties, etc)
85 void processOptions();
88 * init the aircraft options
92 void showUsage() const;
94 int parseOption(const std::string& s);
96 void processArgResult(int result);
100 std::string platformDefaultRoot() const;
102 class OptionsPrivate;
103 std::auto_ptr<OptionsPrivate> p;
106 } // of namespace flightgear
108 #endif /* _OPTIONS_HXX */