MatrixEventBase

MatrixEventBase — Base class for Matrix events.

Functions

Types and Values

Description

Functions

matrix_event_get_handler ()

GType *
matrix_event_get_handler (const gchar *event_type);

Get the GType of the class that is registered to handle events with type param event_type.

Parameters

self

the (null) instance

 

event_type

 .

the event type to look up

.

[in]

Returns

a GType or Matrix.Event if no handler is registered


matrix_event_register_type ()

void
matrix_event_register_type (const gchar *event_type,
                            GType event_gtype,
                            GError **error);

Registers param event_type to be handled by the type param event_gtype.

Parameters

self

the (null) instance

 

event_type

 .

the type of the event

.

[in]

event_gtype

 .

the GType of the event’s handler

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_event_unregister_type ()

void
matrix_event_unregister_type (const gchar *event_type);

Unregister param event_type.

Parameters

self

the (null) instance

 

event_type

 .

the event type to remove

.

[in]

MATRIX_EVENT_TYPE_BASE

#define MATRIX_EVENT_TYPE_BASE (matrix_event_base_get_type ())

The type for MatrixEventBase.


matrix_event_base_from_json ()

void
matrix_event_base_from_json (MatrixEventBase *self,
                             JsonNode *json_data,
                             GError **error);

Subclasses should implement this function to initialize themselves from JSON data.

Parameters

self

the MatrixEventBase instance

 

json_data

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_event_base_to_json ()

void
matrix_event_base_to_json (MatrixEventBase *self,
                           JsonNode *json_data,
                           GError **error);

Subclasses should implement this to export their data to JSON.

Parameters

self

the MatrixEventBase instance

 

json_data

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_event_base_get_event_type ()

const gchar *
matrix_event_base_get_event_type (MatrixEventBase *self);

Get and return the current value of the "event-type" property.

The type of the event. It should be namespaced similar to the Java package naming conventions, e.g. com.example.subdomain.event.type. It cannot be changed after object initialization.

Parameters

self

the MatrixEventBase instance to query

 

Returns

the value of the "event-type" property


matrix_event_base_get_json ()

JsonNode *
matrix_event_base_get_json (MatrixEventBase *self);

Get and return the current value of the "json" property.

The event as a JSON node.

Parameters

self

the MatrixEventBase instance to query

 

Returns

the value of the "json" property


matrix_event_base_new_from_json ()

MatrixEventBase *
matrix_event_base_new_from_json (gchar *event_type,
                                 JsonNode *json_data,
                                 GError **error);

Parameters

event_type

 

 

json_data

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

Types and Values

struct MatrixEventBase

struct MatrixEventBase {
	GObject parent_instance;
	MatrixEventBasePrivate * priv;
	gchar* _event_type;
};

Base class for Matrix events.


struct MatrixEventBaseClass

struct MatrixEventBaseClass {
	GObjectClass parent_class;
	void (*from_json) (MatrixEventBase* self, JsonNode* json_data, GError** error);
	void (*to_json) (MatrixEventBase* self, JsonNode* json_data, GError** error);
};

The class structure for MATRIX_EVENT_TYPE_BASE. All the fields in this structure are private and should never be accessed directly.

Members

GObjectClass parent_class;

the parent class structure

 

from_json ()

virtual method called by matrix_event_base_from_json()

 

to_json ()

virtual method called by matrix_event_base_to_json()