source: trunk/tools/xmlpatterns/qapplicationargumentparser_p.h@ 555

Last change on this file since 555 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 4.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5** ** This file is part of the tools applications of the Qt Toolkit.
6**
7** $QT_BEGIN_LICENSE:LGPL$
8** Commercial Usage
9** Licensees holding valid Qt Commercial licenses may use this file in
10** accordance with the Qt Commercial License Agreement provided with the
11** Software or, alternatively, in accordance with the terms contained in
12** a written agreement between you and Nokia.
13**
14** GNU Lesser General Public License Usage
15** Alternatively, this file may be used under the terms of the GNU Lesser
16** General Public License version 2.1 as published by the Free Software
17** Foundation and appearing in the file LICENSE.LGPL included in the
18** packaging of this file. Please review the following information to
19** ensure the GNU Lesser General Public License version 2.1 requirements
20** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
21**
22** In addition, as a special exception, Nokia gives you certain
23** additional rights. These rights are described in the Nokia Qt LGPL
24** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
25** package.
26**
27** GNU General Public License Usage
28** Alternatively, this file may be used under the terms of the GNU
29** General Public License version 3.0 as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL included in the
31** packaging of this file. Please review the following information to
32** ensure the GNU General Public License version 3.0 requirements will be
33** met: http://www.gnu.org/copyleft/gpl.html.
34**
35** If you are unsure which license is appropriate for your use, please
36** contact the sales department at [email protected].
37** $QT_END_LICENSE$
38**
39****************************************************************************/
40
41//
42// W A R N I N G
43// -------------
44//
45// This file is not part of the Qt API. It exists purely as an
46// implementation detail. This header file may change from version to
47// version without notice, or even be removed.
48//
49// We mean it.
50
51#ifndef QApplicationArgumentParser_H
52#define QApplicationArgumentParser_H
53
54#include <QtCore/QVariant> /* Needed, because we can't forward declare QVariantList. */
55
56QT_BEGIN_HEADER
57QT_BEGIN_NAMESPACE
58
59class QApplicationArgument;
60class QApplicationArgumentParserPrivate;
61class QStringList;
62template<typename A, typename B> struct QPair;
63template<typename T> class QList;
64template<typename Value> class QList;
65
66class QApplicationArgumentParser
67{
68public:
69 enum ExitCode
70 {
71 Success = 0,
72 ParseError = 1
73 };
74
75 QApplicationArgumentParser(int argc, char **argv);
76 QApplicationArgumentParser(const QStringList &input);
77 virtual ~QApplicationArgumentParser();
78 void addArgument(const QApplicationArgument &argument);
79 void setDeclaredArguments(const QList<QApplicationArgument> &arguments);
80 QList<QApplicationArgument> declaredArguments() const;
81
82 int count(const QApplicationArgument &argument) const;
83 bool has(const QApplicationArgument &argument) const;
84
85 virtual bool parse();
86 ExitCode exitCode() const;
87 QVariant value(const QApplicationArgument &argument) const;
88 QVariantList values(const QApplicationArgument &argument) const;
89 void setApplicationDescription(const QString &description);
90 void setApplicationVersion(const QString &version);
91 virtual void message(const QString &message) const;
92
93protected:
94 void setExitCode(ExitCode code);
95 void setUsedArguments(const QList<QPair<QApplicationArgument, QVariant> > &arguments);
96 QList<QPair<QApplicationArgument, QVariant> > usedArguments() const;
97 QStringList input() const;
98 virtual QVariant convertToValue(const QApplicationArgument &argument,
99 const QString &value) const;
100 virtual QString typeToName(const QApplicationArgument &argument) const;
101 virtual QVariant defaultValue(const QApplicationArgument &argument) const;
102
103private:
104 friend class QApplicationArgumentParserPrivate;
105 QApplicationArgumentParserPrivate *d;
106 Q_DISABLE_COPY(QApplicationArgumentParser)
107};
108
109QT_END_NAMESPACE
110QT_END_HEADER
111#endif
Note: See TracBrowser for help on using the repository browser.