Galago - desktop presence framework

galago-object.h File Reference

Galago Object API. More...

#include <libgalago/galago-types.h>
#include <libgalago/galago-context-base.h>
#include <libgalago/galago-signals.h>

Go to the source code of this file.


Class API

GalagoObjectClassgalago_class_register (GalagoObjectClass *parent_class, const char *name, const char *dbus_iface, const GalagoObjectClassInfo *info)
 Registers a new type of class.
GalagoObjectClassgalago_class_get_parent (const GalagoObjectClass *klass)
 Returns a class's parent class.
const char * galago_class_get_name (const GalagoObjectClass *klass)
 Returns a class's name.
const char * galago_class_get_dbus_iface (const GalagoObjectClass *klass)
 Returns the D-BUS interface of a class.
GalagoSignalContext * galago_class_get_signal_context (const GalagoObjectClass *klass)
 Returns the signal context for a class.

Object API

void * galago_object_new (GalagoObjectClass *klass)
 Creates an object.
void * galago_object_ref (void *object)
 References an object.
void * galago_object_unref (void *object)
 Unreferences an object.
GalagoObjectClassgalago_object_get_class (const void *object)
 Returns the object's class.
void galago_object_set_flags (void *object, unsigned long flags)
 Sets the flags for an object.
unsigned long galago_object_get_flags (const void *object)
 Returns the flags for an object.
void galago_object_set_dbus_path (void *object, const char *obj_path)
 Sets the D-BUS object path of an object.
const char * galago_object_get_dbus_path (const void *object)
 Returns the D-BUS object path of an object.
void galago_object_set_watch (void *object, galago_bool watch)
 Sets whether or not this object is watched for events.
galago_bool galago_object_is_watched (const void *object)
 Returns whether or not an object is watched for events.
void galago_object_set_data (void *object, const char *name, void *value)
 Sets custom data on an object.
void * galago_object_get_data (const void *object, const char *name)
 Returns custom data from an object.
GalagoContext * galago_object_get_context (const void *object)
 Returns the object's context.
GalagoObjectgalago_object_check_cast (const void *ptr, const GalagoObjectClass *klass)
 Casts the specified pointer to a GalagoObject, if the pointer is an object and matches the type specified.

Defines

#define GALAGO_OBJECT_MAGIC   0xB00F
#define GALAGO_CLASS_MAGIC   0xB0B0
#define GALAGO_IS_OBJECT(ptr)   ((ptr) != NULL && ((GalagoObject *)(ptr))->magic == GALAGO_OBJECT_MAGIC)
#define GALAGO_IS_CLASS(ptr)   ((ptr) != NULL && ((GalagoObjectClass *)(ptr))->magic == GALAGO_CLASS_MAGIC)
#define GALAGO_OBJECT(ptr)
#define GALAGO_OBJECT_CLASS(obj)   (galago_object_get_class(obj))
#define GALAGO_OBJECT_CAST(obj, klass, type)   ((obj) == NULL ? NULL : (type *)galago_object_check_cast((obj), (klass)))
#define GALAGO_OBJECT_GET_FLAGS(obj)   (galago_object_get_flags(obj))
#define GALAGO_OBJECT_SET_FLAGS(obj, flags)   galago_object_set_flags((obj), (flags))
#define GALAGO_OBJECT_SET_FLAG(obj, flag)   GALAGO_OBJECT_SET_FLAGS((obj), GALAGO_OBJECT_GET_FLAGS(obj) | (flag))
#define GALAGO_OBJECT_UNSET_FLAG(obj, flag)   GALAGO_OBJECT_SET_FLAGS((obj), GALAGO_OBJECT_GET_FLAGS(obj) & ~(flag))
#define GALAGO_OBJECT_HAS_FLAG(obj, flag)   ((GALAGO_OBJECT_GET_FLAGS(obj) & (flag)) == (flag))

Typedefs

typedef _GalagoObjectClass GalagoObjectClass
typedef _GalagoObjectClassInfo GalagoObjectClassInfo
typedef _GalagoObjectClassPrivate GalagoObjectClassPrivate
typedef _GalagoObject GalagoObject
typedef _GalagoObjectPrivate GalagoObjectPrivate
typedef void(* GalagoObjectClassInitFunc )(GalagoObjectClass *klass)
typedef void(* GalagoObjectClassFinalizeFunc )(GalagoObjectClass *klass)
typedef void(* GalagoObjectInitFunc )(GalagoObject *object)

Enumerations

enum  GalagoObjectFlags { GALAGO_FLAG_FINALIZING = 1 << 1 }
enum  GalagoObjectClassFlags { GALAGO_FLAG_ABSTRACT = 1 << 1 }

Detailed Description

Galago Object API.

Copyright:
(C) 2004-2005 Christian Hammond
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file galago-object.h.


Define Documentation

#define GALAGO_OBJECT ptr   ) 
 

Value:

((ptr) == NULL ? NULL : \
     (GALAGO_IS_OBJECT(ptr) ? (GalagoObject *)(ptr) : NULL))

Definition at line 113 of file galago-object.h.


Enumeration Type Documentation

enum GalagoObjectClassFlags
 

Enumeration values:
GALAGO_FLAG_ABSTRACT  Abstract object.

Definition at line 42 of file galago-object.h.

enum GalagoObjectFlags
 

Enumeration values:
GALAGO_FLAG_FINALIZING  Object is being finalized.

Definition at line 36 of file galago-object.h.


Function Documentation

const char* galago_class_get_dbus_iface const GalagoObjectClass klass  ) 
 

Returns the D-BUS interface of a class.

Parameters:
klass The class.
Returns:
The D-BUS interface.

const char* galago_class_get_name const GalagoObjectClass klass  ) 
 

Returns a class's name.

Parameters:
klass The class.
Returns:
The class's name.

GalagoObjectClass* galago_class_get_parent const GalagoObjectClass klass  ) 
 

Returns a class's parent class.

Parameters:
klass The class.
Returns:
The parent class.

GalagoSignalContext* galago_class_get_signal_context const GalagoObjectClass klass  ) 
 

Returns the signal context for a class.

Parameters:
klass The class.
Returns:
The class's signal context, if set.

GalagoObjectClass* galago_class_register GalagoObjectClass parent_class,
const char *  name,
const char *  dbus_iface,
const GalagoObjectClassInfo info
 

Registers a new type of class.

Parameters:
parent_class The optional parent class.
name The name of the class.
dbus_iface The optional D-BUS interface for this class.
info The static class information structure.
Returns:
The new class, or NULL on error.

GalagoObject* galago_object_check_cast const void *  ptr,
const GalagoObjectClass klass
 

Casts the specified pointer to a GalagoObject, if the pointer is an object and matches the type specified.

Parameters:
ptr The pointer to the object to cast.
klass The class type.
Returns:
ptr casted into a GalagoObject, if ptr is an object and if its class type matches klass.

GalagoObjectClass* galago_object_get_class const void *  object  ) 
 

Returns the object's class.

Parameters:
object The object.
Returns:
The object's class.

GalagoContext* galago_object_get_context const void *  object  ) 
 

Returns the object's context.

Parameters:
object The object.
Returns:
The object's context.

void* galago_object_get_data const void *  object,
const char *  name
 

Returns custom data from an object.

Parameters:
object The object.
name The propert name.
Returns:
The data.

const char* galago_object_get_dbus_path const void *  object  ) 
 

Returns the D-BUS object path of an object.

Parameters:
object The object.
Returns:
The object path.

unsigned long galago_object_get_flags const void *  object  ) 
 

Returns the flags for an object.

Parameters:
object The object.
Returns:
The flags for the object.

galago_bool galago_object_is_watched const void *  object  ) 
 

Returns whether or not an object is watched for events.

Parameters:
object The object.
Returns:
TRUE if this object is being watched, or FALSE.

void* galago_object_new GalagoObjectClass klass  ) 
 

Creates an object.

Parameters:
klass The object's class.

void* galago_object_ref void *  object  ) 
 

References an object.

Parameters:
object The object to reference.
Returns:
The object.

void galago_object_set_data void *  object,
const char *  name,
void *  value
 

Sets custom data on an object.

Parameters:
object The object.
name The property name.
value The data.

void galago_object_set_dbus_path void *  object,
const char *  obj_path
 

Sets the D-BUS object path of an object.

Parameters:
object The object.
obj_path The object path.

void galago_object_set_flags void *  object,
unsigned long  flags
 

Sets the flags for an object.

Parameters:
object The object.
flags The flags.

void galago_object_set_watch void *  object,
galago_bool  watch
 

Sets whether or not this object is watched for events.

Parameters:
object The object.
watch TRUE if this object should be watched, or FALSE.

void* galago_object_unref void *  object  ) 
 

Unreferences an object.

Parameters:
object The object to unreference.
Returns:
The object, or NULL if its reference count reached 0.