Session Items Factory

digraph inheritance { rankdir=LR; GObject -> WpSiFactory; }
struct WpSiFactory

A factory for session items.

The most simple way to register a new item implementation would be:

wp_si_factory_register (core,
   wp_si_factory_new_simple ("foobar", FOO_TYPE_BAR));

And the most simple way to construct an item from a registered factory:

item = wp_session_item_make (core, "foobar");

GObject Properties

name

The factory’s name

struct _WpSiFactoryClass

Public Members

GObjectClass parent_class
WpSessionItem *(*construct)(WpSiFactory *self, WpCore *core)
const gchar *wp_si_factory_get_name(WpSiFactory *self)

Gets the name of the factory.

Return

the factory name

Parameters
  • self: the factory

WpSessionItem *wp_si_factory_construct(WpSiFactory *self, WpCore *core)

Creates a new instance of the session item that is constructed by this factory.

Return

(transfer full): a new session item instance

Parameters
  • self: the factory

  • core: the core

void wp_si_factory_register(WpCore *core, WpSiFactory *factory)

Registers the factory on the core.

Parameters
  • core: the core

  • factory: (transfer full): the factory to register

WpSiFactory *wp_si_factory_find(WpCore *core, const gchar *factory_name)

Looks up a factory matching a name.

Return

(transfer full) (nullable): the factory matching the lookup name

Parameters
  • core: the core

  • factory_name: the lookup name

WpSessionItem *wp_session_item_make(WpCore *core, const gchar *factory_name)

Finds the factory associated with the given name from the core and uses it to construct a new WpSessionItem.

Return

(transfer full) (nullable): the new session item

Parameters
  • core: the WpCore

  • factory_name: the name of the factory to be used for constructing the object

WpSiFactory *wp_si_factory_new_simple(const gchar *factory_name, GType si_type)

Creates a simple factory that constructs objects of a given GType.

Return

(transfer full): the new factory

Parameters
  • factory_name: the factory name; must be a static string!

  • si_type: the WpSessionItem subclass type to instantiate for constructing items

WP_TYPE_SI_FACTORY (wp_si_factory_get_type ())

The WpSiFactory GType.