Qtopia library API Documentation

process.cpp

00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
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); // cut nul
00074     bool r = exec( sin, sout, env );
00075     out = QString::fromLocal8Bit(sout);
00076     return r;
00077 }
00078 
00079 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:06 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001