Serializable


Object Hierarchy:

Object hierarchy for Serializable

Description:

public interface Serializable : Object

GObject that encodes and decodes on a Stream.

Implement this on every wire type. Scalars, enums, flags, nested Serializable objects, and string[] encode by default. Override bin_write_prop / bin_read_prop for Gee.ArrayList , uint8[], or other non-scalars — call bin_default_write_prop / bin_default_read_prop for the rest. Use bin_pre / bin_post for work around inbound decode.

Example

public class Pair : GLib.Object, OLLMrpc.Bin.Serializable {
public string name { get; set; default = ""; }
public int count { get; set; default = 0; }
}

OLLMrpc.Bin.register("Pair", typeof(Pair));
write_bin.write(new Pair() { name = "alpha", count = 42 });
var parsed = read_bin.parse() as Pair;

List property

public override void bin_write_prop(
OLLMrpc.Bin.Stream ctx, GLib.ParamSpec prop
) throws GLib.Error {
switch (prop.name) {
case "items":
this.bin_write_prop_array(ctx, "items", typeof(Pair));
return;
default:
this.bin_default_write_prop(ctx, prop);
return;
}
}

See also:

Stream, Json


Namespace: OLLMrpc.Bin
Package: ollmchat

Content:

Methods:

Inherited Members:

All known members inherited from class GLib.Object