don't discard iframe children.
[kdelibs.git] / khtml / java / kjavaprocess.h
blob28a64122e983abd659aa773e7411314b7a183674
1 // -*- c++ -*-
3 /* This file is part of the KDE project
5 * Copyright (C) 2000 Richard Moore <rich@kde.org>
6 * 2000 Wynn Wilkes <wynnw@caldera.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #ifndef KJAVAPROCESS_H
25 #define KJAVAPROCESS_H
27 #include <kprocess.h>
29 /**
30 * @short A class for invoking a Java VM
32 * This class is a general tool for invoking a Java interpreter. It allows you
33 * to specify some of the standard options that should be understood by all
34 * JVMs.
36 * @author Richard J. Moore, rich@kde.org
37 * @author Wynn Wilkes, wynnw@calderasystems.com
40 class KJavaProcessPrivate;
41 class KJavaProcess : public KProcess //QObject
43 Q_OBJECT
45 public:
46 /**
47 * Creates a process object, the process is NOT invoked at this point.
48 * You should first set the process's parameters, and then call startJava.
50 KJavaProcess( QObject *parent = 0 );
51 virtual ~KJavaProcess();
53 /**
54 * Invoke the JVM with the parameters that have been set. The Java process
55 * will start after this call.
57 bool startJava();
59 /**
60 * Stop the JVM (if it's running).
62 void stopJava();
64 /**
65 * Returns the status of the java Process- true if it's ok, false if it has died.
66 * It calls K3Process::isRunning()
68 bool isRunning();
70 /**
71 * Used to specify the path to the Java executable to be run.
73 void setJVMPath( const QString& path );
75 /**
76 * This will set the classpath the Java process will use. It's used as a the
77 * -cp command line option. It adds every jar file stored in $KDEDIRS/share/apps/kjava/
78 * to the classpath, and then adds the $CLASSPATH environmental variable. This allows
79 * users to simply drop the JSSE (Java Secure Sockets Extension classes into that directory
80 * without having to modify the jvm configuration files.
82 void setClasspath( const QString& classpath );
84 /**
85 * Set a property on the java command line as -Dname=value, or -Dname if value is QString().
86 * For example, you could call setSystemProperty( "kjas.debug", "" ) to set the kjas.debug property.
88 void setSystemProperty( const QString& name, const QString& value );
90 /**
91 * The class to be called when startJava() is called.
93 void setMainClass( const QString& clazzName );
95 /**
96 * Extra flags passed to the JVM.
98 void setExtraArgs( const QString& args );
101 * Arguments passed to the main class. They will be very last in the java
102 * command line, after the main class.
104 void setClassArgs( const QString& classArgs );
107 * Sends a command to the KJAS Applet Server by building a QByteArray
108 * out of the data, and then writes it standard out.
110 void send( char cmd_code, const QStringList& args );
113 * Sends a command to the KJAS Applet Server by building a QByteArray
114 * out of the data, and then writes it standard out. It adds each QString
115 * in the arg list, and then adds the data array.
117 void send( char cmd_code, const QStringList& args, const QByteArray& data );
120 * Writes all pending data to JVM
122 void flushBuffers();
124 protected Q_SLOTS:
126 * This slot is called when the Java Process writes to standard out. We then
127 * process the data from the file descriptor that is passed to us and send the
128 * command to the AppletServer
130 void slotReceivedData();
132 * This slot is called when the Java Process exited.
134 void slotExited();
136 protected:
137 virtual bool invokeJVM();
138 virtual void killJVM();
140 QByteArray addArgs( char cmd_code, const QStringList& args );
141 void storeSize( QByteArray* buff );
143 Q_SIGNALS:
144 void received( const QByteArray& );
145 void exited( int status );
147 private:
148 KJavaProcessPrivate* const d;
152 #endif // KJAVAPROCESS_H