LibEngsas
ecmdlineargs.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 #ifndef ECMDLINEARGS_H
21 #define ECMDLINEARGS_H
22 
23 #include "eglobal.h"
24 
25 class ECmdLineOption;
26 class EPart;
27 
28 #include <QList>
29 #include <QPointer>
30 
31 class KCmdLineOptions;
32 
63 {
64  public:
69  ECmdLineArgs(EPart *part = NULL);
70  virtual ~ECmdLineArgs();
71 
79  bool init(int argc, char** argv);
87  void add(const QByteArray &name,
88  const QByteArray &alias = QByteArray(),
89  const QString &description = QString(),
90  const QByteArray &defaultValue = QByteArray());
97  void add(ECmdLineOption *option);
107  bool isSet(const QByteArray &option) const;
115  QString getOption(const QByteArray &option) const;
121  void addToKCmdLineOptions(KCmdLineOptions *option) const;
122 
123  protected:
130  virtual void showHelp() const;
139  virtual void showVersion() const;
140 
141  private:
142  ECmdLineOption *findOption(const QByteArray &option) const;
143  bool isSet(ECmdLineOption *option) const;
144 
146  int argc;
147  char** argv;
148  QPointer<EPart> part;
149 };
150 
151 #endif // ECMDLINEARGS_H