]> git.mxchange.org Git - flightgear.git/blob - utils/fgcom/fgcom_init.hxx
Canvas: generate keypress event for text input.
[flightgear.git] / utils / fgcom / fgcom_init.hxx
1 //
2 // fgcom_init.hxx -- FGCOM configuration parsing and initialization
3 // FGCOM: Copyright (C) H. Wirtz <wirtz@dfn.de>
4 //
5 // Adaption of fg_init.h from FlightGear
6 // FlightGear: Copyright (C) 1997  Curtis L. Olson  - http://www.flightgear.org/~curt
7 //
8 // Huge part rewritten by Tobias Ramforth to fit needs of FGCOM.
9 // <tobias@ramforth.com>
10 //
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License as
14 // published by the Free Software Foundation; either version 2 of the
15 // License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 // General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
25 //
26
27 #ifndef __INIT_H__
28 #define __INIT_H__
29
30 enum
31 {
32   FGCOM_OPTIONS_OK = 0,
33   FGCOM_OPTIONS_HELP = 1,
34   FGCOM_OPTIONS_ERROR = 2,
35   FGCOM_OPTIONS_EXIT = 3,
36   FGCOM_OPTIONS_VERBOSE_HELP = 4
37 };
38
39 /*
40         option       has_param type        property         b_param s_param  func
41
42         where:
43                 option    : name of the option
44                 has_param : option is --name=value if true or --name if false
45                 type      :     OPTION_BOOL    - property is a boolean
46                                 OPTION_STRING  - property is a string
47                                 OPTION_FLOAT   - property is a float
48                                 OPTION_DOUBLE  - property is a double
49                                 OPTION_FREQ    - property is a double and stands for a frequency
50                                 OPTION_INT     - property is an integer
51                                 OPTION_INT     - property is a char
52
53         For OPTION_FLOAT, OPTION_DOUBLE and OPTION_INT, the parameter value is converted into a
54         float, double or an integer and set to the property.
55 */
56 enum OptionType
57 {
58   OPTION_NONE,
59   OPTION_BOOL,
60   OPTION_STRING,
61   OPTION_FLOAT,
62   OPTION_DOUBLE,
63   OPTION_FREQ,
64   OPTION_INT,
65   OPTION_CHAR
66 };
67
68 typedef struct _OptionEntry OptionEntry;
69
70 struct _OptionEntry
71 {
72   const char *long_option;
73   char option;
74   bool has_param;
75   enum OptionType type;
76   void *parameter;
77   char property;
78   const char *description;
79   const void *default_value;
80 };
81
82 // Read in configuration (file and command line)
83 bool fgcomInitOptions (const OptionEntry * fgcomOptions, int argc, char **argv);
84 void fgcomUsage (); // fgcom usage
85
86 #endif