| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 | 
|---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qprocess.h:1 -->
 | 
|---|
| 3 | <html>
 | 
|---|
| 4 | <head>
 | 
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 | 
|---|
| 6 | <title>qprocess.h Include File</title>
 | 
|---|
| 7 | <style type="text/css"><!--
 | 
|---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
 | 
|---|
| 9 | a:link { color: #004faf; text-decoration: none }
 | 
|---|
| 10 | a:visited { color: #672967; text-decoration: none }
 | 
|---|
| 11 | body { background: #ffffff; color: black; }
 | 
|---|
| 12 | --></style>
 | 
|---|
| 13 | </head>
 | 
|---|
| 14 | <body>
 | 
|---|
| 15 | 
 | 
|---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
 | 
|---|
| 17 | <tr bgcolor="#E5E5E5">
 | 
|---|
| 18 | <td valign=center>
 | 
|---|
| 19 |  <a href="index.html">
 | 
|---|
| 20 | <font color="#004faf">Home</font></a>
 | 
|---|
| 21 |  | <a href="classes.html">
 | 
|---|
| 22 | <font color="#004faf">All Classes</font></a>
 | 
|---|
| 23 |  | <a href="mainclasses.html">
 | 
|---|
| 24 | <font color="#004faf">Main Classes</font></a>
 | 
|---|
| 25 |  | <a href="annotated.html">
 | 
|---|
| 26 | <font color="#004faf">Annotated</font></a>
 | 
|---|
| 27 |  | <a href="groups.html">
 | 
|---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
 | 
|---|
| 29 |  | <a href="functions.html">
 | 
|---|
| 30 | <font color="#004faf">Functions</font></a>
 | 
|---|
| 31 | </td>
 | 
|---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qprocess.h</h1>
 | 
|---|
| 33 | 
 | 
|---|
| 34 | <p>This is the verbatim text of the qprocess.h include file. It is provided only for illustration; the copyright remains with Trolltech.
 | 
|---|
| 35 | <hr>
 | 
|---|
| 36 | <pre>
 | 
|---|
| 37 | /****************************************************************************
 | 
|---|
| 38 | ** $Id: qprocess-h.html 2051 2007-02-21 10:04:20Z chehrlic $
 | 
|---|
| 39 | **
 | 
|---|
| 40 | ** Implementation of QProcess class
 | 
|---|
| 41 | **
 | 
|---|
| 42 | ** Created : 20000905
 | 
|---|
| 43 | **
 | 
|---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
 | 
|---|
| 45 | **
 | 
|---|
| 46 | ** This file is part of the kernel module of the Qt GUI Toolkit.
 | 
|---|
| 47 | **
 | 
|---|
| 48 | ** This file may be distributed under the terms of the Q Public License
 | 
|---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
 | 
|---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
 | 
|---|
| 51 | **
 | 
|---|
| 52 | ** This file may be distributed and/or modified under the terms of the
 | 
|---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
 | 
|---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
 | 
|---|
| 55 | ** packaging of this file.
 | 
|---|
| 56 | **
 | 
|---|
| 57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
 | 
|---|
| 58 | ** licenses may use this file in accordance with the Qt Commercial License
 | 
|---|
| 59 | ** Agreement provided with the Software.
 | 
|---|
| 60 | **
 | 
|---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 | 
|---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 | 
|---|
| 63 | **
 | 
|---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 | 
|---|
| 65 | **   information about Qt Commercial License Agreements.
 | 
|---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
 | 
|---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
 | 
|---|
| 68 | **
 | 
|---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
 | 
|---|
| 70 | ** not clear to you.
 | 
|---|
| 71 | **
 | 
|---|
| 72 | **********************************************************************/
 | 
|---|
| 73 | 
 | 
|---|
| 74 | #ifndef QPROCESS_H
 | 
|---|
| 75 | #define QPROCESS_H
 | 
|---|
| 76 | 
 | 
|---|
| 77 | #ifndef QT_H
 | 
|---|
| 78 | #include "qobject.h"
 | 
|---|
| 79 | #include "qstringlist.h"
 | 
|---|
| 80 | #include "qdir.h"
 | 
|---|
| 81 | #endif // QT_H
 | 
|---|
| 82 | 
 | 
|---|
| 83 | #ifndef QT_NO_PROCESS
 | 
|---|
| 84 | 
 | 
|---|
| 85 | class QProcessPrivate;
 | 
|---|
| 86 | class QMembuf;
 | 
|---|
| 87 | 
 | 
|---|
| 88 | 
 | 
|---|
| 89 | class Q_EXPORT QProcess : public QObject
 | 
|---|
| 90 | {
 | 
|---|
| 91 |     Q_OBJECT
 | 
|---|
| 92 | public:
 | 
|---|
| 93 |     QProcess( QObject *parent=0, const char *name=0 );
 | 
|---|
| 94 |     QProcess( const QString& arg0, QObject *parent=0, const char *name=0 );
 | 
|---|
| 95 |     QProcess( const QStringList& args, QObject *parent=0, const char *name=0 );
 | 
|---|
| 96 |     ~QProcess();
 | 
|---|
| 97 | 
 | 
|---|
| 98 |     // set and get the arguments and working directory
 | 
|---|
| 99 |     QStringList arguments() const;
 | 
|---|
| 100 |     void clearArguments();
 | 
|---|
| 101 |     virtual void setArguments( const QStringList& args );
 | 
|---|
| 102 |     virtual void addArgument( const QString& arg );
 | 
|---|
| 103 | #ifndef QT_NO_DIR
 | 
|---|
| 104 |     QDir workingDirectory() const;
 | 
|---|
| 105 |     virtual void setWorkingDirectory( const QDir& dir );
 | 
|---|
| 106 | #endif
 | 
|---|
| 107 | 
 | 
|---|
| 108 |     // set and get the comms wanted
 | 
|---|
| 109 |     enum Communication { Stdin=0x01, Stdout=0x02, Stderr=0x04, DupStderr=0x08 };
 | 
|---|
| 110 |     void setCommunication( int c );
 | 
|---|
| 111 |     int communication() const;
 | 
|---|
| 112 | 
 | 
|---|
| 113 |     // start the execution
 | 
|---|
| 114 |     virtual bool start( QStringList *env=0 );
 | 
|---|
| 115 |     virtual bool launch( const QString& buf, QStringList *env=0  );
 | 
|---|
| 116 |     virtual bool launch( const QByteArray& buf, QStringList *env=0  );
 | 
|---|
| 117 | 
 | 
|---|
| 118 |     // inquire the status
 | 
|---|
| 119 |     bool isRunning() const;
 | 
|---|
| 120 |     bool normalExit() const;
 | 
|---|
| 121 |     int exitStatus() const;
 | 
|---|
| 122 | 
 | 
|---|
| 123 |     // reading
 | 
|---|
| 124 |     virtual QByteArray readStdout();
 | 
|---|
| 125 |     virtual QByteArray readStderr();
 | 
|---|
| 126 |     bool canReadLineStdout() const;
 | 
|---|
| 127 |     bool canReadLineStderr() const;
 | 
|---|
| 128 |     virtual QString readLineStdout();
 | 
|---|
| 129 |     virtual QString readLineStderr();
 | 
|---|
| 130 | 
 | 
|---|
| 131 |     // get platform dependent process information
 | 
|---|
| 132 | #if defined(Q_OS_WIN32)
 | 
|---|
| 133 |     typedef void* PID;
 | 
|---|
| 134 | #else
 | 
|---|
| 135 |     typedef Q_LONG PID;
 | 
|---|
| 136 | #endif
 | 
|---|
| 137 |     PID processIdentifier();
 | 
|---|
| 138 | 
 | 
|---|
| 139 |     void flushStdin();
 | 
|---|
| 140 | 
 | 
|---|
| 141 | signals:
 | 
|---|
| 142 |     void readyReadStdout();
 | 
|---|
| 143 |     void readyReadStderr();
 | 
|---|
| 144 |     void processExited();
 | 
|---|
| 145 |     void wroteToStdin();
 | 
|---|
| 146 |     void launchFinished();
 | 
|---|
| 147 | 
 | 
|---|
| 148 | public slots:
 | 
|---|
| 149 |     // end the execution
 | 
|---|
| 150 |     void tryTerminate() const;
 | 
|---|
| 151 |     void kill() const;
 | 
|---|
| 152 | 
 | 
|---|
| 153 |     // input
 | 
|---|
| 154 |     virtual void writeToStdin( const QByteArray& buf );
 | 
|---|
| 155 |     virtual void writeToStdin( const QString& buf );
 | 
|---|
| 156 |     virtual void closeStdin();
 | 
|---|
| 157 | 
 | 
|---|
| 158 | protected: // ### or private?
 | 
|---|
| 159 |     void connectNotify( const char * signal );
 | 
|---|
| 160 |     void disconnectNotify( const char * signal );
 | 
|---|
| 161 | private:
 | 
|---|
| 162 |     void setIoRedirection( bool value );
 | 
|---|
| 163 |     void setNotifyOnExit( bool value );
 | 
|---|
| 164 |     void setWroteStdinConnected( bool value );
 | 
|---|
| 165 | 
 | 
|---|
| 166 |     void init();
 | 
|---|
| 167 |     void reset();
 | 
|---|
| 168 | #if defined(Q_OS_WIN32)
 | 
|---|
| 169 |     uint readStddev( HANDLE dev, char *buf, uint bytes );
 | 
|---|
| 170 | #endif
 | 
|---|
| 171 |     QMembuf* membufStdout();
 | 
|---|
| 172 |     QMembuf* membufStderr();
 | 
|---|
| 173 | 
 | 
|---|
| 174 | private slots:
 | 
|---|
| 175 |     void socketRead( int fd );
 | 
|---|
| 176 |     void socketWrite( int fd );
 | 
|---|
| 177 |     void timeout();
 | 
|---|
| 178 |     void closeStdinLaunch();
 | 
|---|
| 179 | 
 | 
|---|
| 180 | private:
 | 
|---|
| 181 |     QProcessPrivate *d;
 | 
|---|
| 182 | #ifndef QT_NO_DIR
 | 
|---|
| 183 |     QDir        workingDir;
 | 
|---|
| 184 | #endif
 | 
|---|
| 185 |     QStringList _arguments;
 | 
|---|
| 186 | 
 | 
|---|
| 187 |     int  exitStat; // exit status
 | 
|---|
| 188 |     bool exitNormal; // normal exit?
 | 
|---|
| 189 |     bool ioRedirection; // automatically set be (dis)connectNotify
 | 
|---|
| 190 |     bool notifyOnExit; // automatically set be (dis)connectNotify
 | 
|---|
| 191 |     bool wroteToStdinConnected; // automatically set be (dis)connectNotify
 | 
|---|
| 192 | 
 | 
|---|
| 193 |     bool readStdoutCalled;
 | 
|---|
| 194 |     bool readStderrCalled;
 | 
|---|
| 195 |     int comms;
 | 
|---|
| 196 | 
 | 
|---|
| 197 |     friend class QProcessPrivate;
 | 
|---|
| 198 | #if defined(Q_OS_UNIX)
 | 
|---|
| 199 |     friend class QProcessManager;
 | 
|---|
| 200 |     friend class QProc;
 | 
|---|
| 201 | #endif
 | 
|---|
| 202 | 
 | 
|---|
| 203 | #if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator=
 | 
|---|
| 204 |     QProcess( const QProcess & );
 | 
|---|
| 205 |     QProcess &operator=( const QProcess & );
 | 
|---|
| 206 | #endif
 | 
|---|
| 207 | };
 | 
|---|
| 208 | 
 | 
|---|
| 209 | #endif // QT_NO_PROCESS
 | 
|---|
| 210 | 
 | 
|---|
| 211 | #endif // QPROCESS_H
 | 
|---|
| 212 | </pre>
 | 
|---|
| 213 | <!-- eof -->
 | 
|---|
| 214 | <p><address><hr><div align=center>
 | 
|---|
| 215 | <table width=100% cellspacing=0 border=0><tr>
 | 
|---|
| 216 | <td>Copyright © 2007
 | 
|---|
| 217 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
 | 
|---|
| 218 | <td align=right><div align=right>Qt 3.3.8</div>
 | 
|---|
| 219 | </table></div></address></body>
 | 
|---|
| 220 | </html>
 | 
|---|