KHTML
kjavaprocess.h
Go to the documentation of this file.00001 // -*- c++ -*- 00002 00003 /* This file is part of the KDE project 00004 * 00005 * Copyright (C) 2000 Richard Moore <rich@kde.org> 00006 * 2000 Wynn Wilkes <wynnw@caldera.com> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public License 00019 * along with this library; see the file COPYING.LIB. If not, write to 00020 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 * Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #ifndef KJAVAPROCESS_H 00025 #define KJAVAPROCESS_H 00026 00027 #include <kprocess.h> 00028 #include <qcstring.h> 00029 00041 class KJavaProcessPrivate; 00042 class KJavaProcess : public KProcess //QObject 00043 { 00044 Q_OBJECT 00045 00046 public: 00051 KJavaProcess(); 00052 virtual ~KJavaProcess(); 00053 00058 bool startJava(); 00059 00063 void stopJava(); 00064 00069 bool isRunning(); 00070 00074 void setJVMPath( const QString& path ); 00075 00083 void setClasspath( const QString& classpath ); 00084 00089 void setSystemProperty( const QString& name, const QString& value ); 00090 00094 void setMainClass( const QString& clazzName ); 00095 00099 void setExtraArgs( const QString& args ); 00100 00105 void setClassArgs( const QString& classArgs ); 00106 00111 void send( char cmd_code, const QStringList& args ); 00112 00118 void send( char cmd_code, const QStringList& args, const QByteArray& data ); 00119 00123 void flushBuffers(); 00124 00125 protected slots: 00131 void slotWroteData(); 00132 00138 void slotReceivedData( int, int& ); 00142 void slotExited( KProcess *process ); 00143 00144 protected: 00145 virtual bool invokeJVM(); 00146 virtual void killJVM(); 00147 00148 QByteArray* addArgs( char cmd_code, const QStringList& args ); 00149 void popBuffer(); 00150 void sendBuffer( QByteArray* buff ); 00151 void storeSize( QByteArray* buff ); 00152 00153 KProcess* javaProcess; 00154 00155 signals: 00156 void received( const QByteArray& ); 00157 void exited( int status ); 00158 00159 private: 00160 KJavaProcessPrivate *d; 00161 00162 }; 00163 00164 #endif // KJAVAPROCESS_H