Generated readObject()/writeObject(), widened some things along the way.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4689 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-05-04 22:17:41 +00:00
parent ea8bf25c0a
commit a60a71552a
11 changed files with 307 additions and 66 deletions
@@ -21,8 +21,12 @@
package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
/**
@@ -37,8 +41,8 @@ public abstract class ChatMessage
/** The bundle to use when translating this message. */
public String bundle;
/** The client side 'localtype' of this chat, set to the type
* registered with an auxiliary source in the ChatDirector. */
/** The client side 'localtype' of this chat, set to the type registered with an auxiliary
* source in the ChatDirector. */
public transient String localtype;
/** The client time that this message was created. */
@@ -61,8 +65,8 @@ public abstract class ChatMessage
}
/**
* Once this message reaches the client, the information contained within
* is changed around a bit.
* Once this message reaches the client, the information contained within is changed around a
* bit.
*/
public void setClientInfo (String msg, String localtype)
{
@@ -85,7 +89,24 @@ public abstract class ChatMessage
*/
public String toString ()
{
return StringUtil.shortClassName(this) +
StringUtil.fieldsToString(this);
return StringUtil.shortClassName(this) + StringUtil.fieldsToString(this);
}
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
message = ins.readUTF();
bundle = ins.readUTF();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeUTF(message);
out.writeUTF(bundle);
}
// AUTO-GENERATED: METHODS END
}
@@ -21,25 +21,27 @@
package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
/**
* A ChatMessage that represents a message that came from the server
* and did not result from direct user action.
* A ChatMessage that represents a message that came from the server and did not result from direct
* user action.
*/
public class SystemMessage extends ChatMessage
{
/** Attention level constant to indicate that this message is merely
* providing the user with information. */
/** Attention level constant to indicate that this message is merely providing the user with
* information. */
public static final byte INFO = 0;
/** Attention level constant to indicate that this message is the
* result of a user action. */
/** Attention level constant to indicate that this message is the result of a user action. */
public static final byte FEEDBACK = 1;
/** Attention level constant to indicate that some action is required. */
public static final byte ATTENTION = 2;
//----
/** The attention level of this message. */
public byte attentionLevel;
@@ -56,4 +58,22 @@ public class SystemMessage extends ChatMessage
super(message, bundle);
this.attentionLevel = attentionLevel;
}
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
attentionLevel = ins.readByte();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeByte(attentionLevel);
}
// AUTO-GENERATED: METHODS END
}
@@ -21,6 +21,10 @@
package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Name;
/**
@@ -52,5 +56,23 @@ public class TellFeedbackMessage extends UserMessage
return _failure ? null : "m.told_format";
}
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
_failure = ins.readBoolean();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeBoolean(_failure);
}
// AUTO-GENERATED: METHODS END
protected boolean _failure;
}
@@ -21,6 +21,10 @@
package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.ObjectInputStream;
import com.threerings.util.Name;
/**
@@ -52,8 +56,8 @@ public class UserMessage extends ChatMessage
}
/**
* Constructs a user message for a player originated tell (which has no
* bundle and is in the default mode).
* Constructs a user message for a player originated tell (which has no bundle and is in the
* default mode).
*/
public UserMessage (Name speaker, String message)
{
@@ -63,9 +67,8 @@ public class UserMessage extends ChatMessage
}
/**
* Returns the name to display for the speaker. Some types of messages
* may wish to not use the canonical name for the speaker and should thus
* override this function.
* Returns the name to display for the speaker. Some types of messages may wish to not use the
* canonical name for the speaker and should thus override this function.
*/
public Name getSpeakerDisplayName ()
{
@@ -87,4 +90,24 @@ public class UserMessage extends ChatMessage
}
return "m.speak_format";
}
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
speaker = (Name)ins.readObject();
mode = ins.readByte();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(speaker);
out.writeByte(mode);
}
// AUTO-GENERATED: METHODS END
}
@@ -21,17 +21,19 @@
package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Name;
/**
* A system message triggered by the activity of another user.
* If the user is muted we can suppress this message, unlike a normal
* system message.
* A system message triggered by the activity of another user. If the user is muted we can suppress
* this message, unlike a normal system message.
*/
public class UserSystemMessage extends SystemMessage
{
/** The "speaker" of this message, the user that triggered that this
* message be sent to us. */
/** The "speaker" of this message, the user that triggered that this message be sent to us. */
public Name speaker;
/** Suitable for unserialization. */
@@ -50,10 +52,27 @@ public class UserSystemMessage extends SystemMessage
/**
* Construct a UserSystemMessage.
*/
public UserSystemMessage (Name sender, String message, String bundle,
byte attentionLevel)
public UserSystemMessage (Name sender, String message, String bundle, byte attentionLevel)
{
super(message, bundle, attentionLevel);
this.speaker = sender;
}
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
speaker = (Name)ins.readObject();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(speaker);
}
// AUTO-GENERATED: METHODS END
}