MIRAGE_Object object

## MIRAGE_Object object MIRAGE_Object object — Base object class |

## Synopsis

    #include <mirage.h>

                        MIRAGE_Object;
    gboolean            mirage_object_set_debug_context     (MIRAGE_Object *self,
                                                             GObject *debug_context,
                                                             GError **error);
    gboolean            mirage_object_get_debug_context     (MIRAGE_Object *self,
                                                             GObject **debug_context,
                                                             GError **error);
    void                mirage_object_debug_message         (MIRAGE_Object *self,
                                                             gint level,
                                                             gchar *format,
                                                             ...);
    void                mirage_object_debug_messagev        (MIRAGE_Object *self,
                                                             gint level,
                                                             gchar *format,
                                                             va_list args);
    gboolean            mirage_object_set_parent            (MIRAGE_Object *self,
                                                             GObject *parent,
                                                             GError **error);
    gboolean            mirage_object_get_parent            (MIRAGE_Object *self,
                                                             GObject **parent,
                                                             GError **error);
    gboolean            mirage_object_attach_child          (MIRAGE_Object *self,
                                                             GObject *child,
                                                             GError **error);
    gboolean            mirage_object_detach_child          (MIRAGE_Object *self,
                                                             GObject *child,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----MIRAGE_Object
             +----MIRAGE_CDTextEncDec
             +----MIRAGE_Disc
             +----MIRAGE_Fragment
             +----MIRAGE_Index
             +----MIRAGE_Language
             +----MIRAGE_Sector
             +----MIRAGE_Session
             +----MIRAGE_Track
             +----MIRAGE_Parser

## Signals

      "object-modified"                                : Run Last / Has Details

## Description

MIRAGE_Object is used as a base object class throughout libMirage. It implements support for layout definitions (setting object's parent and children) and debugging via debug contexts.

## Details

### MIRAGE_Object

    typedef struct _MIRAGE_Object MIRAGE_Object;

Contains private data only, and should be accessed using the functions below.

### mirage_object_set_debug_context ()

    gboolean            mirage_object_set_debug_context     (MIRAGE_Object *self,
                                                             GObject *debug_context,
                                                             GError **error);

Sets object's debug context.

`self` : | a MIRAGE_Object
`debug_context` : | debug context
`error` : | location to store error, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

### mirage_object_get_debug_context ()

    gboolean            mirage_object_get_debug_context     (MIRAGE_Object *self,
                                                             GObject **debug_context,
                                                             GError **error);

Retrieves object's debug context. A reference to debug context is stored in `debug_context`; it should be released with `g_object_unref()` when no longer needed.

`self` : | a MIRAGE_Object
`debug_context` : | location to store debug context, or `NULL`
`error` : | location to store error, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

### mirage_object_debug_message ()

    void                mirage_object_debug_message         (MIRAGE_Object *self,
                                                             gint level,
                                                             gchar *format,
                                                             ...);

Outputs debug message with verbosity level `level`, format string `format` and format arguments `Varargs`. The message is displayed if object's debug context has mask that covers `level`, or if `level` is either `MIRAGE_DEBUG_WARNING` or `MIRAGE_DEBUG_ERROR`.

`self` : | a MIRAGE_Object
`level` : | debug level
`format` : | message format. See the `printf()` documentation.
`...` : | parameters to insert into the format string.

### mirage_object_debug_messagev ()

    void                mirage_object_debug_messagev        (MIRAGE_Object *self,
                                                             gint level,
                                                             gchar *format,
                                                             va_list args);

Outputs debug message with verbosity level `level`, format string `format` and format arguments `args`. The message is displayed if object's debug context has mask that covers `level`, or if `level` is either `MIRAGE_DEBUG_WARNING` or `MIRAGE_DEBUG_ERROR`.

`self` : | a MIRAGE_Object
`level` : | debug level
`format` : | message format. See the `printf()` documentation.
`args` : | parameters to insert into the format string.

### mirage_object_set_parent ()

    gboolean            mirage_object_set_parent            (MIRAGE_Object *self,
                                                             GObject *parent,
                                                             GError **error);

Sets object's parent.

`self` : | a MIRAGE_Object
`parent` : | parent
`error` : | location to store error, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

### mirage_object_get_parent ()

    gboolean            mirage_object_get_parent            (MIRAGE_Object *self,
                                                             GObject **parent,
                                                             GError **error);

Retrieves object's parent.

`self` : | a MIRAGE_Object
`parent` : | location to store parent, or `NULL`
`error` : | location to store error, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

### mirage_object_attach_child ()

    gboolean            mirage_object_attach_child          (MIRAGE_Object *self,
                                                             GObject *child,
                                                             GError **error);

Attaches child to the object.

`self` : | a MIRAGE_Object
`child` : | child
`error` : | location to store error, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

### mirage_object_detach_child ()

    gboolean            mirage_object_detach_child          (MIRAGE_Object *self,
                                                             GObject *child,
                                                             GError **error);

Detaches child from the object. Note that the child will keep the debug context it may have been passed to while being attached to the parent.

`self` : | a MIRAGE_Object
`child` : | child
`error` : | location to store error, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

## Signal Details

### The `"object-modified"` signal

    void                user_function                      (MIRAGE_Object *mirage_object,
                                                            gpointer       user_data)          : Run Last / Has Details

Emitted each `mirage_object` is changed in a way that causes bottom-up change.

`mirage_object` : | the object which received the signal
`user_data` : | user data set when the signal handler was connected.

## See Also

MIRAGE_DebugContext