LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / extensionsystem / optionsparser.h
blob6132a1ba291302c075c4376349a09491bfd348d8
1 /**
2 ******************************************************************************
4 * @file optionsparser.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @brief
8 * @see The GNU Public License (GPL) Version 3
9 * @defgroup
10 * @{
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef OPTIONSPARSER_H
30 #define OPTIONSPARSER_H
32 #include "pluginmanager_p.h"
34 #include <QtCore/QStringList>
35 #include <QtCore/QMap>
37 namespace ExtensionSystem {
38 namespace Internal {
39 class OptionsParser {
40 public:
41 OptionsParser(const QStringList &args,
42 const QMap<QString, bool> &appOptions,
43 QMap<QString, QString> *foundAppOptions,
44 QString *errorString,
45 PluginManagerPrivate *pmPrivate);
47 bool parse();
49 static const char *NO_LOAD_OPTION;
50 static const char *TEST_OPTION;
51 private:
52 // return value indicates if the option was processed
53 // it doesn't indicate success (--> m_hasError)
54 bool checkForEndOfOptions();
55 bool checkForNoLoadOption();
56 bool checkForTestOption();
57 bool checkForAppOption();
58 bool checkForPluginOption();
59 bool checkForUnknownOption();
61 enum TokenType { OptionalToken, RequiredToken };
62 bool nextToken(TokenType type = OptionalToken);
64 const QStringList &m_args;
65 const QMap<QString, bool> &m_appOptions;
66 QMap<QString, QString> *m_foundAppOptions;
67 QString *m_errorString;
68 PluginManagerPrivate *m_pmPrivate;
70 // state
71 QString m_currentArg;
72 QStringList::const_iterator m_it;
73 QStringList::const_iterator m_end;
74 bool m_isDependencyRefreshNeeded;
75 bool m_hasError;
77 } // namespace Internal
78 } // namespace ExtensionSystem
80 #endif // OPTIONSPARSER_H