JanaComponent

JanaComponent — A basic store component interface

Synopsis

                    JanaComponent;
enum                JanaComponentType;
JanaComponentType   jana_component_get_component_type   (JanaComponent *self);
gboolean            jana_component_is_fully_represented (JanaComponent *self);
gchar *             jana_component_get_uid              (JanaComponent *self);
gchar **            jana_component_get_categories       (JanaComponent *self);
void                jana_component_set_categories       (JanaComponent *self,
                                                         const gchar **categories);
gboolean            jana_component_supports_custom_props
                                                        (JanaComponent *self);
GList *             jana_component_get_custom_props_list
                                                        (JanaComponent *self);
gchar *             jana_component_get_custom_prop      (JanaComponent *self,
                                                         const gchar *name);
gboolean            jana_component_set_custom_prop      (JanaComponent *self,
                                                         const gchar *name,
                                                         const gchar *value);
void                jana_component_props_list_free      (GList *props);

Object Hierarchy

  GInterface
   +----JanaComponent

Prerequisites

JanaComponent requires GObject.

Description

JanaComponent is the basic interface for a component in a JanaStore. A component is uniquely identifiable, has a type and optionally, can store custom properties as key-value pairs.

Details

JanaComponent

typedef struct _JanaComponent JanaComponent;

The JanaComponent struct contains only private data.


enum JanaComponentType

typedef enum {
	JANA_COMPONENT_NULL,
	JANA_COMPONENT_EVENT,
	JANA_COMPONENT_NOTE,
	JANA_COMPONENT_TASK,
} JanaComponentType;

Enum values for different types of component.

JANA_COMPONENT_NULL

No specific type

JANA_COMPONENT_EVENT

Event type. Component can be cast to a JanaEvent

JANA_COMPONENT_NOTE

Note type. Component can be cast to a JanaNote

JANA_COMPONENT_TASK

Task type. Component can be cast to a JanaTask

jana_component_get_component_type ()

JanaComponentType   jana_component_get_component_type   (JanaComponent *self);

Get the JanaComponentType of self. The component type will tell you if the component can be cast to a more specific type.

self :

A JanaComponent

Returns :

The JanaComponentType of self.

jana_component_is_fully_represented ()

gboolean            jana_component_is_fully_represented (JanaComponent *self);

Determines whether the underlying data of self is fully represented by the libjana interface. If it isn't, there may be data in the component that is not reachable via libjana and modifying the object may destroy this data.

self :

A JanaComponent

Returns :

TRUE if the underlying data of self is fully represented by the libjana interface.

jana_component_get_uid ()

gchar *             jana_component_get_uid              (JanaComponent *self);

Get a unique identifying string for self. This can be used as the key in a hash table and does not change when modifying the component. A JanaComponent that is not a part of a JanaStore may not have a uid.

This function returns a newly allocated string. To avoid this allocation please use jana_component_peek_uid().

self :

A JanaComponent

Returns :

The unique identifier of self.

jana_component_get_categories ()

gchar **            jana_component_get_categories       (JanaComponent *self);

Retrieves the list of categories this component is filed under. See jana_component_set_categories().

self :

A JanaComponent

Returns :

A newly allocated, NULL-terminated string array, containing the component categories, to be freed with g_strfreev().

jana_component_set_categories ()

void                jana_component_set_categories       (JanaComponent *self,
                                                         const gchar **categories);

Sets or clears the component's category list, overriding any previous set. list. categories should be an array of NULL-terminated UTF-8 strings, and the final member of the array should be NULL.

self :

A JanaComponent

categories :

A NULL-terminated array of strings, or NULL

jana_component_supports_custom_props ()

gboolean            jana_component_supports_custom_props
                                                        (JanaComponent *self);

Determines whether self supports the setting and retrieval of custom properties.

self :

A JanaComponent

Returns :

TRUE if self supports custom properties, FALSE otherwise.

jana_component_get_custom_props_list ()

GList *             jana_component_get_custom_props_list
                                                        (JanaComponent *self);

Get a GList of properties set on self. The data component of each list element contains an array of two strings. The first string is the property name, the second the value. This list can be freed using jana_component_props_list_free().

self :

A JanaComponent

Returns :

A GList containing the properties set on self.

jana_component_get_custom_prop ()

gchar *             jana_component_get_custom_prop      (JanaComponent *self,
                                                         const gchar *name);

Retrieve a custom property set on self.

self :

A JanaComponent

name :

The key name of the property

Returns :

A string associated with the custom property, name, or NULL if the property has not been set.

jana_component_set_custom_prop ()

gboolean            jana_component_set_custom_prop      (JanaComponent *self,
                                                         const gchar *name,
                                                         const gchar *value);

Set a property on self. If the property has been set previously, the value will be overwritten. Implementations of JanaComponent may require that property names conform to a particular specification.

self :

A JanaComponent

name :

The key name of the property

value :

The value of the property

Returns :

TRUE if the property was set successfully, FALSE otherwise.

jana_component_props_list_free ()

void                jana_component_props_list_free      (GList *props);

Frees a JanaComponent property list, returned by jana_component_get_custom_props_list().

props :

A property list returned by jana_component_get_custom_props_list()