1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qbs.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 #ifndef QBS_BENCHMARKER_COMMANDLINEPARSER_H
29 #define QBS_BENCHMARKER_COMMANDLINEPARSER_H
30 
31 #include "activities.h"
32 
33 #include <QtCore/qstringlist.h>
34 
35 namespace qbsBenchmarker {
36 
37 class CommandLineParser
38 {
39 public:
40     CommandLineParser();
41 
42     void parse();
43 
activies()44     Activities activies() const { return m_activities; }
oldCommit()45     QString oldCommit() const { return m_oldCommit; }
newCommit()46     QString newCommit() const { return m_newCommit; }
testProjectFilePath()47     QString testProjectFilePath() const { return m_testProjectFilePath; }
qbsRepoDirPath()48     QString qbsRepoDirPath() const { return m_qbsRepoDirPath; }
regressionThreshold()49     int regressionThreshold() const { return m_regressionThreshold; }
50 
51 private:
52     [[noreturn]] void throwException(const QString &optionName, const QString &illegalValue,
53                                    const QString &helpText);
54     [[noreturn]] void throwException(const QString &missingOption, const QString &helpText);
55 
56     Activities m_activities;
57     QString m_oldCommit;
58     QString m_newCommit;
59     QString m_testProjectFilePath;
60     QString m_qbsRepoDirPath;
61     int m_regressionThreshold = 0;
62 };
63 
64 } // namespace qbsBenchmarker
65 
66 #endif // Include guard.
67