Ran the auto-generator on all our Streamable stuff in Narya. Tidied up the
results. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4395 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -21,16 +21,18 @@
|
||||
|
||||
package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.util.Cloneable;
|
||||
import com.threerings.util.Integer;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
/**
|
||||
* The occupant info object contains all of the information about an
|
||||
* occupant of a place that should be shared with other occupants of the
|
||||
@@ -47,8 +49,8 @@ import com.threerings.io.ObjectOutputStream;
|
||||
* responsible for adding the code to clone those attributes when a clone
|
||||
* is requested.
|
||||
*/
|
||||
public class OccupantInfo
|
||||
implements DSet_Entry
|
||||
public class OccupantInfo extends SimpleStreamableObject
|
||||
implements DSet_Entry, Cloneable
|
||||
{
|
||||
/** Constant value for {@link #status}. */
|
||||
public static const ACTIVE :int = 0;
|
||||
@@ -71,32 +73,52 @@ public class OccupantInfo
|
||||
/** The status of this occupant. */
|
||||
public var status :int = ACTIVE;
|
||||
|
||||
/** A blank constructor used for unserialization. */
|
||||
public function OccupantInfo (body :BodyObject = null)
|
||||
{
|
||||
if (body != null) {
|
||||
bodyOid = body.getOid();
|
||||
username = body.getVisibleName();
|
||||
status = body.status;
|
||||
}
|
||||
}
|
||||
|
||||
/** Access to the body object id as an int. */
|
||||
public function getBodyOid () :int
|
||||
{
|
||||
return bodyOid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a cloned copy of this instance.
|
||||
*/
|
||||
public function clone () :Object
|
||||
{
|
||||
throw new Error("Clone not implemented. Implement if you need it.");
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return bodyOid;
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeObject(new Integer(bodyOid));
|
||||
out.writeObject(username);
|
||||
out.writeByte(status);
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
bodyOid = (ins.readField(Integer) as Integer).value;
|
||||
username = (ins.readObject() as Name);
|
||||
status = ins.readByte();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeObject(new Integer(bodyOid));
|
||||
out.writeObject(username);
|
||||
out.writeByte(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
|
||||
package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.util.ClassUtil;
|
||||
import com.threerings.util.StringBuilder;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
import com.threerings.crowd.client.PlaceController;
|
||||
|
||||
@@ -40,9 +43,24 @@ import com.threerings.crowd.client.PlaceController;
|
||||
* #getControllerClass} and {@link #getManagerClassName}, returning the
|
||||
* appropriate place controller and manager class for that place.
|
||||
*/
|
||||
public /*abstract*/ class PlaceConfig
|
||||
implements Streamable
|
||||
public /*abstract*/ class PlaceConfig extends SimpleStreamableObject
|
||||
{
|
||||
public function PlaceConfig ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class that should be used to create a controller for this
|
||||
* place. The controller class must derive from {@link PlaceController}.
|
||||
*
|
||||
* @deprecated Override {@link #createController} directly.
|
||||
*/
|
||||
public function getControllerClass () :Class
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the controller that should be used for this place.
|
||||
*/
|
||||
@@ -61,17 +79,17 @@ public /*abstract*/ class PlaceConfig
|
||||
* (DashO Pro, for example) to remove the server code from the client,
|
||||
* knowing that it is never used.
|
||||
*/
|
||||
// public function getManagerClassName () :String;
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
public function getManagerClassName () :String
|
||||
{
|
||||
// nothing needed
|
||||
return null; // not used
|
||||
}
|
||||
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
// documentation inherited
|
||||
override protected function toStringBuilder (buf :StringBuilder) :void
|
||||
{
|
||||
// nothing needed
|
||||
buf.append("type=").append(ClassUtil.shortClassName(this));
|
||||
buf.append(", ");
|
||||
super.toStringBuilder(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,14 +23,13 @@ package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
/**
|
||||
* Defines access control tokens that convey certain privileges to users
|
||||
* (see {@link BodyObject#checkAccess}).
|
||||
*/
|
||||
public class TokenRing
|
||||
implements Streamable
|
||||
public class TokenRing extends SimpleStreamableObject
|
||||
{
|
||||
/** Indicates that this user is an administrator and can do things
|
||||
* like broadcast, shutdown the server and whatnot. */
|
||||
@@ -44,31 +43,6 @@ public class TokenRing
|
||||
_tokens = tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains the specified token.
|
||||
*/
|
||||
public function holdsToken (token :int) :Boolean
|
||||
{
|
||||
return (_tokens & token) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for checking whether this ring holds the
|
||||
* {@link #ADMIN} token.
|
||||
*/
|
||||
public function isAdmin () :Boolean
|
||||
{
|
||||
return holdsToken(ADMIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bitmask that stores the various tokens.
|
||||
*/
|
||||
public function getTokens () :int
|
||||
{
|
||||
return _tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified token to this ring.
|
||||
*/
|
||||
@@ -82,6 +56,31 @@ public class TokenRing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bitmask that stores the various tokens.
|
||||
*/
|
||||
public function getTokens () :int
|
||||
{
|
||||
return _tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for checking whether this ring holds the
|
||||
* {@link #ADMIN} token.
|
||||
*/
|
||||
public function isAdmin () :Boolean
|
||||
{
|
||||
return holdsToken(ADMIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains the specified token.
|
||||
*/
|
||||
public function holdsToken (token :int) :Boolean
|
||||
{
|
||||
return (_tokens & token) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the specified token from this ring.
|
||||
*/
|
||||
@@ -90,16 +89,18 @@ public class TokenRing
|
||||
_tokens &= ~token;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
out.writeInt(_tokens);
|
||||
super.readObject(ins);
|
||||
_tokens = ins.readInt();
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
_tokens = ins.readInt();
|
||||
super.writeObject(out);
|
||||
out.writeInt(_tokens);
|
||||
}
|
||||
|
||||
/** The tokens contained in this ring (composed together bitwise). */
|
||||
|
||||
Reference in New Issue
Block a user