mavtables
0.2.1
MAVLink router and firewall.
|
#include <Options.hpp>
Public Member Functions | |
Options (int argc, const char *argv[], const Filesystem &filesystem=Filesystem()) | |
bool | ast () |
unsigned int | loglevel () |
std::string | config_file () |
bool | run () |
operator bool () const | |
Related Functions | |
(Note that these are not member functions.) | |
std::optional< std::string > | find_config (const Filesystem &filesystem) |
An options class which is used to parse the command line arguments.
This class is what provides the command line help for mavtables.
Definition at line 42 of file Options.hpp.
Options::Options | ( | int | argc, |
const char * | argv[], | ||
const Filesystem & | filesystem = Filesystem() |
||
) |
Construct an options object.
This will parse the command line arguments and construct an object for passing the result of these arguments to the application.
The first two arguments are designed to be taken directly from the inputs to the standard main
function.
argc | The number of command line arguments given. |
argv | The command line arguments, as given in the arguments to the main function. |
filesystem | A filesystem instance. The default is to construct an instance. This exists for testing purposes. |
std::runtime_error | if no configuration file can be found. |
Definition at line 46 of file Options.cpp.
References config_file(), Filesystem::exists(), and find_config().
bool Options::ast | ( | ) |
Determine whether to print the configuration file's AST or not.
true | Print abstract syntax tree of configuration file. |
false | Don't print abstract syntax tree of configuration file. |
Definition at line 135 of file Options.cpp.
std::string Options::config_file | ( | ) |
Get path to an existing configuration file.
Definition at line 146 of file Options.cpp.
unsigned int Options::loglevel | ( | ) |
Get the log level.
Definition at line 156 of file Options.cpp.
|
explicit |
Determine if the Options object is valid.
true | If the options object successfully parsed the command line arguments. |
false | If the program should exit immediately. |
Definition at line 179 of file Options.cpp.
bool Options::run | ( | ) |
Determine whether to run the firewall/router or not.
true | Run the firewall/router. |
false | Don't run the firewall/router. |
Definition at line 167 of file Options.cpp.
|
related |
Find the configuration file.
Find the first configuration file in the list below:
MAVTABLES_CONFIG_PATH
environment variable..mavtablesrc
in the current directory..mavtablesrc
at $HOME/.mavtablesrc
.PREFIX/etc/mavtables.conf
.filesystem | A filesystem instance. The default is to construct an instance. This exists for testing purposes. |
Definition at line 199 of file Options.cpp.
References Filesystem::exists().