Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members

cmdinterpreter.h

00001 /***************************************************************************
00002                           cmdinterpreter.h  -  command interpreter for CUTE commands
00003                              -------------------
00004     begin                : Thu Feb 3 2003
00005     copyright            : (C) 2003 by Heiko Köhler
00006     email                : heicom@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef __CMDINTERPRETER_H__
00019 #define __CMDINTERPRETER_H__
00020 
00021 #include <qobject.h>
00022 #include <qstringlist.h>
00023 #include <qptrlist.h>
00024 #include <qprocess.h>
00025 
00027 typedef bool (*cmd_func)(QString &args);
00028 
00036 class CmdInterpreter : public QObject
00037 {
00038     Q_OBJECT
00039 public:
00041     CmdInterpreter(QObject *parent);
00043     void createNewProcess();
00045     bool exec(const QString &cmd);
00048     void registerFunc(QString name, cmd_func func);
00050     void registerCmd(QString startToken, cmd_func func);
00052     QStringList &commands();
00054     QString readLineStdout();
00056     QString readLineStderr();
00058     bool canReadLineStdout();
00060     bool canReadLineStderr();
00061 public slots:
00062     void kill();
00063 signals:
00064     void readyReadStdout();
00065     void readyReadStderr();
00066     void processExited();
00067 private:
00069     QStringList __commands;
00071     static QProcess *proc;
00072 };
00073 
00074 #endif

Generated on Sun May 2 20:02:57 2004 by doxygen 1.3.2