From 636f509299122d02087c6fd62e1e4a46dbd22026 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Wed, 8 Jan 2014 20:06:00 +0100 Subject: Rename many classes to avoid conflicts with KDE --- dcopjava/binding/org/trinitydesktop/DCOP/Stub.java | 193 +++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 dcopjava/binding/org/trinitydesktop/DCOP/Stub.java (limited to 'dcopjava/binding/org/trinitydesktop/DCOP/Stub.java') diff --git a/dcopjava/binding/org/trinitydesktop/DCOP/Stub.java b/dcopjava/binding/org/trinitydesktop/DCOP/Stub.java new file mode 100644 index 00000000..0a23543a --- /dev/null +++ b/dcopjava/binding/org/trinitydesktop/DCOP/Stub.java @@ -0,0 +1,193 @@ +package org.trinitydesktop.DCOP; + + +import java.io.*; + + +public class Stub +{ + private String _app, _obj; + private int _status; + private Client _client; + + public Stub(String app, String obj) + { + _app = app; + _obj = obj; + _status = 0; + + // TODO: The client should be shared between stubs. + _client = new Client(); + _client.attach(); + } + + public String app() + { + return _app; + } + + public String obj() + { + return _obj; + } + + + public Client client() + { + return _client; + } + + + public final static int CallFailed = 0; + public final static int CallSucceeded = 1; + + public int status() + { + return _status; + } + + public void setStatus(int status) + { + _status = status; + } + + public boolean ok() + { + return _status == CallSucceeded; + } + + public void callFailed() + { + _status = CallFailed; + } + + + // accessor methods for the datatypes used --------------------------- + + protected boolean read_bool(DataInputStream is) throws IOException + { + return is.readBoolean(); + } + + protected void write_bool(DataOutputStream os, boolean val) throws IOException + { + os.writeBoolean(val); + } + + protected short read_short_int(DataInputStream is) throws IOException + { + return is.readShort(); + } + + protected void write_short_int(DataOutputStream os, short val) throws IOException + { + os.writeShort(val); + } + + protected int read_int(DataInputStream is) throws IOException + { + return is.readInt(); + } + + protected void write_int(DataOutputStream os, int val) throws IOException + { + os.writeInt(val); + } + + protected int read_long_int(DataInputStream is) throws IOException + { + return is.readInt(); + } + + protected void write_long_int(DataOutputStream os, int val) throws IOException + { + os.writeInt(val); + } + + protected float read_float(DataInputStream is) throws IOException + { + return is.readFloat(); + } + + protected void write_float(DataOutputStream os, float val) throws IOException + { + os.writeFloat(val); + } + + protected double read_double(DataInputStream is) throws IOException + { + return is.readDouble(); + } + + protected void write_double(DataOutputStream os, double val) throws IOException + { + os.writeDouble(val); + } + + protected String read_QString(DataInputStream is) throws IOException + { + int len = is.readInt(); + if (len == 0xffffffff) + return new String(); + else + { + StringBuffer b = new StringBuffer(); + for (int i=0; i