Reworking CliParser to allow building quasselcore always without KDE deps
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 10 Jan 2009 20:38:47 +0000 (21:38 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 10 Jan 2009 20:48:41 +0000 (21:48 +0100)
Rather than hacking KDE support into CliParser using #ifdef (which forces all quassel binaries
to be built even with or without KDE support), I have now created an abstract base class and
specializations for the two cases. quasselcore now always builds without KDE deps.

13 files changed:
src/CMakeLists.txt
src/common/CMakeLists.txt
src/common/abstractcliparser.h [new file with mode: 0644]
src/common/cliparser.cpp
src/common/cliparser.h
src/common/main.cpp
src/common/quassel.cpp
src/common/quassel.h
src/core/coreapplication.cpp
src/core/coreapplication.h
src/uisupport/CMakeLists.txt
src/uisupport/kcmdlinewrapper.cpp [new file with mode: 0644]
src/uisupport/kcmdlinewrapper.h [new file with mode: 0644]

index 11e4081..9af8c50 100644 (file)
@@ -43,7 +43,7 @@ if(WANT_CORE)
                                     COMPILE_FLAGS "-DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_CORE"
                                     OUTPUT_NAME ../quasselcore)
   target_link_libraries(quasselcore mod_core mod_common
                                     COMPILE_FLAGS "-DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_CORE"
                                     OUTPUT_NAME ../quasselcore)
   target_link_libraries(quasselcore mod_core mod_common
-                                    ${QUASSEL_QT_LIBRARIES} ${QUASSEL_KDE_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
+                                    ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
   install(TARGETS quasselcore RUNTIME DESTINATION ${BIN_INSTALL_DIR})
 endif(WANT_CORE)
 
   install(TARGETS quasselcore RUNTIME DESTINATION ${BIN_INSTALL_DIR})
 endif(WANT_CORE)
 
index fb4c3e8..acded6d 100644 (file)
@@ -31,8 +31,6 @@ if(CMAKE_HOST_UNIX)
     set(SOURCES ${SOURCES} logbacktrace_unix.cpp)
 endif(CMAKE_HOST_UNIX)
 
     set(SOURCES ${SOURCES} logbacktrace_unix.cpp)
 endif(CMAKE_HOST_UNIX)
 
-
-
 set(MOC_HDRS
     aliasmanager.h
     backlogmanager.h
 set(MOC_HDRS
     aliasmanager.h
     backlogmanager.h
@@ -50,6 +48,7 @@ set(MOC_HDRS
     syncableobject.h)
 
 set(HEADERS ${MOC_HDRS}
     syncableobject.h)
 
 set(HEADERS ${MOC_HDRS}
+    abstractcliparser.h
     bufferinfo.h
     cliparser.h
     logger.h
     bufferinfo.h
     cliparser.h
     logger.h
@@ -59,11 +58,9 @@ set(HEADERS ${MOC_HDRS}
 
 qt4_wrap_cpp(MOC ${MOC_HDRS})
 
 
 qt4_wrap_cpp(MOC ${MOC_HDRS})
 
-
 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})  # for version.inc and version.gen
 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES version.gen)
 
 add_library(mod_common STATIC ${SOURCES} ${MOC} ${CMAKE_BINARY_DIR}/i18n/qrc_i18n.cxx)
 set_source_files_properties(${CMAKE_BINARY_DIR}/i18n/qrc_i18n.cxx PROPERTIES GENERATED true)
 add_dependencies(mod_common i18n)
 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})  # for version.inc and version.gen
 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES version.gen)
 
 add_library(mod_common STATIC ${SOURCES} ${MOC} ${CMAKE_BINARY_DIR}/i18n/qrc_i18n.cxx)
 set_source_files_properties(${CMAKE_BINARY_DIR}/i18n/qrc_i18n.cxx PROPERTIES GENERATED true)
 add_dependencies(mod_common i18n)
-
diff --git a/src/common/abstractcliparser.h b/src/common/abstractcliparser.h
new file mode 100644 (file)
index 0000000..680d86c
--- /dev/null
@@ -0,0 +1,69 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) version 3.                                           *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef ABSTRACTCLIPARSER_H
+#define ABSTRACTCLIPARSER_H
+
+#include <QStringList>
+
+class AbstractCliParser {
+public:
+  virtual bool init(const QStringList &arguments = QStringList()) = 0;
+
+  virtual QString value(const QString &longName) = 0;
+  virtual bool isSet(const QString &longName) = 0;
+  inline void addSwitch(const QString &longName, const char shortName = 0, const QString &help = QString()) {
+    addArgument(longName, CliParserArg(CliParserArg::CliArgSwitch, shortName, help));
+  }
+  inline void addOption(const QString &longName, const char shortName = 0, const QString &help = QString(), const QString &def = QString()) {
+    addArgument(longName, CliParserArg(CliParserArg::CliArgOption, shortName, help, def));
+  }
+  virtual void usage() = 0;
+
+  virtual ~AbstractCliParser() {};
+
+protected:
+  struct CliParserArg {
+    enum CliArgType {
+      CliArgInvalid,
+      CliArgSwitch,
+      CliArgOption
+    };
+
+    CliParserArg(const CliArgType _type = CliArgInvalid, const char _shortName = 0, const QString _help = QString(), const QString _def = QString())
+    : type(_type),
+    shortName(_shortName),
+    help(_help),
+    def(_def),
+    value(QString()),
+    boolValue(false) {};
+
+    CliArgType type;
+    char shortName;
+    QString help;
+    QString def;
+    QString value;
+    bool boolValue;
+  };
+
+  virtual void addArgument(const QString &longName, const CliParserArg &arg) = 0;
+};
+
+#endif
index a5b7223..625f64a 100644 (file)
 #include <QString>
 #include <QFileInfo>
 
 #include <QString>
 #include <QFileInfo>
 
-#ifdef HAVE_KDE
-#  include <KCmdLineArgs>
-#endif
-
-CliParser::CliParser() {
+CliParser::CliParser() : AbstractCliParser() {
 
 }
 
 
 }
 
-#ifdef HAVE_KDE
-void CliParser::addArgument(const QString &longName, const CliParserArg &arg) {
-  if(arg.shortName != 0) {
-    _cmdLineOptions.add(QByteArray().append(arg.shortName));
-  }
-  _cmdLineOptions.add(longName.toUtf8(), ki18n(arg.help.toUtf8()), arg.def.toUtf8());
-}
-
-bool CliParser::init(const QStringList &) {
-  KCmdLineArgs::addCmdLineOptions(_cmdLineOptions);
-  return true;
-}
-
-QString CliParser::value(const QString &longName) {
-  return KCmdLineArgs::parsedArgs()->getOption(longName.toUtf8());
-}
-
-bool CliParser::isSet(const QString &longName) {
-  return KCmdLineArgs::parsedArgs()->isSet(longName.toUtf8());
-}
-
-void CliParser::usage() {
-  KCmdLineArgs::usage();
-}
-
-#else
 void CliParser::addArgument(const QString &longName_, const CliParserArg &arg) {
   QString longName = longName_;
   longName.remove(QRegExp("\\s*<.*>\\s*")); // KCmdLineArgs takes args of the form "arg <defval>"
 void CliParser::addArgument(const QString &longName_, const CliParserArg &arg) {
   QString longName = longName_;
   longName.remove(QRegExp("\\s*<.*>\\s*")); // KCmdLineArgs takes args of the form "arg <defval>"
@@ -249,5 +219,3 @@ QString CliParser::lnameOfShortArg(const char arg) {
   }
   return QString();
 }
   }
   return QString();
 }
-
-#endif
index 8515d55..3c096a2 100644 (file)
 #ifndef CLIPARSER_H
 #define CLIPARSER_H
 
 #ifndef CLIPARSER_H
 #define CLIPARSER_H
 
-#include <QString>
-#include <QStringList>
 #include <QHash>
 
 #include <QHash>
 
-#ifdef HAVE_KDE
-#  include <KCmdLineOptions>
-#endif
+#include "abstractcliparser.h"
 
 
-class CliParser {
+//! Quassel's own parser for command line arguments
+class CliParser : public AbstractCliParser {
 public:
   CliParser();
 
 public:
   CliParser();
 
@@ -37,40 +34,10 @@ public:
 
   QString value(const QString &longName);
   bool isSet(const QString &longName);
 
   QString value(const QString &longName);
   bool isSet(const QString &longName);
-  inline void addSwitch(const QString &longName, const char shortName = 0, const QString &help = QString()) {
-    addArgument(longName, CliParserArg(CliParserArg::CliArgSwitch, shortName, help));
-  }
-  inline void addOption(const QString &longName, const char shortName = 0, const QString &help = QString(), const QString &def = QString()) {
-    addArgument(longName, CliParserArg(CliParserArg::CliArgOption, shortName, help, def));
-  }
   void usage();
 
 private:
   void usage();
 
 private:
-  struct CliParserArg {
-    enum CliArgType {
-      CliArgInvalid,
-      CliArgSwitch,
-      CliArgOption
-    };
-    CliParserArg(const CliArgType _type = CliArgInvalid, const char _shortName = 0, const QString _help = QString(), const QString _def = QString())
-    : type(_type),
-    shortName(_shortName),
-    help(_help),
-    def(_def),
-    value(QString()),
-    boolValue(false) {};
-
-    CliArgType type;
-    char shortName;
-    QString help;
-    QString def;
-    QString value;
-    bool boolValue;
-  };
-
   void addArgument(const QString &longName, const CliParserArg &arg);
   void addArgument(const QString &longName, const CliParserArg &arg);
-
-#ifndef HAVE_KDE
   bool addLongArg(const CliParserArg::CliArgType type, const QString &name, const QString &value = QString());
   bool addShortArg(const CliParserArg::CliArgType type, const char shortName, const QString &value = QString());
   QString escapedValue(const QString &value);
   bool addLongArg(const CliParserArg::CliArgType type, const QString &name, const QString &value = QString());
   bool addShortArg(const CliParserArg::CliArgType type, const char shortName, const QString &value = QString());
   QString escapedValue(const QString &value);
@@ -78,10 +45,6 @@ private:
 
   QStringList argsRaw;
   QHash<QString, CliParserArg> argsHash;
 
   QStringList argsRaw;
   QHash<QString, CliParserArg> argsHash;
-
-#else
-  KCmdLineOptions _cmdLineOptions;
-#endif
 };
 
 #endif
 };
 
 #endif
index e62c24d..9c468fd 100644 (file)
 
 #include <cstdlib>
 
 
 #include <cstdlib>
 
-#ifdef HAVE_KDE
-#  include <KCmdLineArgs>
-#  include <KAboutData>
-#endif
-
 #ifdef BUILD_CORE
 #  include "coreapplication.h"
 #elif defined BUILD_QTUI
 #ifdef BUILD_CORE
 #  include "coreapplication.h"
 #elif defined BUILD_QTUI
 #error "Something is wrong - you need to #define a build mode!"
 #endif
 
 #error "Something is wrong - you need to #define a build mode!"
 #endif
 
+// We don't want quasselcore to depend on KDE
+#if defined HAVE_KDE && defined BUILD_CORE
+#  undef HAVE_KDE
+#endif
+
+#ifdef HAVE_KDE
+#  include <KAboutData>
+#  include "kcmdlinewrapper.h"
+#endif
+
+#include "cliparser.h"
 #include "quassel.h"
 
 int main(int argc, char **argv) {
 #include "quassel.h"
 
 int main(int argc, char **argv) {
@@ -49,6 +55,8 @@ int main(int argc, char **argv) {
   QCoreApplication::setOrganizationName(Quassel::buildInfo().organizationName);
   QCoreApplication::setOrganizationDomain(Quassel::buildInfo().organizationDomain);
 
   QCoreApplication::setOrganizationName(Quassel::buildInfo().organizationName);
   QCoreApplication::setOrganizationDomain(Quassel::buildInfo().organizationDomain);
 
+  AbstractCliParser *cliParser;
+
 #ifdef HAVE_KDE
   // We need to init KCmdLineArgs first
   // TODO: build an AboutData compat class to replace our aboutDlg strings
 #ifdef HAVE_KDE
   // We need to init KCmdLineArgs first
   // TODO: build an AboutData compat class to replace our aboutDlg strings
@@ -58,11 +66,15 @@ int main(int argc, char **argv) {
   aboutData.addLicense(KAboutData::License_GPL_V3);
   aboutData.setOrganizationDomain(Quassel::buildInfo().organizationDomain.toUtf8());
   KCmdLineArgs::init(argc, argv, &aboutData);
   aboutData.addLicense(KAboutData::License_GPL_V3);
   aboutData.setOrganizationDomain(Quassel::buildInfo().organizationDomain.toUtf8());
   KCmdLineArgs::init(argc, argv, &aboutData);
+
+  cliParser = new KCmdLineWrapper();
+#else
+  cliParser = new CliParser();
 #endif
 #endif
+  Quassel::setCliParser(cliParser);
 
   // Initialize CLI arguments
   // NOTE: We can't use tr() at this point, since app is not yet created
 
   // Initialize CLI arguments
   // NOTE: We can't use tr() at this point, since app is not yet created
-  CliParser *cliParser = Quassel::cliParser();
 
   // put shared client&core arguments here
   cliParser->addSwitch("debug",'d', "Enable debug output");
 
   // put shared client&core arguments here
   cliParser->addSwitch("debug",'d', "Enable debug output");
index 1e6e1ed..57d6033 100644 (file)
@@ -35,7 +35,7 @@
 #include "syncableobject.h"
 
 Quassel::BuildInfo Quassel::_buildInfo;
 #include "syncableobject.h"
 
 Quassel::BuildInfo Quassel::_buildInfo;
-CliParser *Quassel::_cliParser = 0;
+AbstractCliParser *Quassel::_cliParser = 0;
 Quassel::RunMode Quassel::_runMode;
 bool Quassel::_initialized = false;
 bool Quassel::DEBUG = false;
 Quassel::RunMode Quassel::_runMode;
 bool Quassel::_initialized = false;
 bool Quassel::DEBUG = false;
index bb4771e..b490075 100644 (file)
@@ -24,7 +24,7 @@
 #include <QCoreApplication>
 #include <QString>
 
 #include <QCoreApplication>
 #include <QString>
 
-#include "cliparser.h"
+#include "abstractcliparser.h"
 
 class Quassel {
   Q_DECLARE_TR_FUNCTIONS(Quassel)
 
 class Quassel {
   Q_DECLARE_TR_FUNCTIONS(Quassel)
@@ -63,7 +63,8 @@ public:
   static inline const BuildInfo & buildInfo();
   static inline RunMode runMode();
 
   static inline const BuildInfo & buildInfo();
   static inline RunMode runMode();
 
-  static inline CliParser *cliParser();
+  static inline void setCliParser(AbstractCliParser *cliParser);
+  static inline AbstractCliParser *cliParser();
   static inline QString optionValue(const QString &option);
   static inline bool isOptionSet(const QString &option);
 
   static inline QString optionValue(const QString &option);
   static inline bool isOptionSet(const QString &option);
 
@@ -86,7 +87,7 @@ private:
   static void logBacktrace(const QString &filename);
 
   static BuildInfo _buildInfo;
   static void logBacktrace(const QString &filename);
 
   static BuildInfo _buildInfo;
-  static CliParser *_cliParser;
+  static AbstractCliParser *_cliParser;
   static RunMode _runMode;
   static bool _initialized;
 
   static RunMode _runMode;
   static bool _initialized;
 
@@ -97,7 +98,8 @@ const Quassel::BuildInfo & Quassel::buildInfo() { return _buildInfo; }
 Quassel::RunMode Quassel::runMode() { return _runMode; }
 void Quassel::setRunMode(Quassel::RunMode mode) { _runMode = mode; }
 
 Quassel::RunMode Quassel::runMode() { return _runMode; }
 void Quassel::setRunMode(Quassel::RunMode mode) { _runMode = mode; }
 
-CliParser *Quassel::cliParser() { return _cliParser ? _cliParser : _cliParser = new CliParser(); }
+void Quassel::setCliParser(AbstractCliParser *parser) { _cliParser = parser; }
+AbstractCliParser *Quassel::cliParser() { return _cliParser; }
 QString Quassel::optionValue(const QString &key) { return cliParser()->value(key); }
 bool Quassel::isOptionSet(const QString &key) { return cliParser()->isSet(key); }
 
 QString Quassel::optionValue(const QString &key) { return cliParser()->value(key); }
 bool Quassel::isOptionSet(const QString &key) { return cliParser()->isSet(key); }
 
index ca0f527..5d373c9 100644 (file)
@@ -52,12 +52,7 @@ bool CoreApplicationInternal::init() {
   Core::instance();  // create and init the core
   _coreCreated = true;
 
   Core::instance();  // create and init the core
   _coreCreated = true;
 
-#ifdef HAVE_KDE
-  // if using KDE, option is called "restore" instead of "norestore"
-  if(Quassel::isOptionSet("restore"))
-#else
   if(!Quassel::isOptionSet("norestore"))
   if(!Quassel::isOptionSet("norestore"))
-#endif
     Core::restoreState();
 
   return true;
     Core::restoreState();
 
   return true;
@@ -65,14 +60,7 @@ bool CoreApplicationInternal::init() {
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
-CoreApplication::CoreApplication(int &argc, char **argv)
-#ifdef HAVE_KDE
-: KApplication(false), Quassel() {
-  Q_UNUSED(argc); Q_UNUSED(argv);
-#else
-: QCoreApplication(argc, argv), Quassel() {
-#endif
-
+CoreApplication::CoreApplication(int &argc, char **argv) : QCoreApplication(argc, argv), Quassel() {
   setRunMode(Quassel::CoreOnly);
   _internal = new CoreApplicationInternal();
 }
   setRunMode(Quassel::CoreOnly);
   _internal = new CoreApplicationInternal();
 }
index 4245455..ecf4f6d 100644 (file)
@@ -45,11 +45,7 @@ class CoreApplicationInternal {
     bool _coreCreated;
 };
 
     bool _coreCreated;
 };
 
-#ifdef HAVE_KDE
-class CoreApplication : public KApplication, public Quassel {
-#else
 class CoreApplication : public QCoreApplication, public Quassel {
 class CoreApplication : public QCoreApplication, public Quassel {
-#endif
 
   Q_OBJECT
   public:
 
   Q_OBJECT
   public:
index e8518d5..1df6325 100644 (file)
@@ -50,6 +50,11 @@ set(HEADERS
     uisettings.h
     uistyle.h)
 
     uisettings.h
     uistyle.h)
 
+if(HAVE_KDE)
+    set(SOURCES ${SOURCES} kcmdlinewrapper.cpp)
+    set(HEADERS ${HEADERS} kcmdlinewrapper.h)
+endif(HAVE_KDE)
+
 qt4_wrap_cpp(MOC ${MOC_HDRS})
 
 include_directories(${CMAKE_SOURCE_DIR}/src/common
 qt4_wrap_cpp(MOC ${MOC_HDRS})
 
 include_directories(${CMAKE_SOURCE_DIR}/src/common
diff --git a/src/uisupport/kcmdlinewrapper.cpp b/src/uisupport/kcmdlinewrapper.cpp
new file mode 100644 (file)
index 0000000..1f1704e
--- /dev/null
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) version 3.                                           *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+#include "kcmdlinewrapper.h"
+
+#include <KCmdLineArgs>
+
+KCmdLineWrapper::KCmdLineWrapper() {
+
+}
+
+void KCmdLineWrapper::addArgument(const QString &longName, const CliParserArg &arg) {
+  if(arg.shortName != 0) {
+    _cmdLineOptions.add(QByteArray().append(arg.shortName));
+  }
+  _cmdLineOptions.add(longName.toUtf8(), ki18n(arg.help.toUtf8()), arg.def.toUtf8());
+}
+
+bool KCmdLineWrapper::init(const QStringList &) {
+  KCmdLineArgs::addCmdLineOptions(_cmdLineOptions);
+  return true;
+}
+
+QString KCmdLineWrapper::value(const QString &longName) {
+  return KCmdLineArgs::parsedArgs()->getOption(longName.toUtf8());
+}
+
+bool KCmdLineWrapper::isSet(const QString &longName) {
+  // KCmdLineArgs handles --nooption like NOT --option
+  if(longName.startsWith("no"))
+    return !KCmdLineArgs::parsedArgs()->isSet(longName.mid(2).toUtf8());
+  return KCmdLineArgs::parsedArgs()->isSet(longName.toUtf8());
+}
+
+void KCmdLineWrapper::usage() {
+  KCmdLineArgs::usage();
+}
diff --git a/src/uisupport/kcmdlinewrapper.h b/src/uisupport/kcmdlinewrapper.h
new file mode 100644 (file)
index 0000000..72d8e2a
--- /dev/null
@@ -0,0 +1,45 @@
+/***************************************************************************
+ *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) version 3.                                           *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef KCMDLINEWRAPPER_H
+#define KCMDLINEWRAPPER_H
+
+#include "abstractcliparser.h"
+
+#include <KCmdLineOptions>
+
+//! Wrapper for KCmdLineOptions
+class KCmdLineWrapper : public AbstractCliParser {
+public:
+  KCmdLineWrapper();
+
+  bool init(const QStringList &arguments = QStringList());
+
+  QString value(const QString &longName);
+  bool isSet(const QString &longName);
+  void usage();
+
+private:
+  void addArgument(const QString &longName, const CliParserArg &arg);
+
+  KCmdLineOptions _cmdLineOptions;
+};
+
+#endif