process.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023
00024 #include "process.h"
00025
00026 #ifndef QT_NO_PROCESS
00027
00028 #include "qapplication.h"
00029
00030
00031 Process::Process( QObject *parent, const char *name )
00032 : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ),
00033 wroteToStdinConnected( FALSE )
00034 {
00035 init();
00036 }
00037
00038 Process::Process( const QString& arg0, QObject *parent, const char *name )
00039 : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ),
00040 wroteToStdinConnected( FALSE )
00041 {
00042 init();
00043 addArgument( arg0 );
00044 }
00045
00046 Process::Process( const QStringList& args, QObject *parent, const char *name )
00047 : QObject( parent, name ), ioRedirection( FALSE ), notifyOnExit( FALSE ),
00048 wroteToStdinConnected( FALSE )
00049 {
00050 init();
00051 setArguments( args );
00052 }
00053
00054
00055 QStringList Process::arguments() const
00056 {
00057 return _arguments;
00058 }
00059
00060 void Process::setArguments( const QStringList& args )
00061 {
00062 _arguments = args;
00063 }
00064
00065 void Process::addArgument( const QString& arg )
00066 {
00067 _arguments.append( arg );
00068 }
00069
00070 bool Process::exec( const QString& in, QString& out, QStringList *env )
00071 {
00072 QByteArray sout;
00073 QByteArray sin = in.local8Bit(); sin.resize(sin.size()-1);
00074 bool r = exec( sin, sout, env );
00075 out = QString::fromLocal8Bit(sout);
00076 return r;
00077 }
00078
00079 #endif
This file is part of the documentation for OPIE Version 1.5.5.