DexterPluginService

DexterPluginService — Service descriptors for identifying and using Libdexter services

Synopsis

#include <dexterplugin.h>

#define             DEXTERPLUGIN_SERVICE_ERROR
enum                DexterPluginServiceError;

                    DexterPluginService;
                    DexterPluginServiceGroup;

DexterPluginService * dexterplugin_service_new          (GType type,
                                                         const gchar *name,
                                                         const gchar *blurb,
                                                         const gchar *uuid);
DexterPluginService * dexterplugin_service_dup          (const DexterPluginService *service);
void                dexterplugin_service_copy           (DexterPluginService *dest,
                                                         const DexterPluginService *source);
void                dexterplugin_service_free           (DexterPluginService *service);
DexterPluginServiceGroup * dexterplugin_service_group_new
                                                        (guint n_services);
void                dexterplugin_service_group_free     (DexterPluginServiceGroup *service_group);
gboolean            dexterplugin_service_group_find_uuid
                                                        (DexterPluginService **service,
                                                         DexterPluginServiceGroup *service_group,
                                                         const gchar *uuid);

Description

Service descriptors provide identification information for Libdexter services. Collections of service descriptors are delivered to the user by Service Brokers as service groups. Each descriptor contains a universally unique identifier (uuid) to distinquish it from all other services. During service registration, each service is assigned a GType by the GTypeModule system. That type is used by GLib/GObject to instantiate objects implementing the service.

Note that the service GType is dynamic in nature and will vary. Do not use it to identify services. Use the uuid instead.

Details

DEXTERPLUGIN_SERVICE_ERROR

#define DEXTERPLUGIN_SERVICE_ERROR dexterplugin_service_error_quark()

The error domain of the libdexterplugin service subsystem.


enum DexterPluginServiceError

typedef enum {
    DEXTERPLUGIN_SERVICE_ERROR_FAILED
} DexterPluginServiceError;

Error codes for DexterPluginService operations.

DEXTERPLUGIN_SERVICE_ERROR_FAILED

general failure.

DexterPluginService

typedef struct {
  GType       type;
  gchar      *name;
  gchar      *blurb;
  gchar      *uuid;
} DexterPluginService;

A plugin service descriptor.

GType type;

service type assigned during service registration.

gchar *name;

name of the service.

gchar *blurb;

description of the service.

gchar *uuid;

univerally unique identifier of the service.

DexterPluginServiceGroup

typedef struct {
  guint                n_services;
  DexterPluginService *services;
} DexterPluginServiceGroup;

A collection of plugin service descriptors.

guint n_services;

number of services in the group.

DexterPluginService *services;

service array of size n_services.

dexterplugin_service_new ()

DexterPluginService * dexterplugin_service_new          (GType type,
                                                         const gchar *name,
                                                         const gchar *blurb,
                                                         const gchar *uuid);

Creates a new service descriptor. It must be freed with dexterplugin_service_free().

type :

service type.

name :

service name.

blurb :

service description.

uuid :

service uuid (univerally unique identifier).

Returns :

DexterPluginService service descriptor.

dexterplugin_service_dup ()

DexterPluginService * dexterplugin_service_dup          (const DexterPluginService *service);

Creates a duplicate of a service descriptor. It must be freed with dexterplugin_service_free().

service :

DexterPluginService to duplicate.

Returns :

DexterPluginService service descriptor.

dexterplugin_service_copy ()

void                dexterplugin_service_copy           (DexterPluginService *dest,
                                                         const DexterPluginService *source);

Copies a service descriptor. Existing data on the destination descriptor will be freed prior to the copy.

dest :

destination address of a DexterPluginService.

source :

source address of a DexterPluginService.

dexterplugin_service_free ()

void                dexterplugin_service_free           (DexterPluginService *service);

Frees a service descriptor.

service :

address of a DexterPluginService service descriptor.

dexterplugin_service_group_new ()

DexterPluginServiceGroup * dexterplugin_service_group_new
                                                        (guint n_services);

Allocates a DexterPluginServiceGroup with a DexterPluginService array of size n_services. The elements of the contained DexterPluginService array must be populated, e.g. with dexterplugin_service_copy(). The service group should be freed with dexterplugin_service_group_free(). Plugin writers should always use this api for allocation of service groups.

n_services :

size of contained DexterPluginService array.

Returns :

DexterPluginServiceGroup service group.

Since 0.1.4


dexterplugin_service_group_free ()

void                dexterplugin_service_group_free     (DexterPluginServiceGroup *service_group);

Frees a service group created with dexterplugin_service_group_new().

service_group :

DexterPluginServiceGroup collection of service descriptors.

dexterplugin_service_group_find_uuid ()

gboolean            dexterplugin_service_group_find_uuid
                                                        (DexterPluginService **service,
                                                         DexterPluginServiceGroup *service_group,
                                                         const gchar *uuid);

Finds a service by uuid in the service_group. If found, the service pointer will be set to point into the service_group->services array.

service :

address of a pointer to a DexterPluginService service descriptor.

service_group :

DexterPluginServiceGroup collection of service descriptors.

uuid :

uuid of service to find.

Returns :

gboolean indicating if the service was found or not.