## FoObject FoObject — libfo base object type |

## Synopsis

                        FoObject;
                        FoObjectClass;
    FoObject*           fo_object_new                       (void);
    void                fo_object_debug_dump                (gpointer object,
                                                             gint depth);
    gchar*              fo_object_debug_sprintf             (gpointer object);
    gchar*              fo_object_sprintf                   (gpointer object);
    void                fo_object_log_error                 (FoObject *object,
                                                             GError **error);
    void                fo_object_log_warning               (FoObject *object,
                                                             GError **warning);
    void                fo_object_log_debug                 (FoObject *object,
                                                             GError **debug);
    gboolean            fo_object_log_or_propagate_error    (FoObject *fo_object,
                                                             GError **dest,
                                                             GError *src);
    gboolean            fo_object_maybe_propagate_error     (FoObject *fo_object,
                                                             GError **dest,
                                                             GError *src,
                                                             gboolean continue_after_error);
    guint               fo_object_hash                      (FoObject *object,
                                                             GError **error);
    gboolean            fo_object_equal                     (FoObject *a,
                                                             FoObject *b,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----FoObject
             +----FoNode
             +----FoDatatype
             +----FoContext
             +----FoProperty
             +----FoHashTable

## Description

Top of the object hierarchy for libfo.

Extends GObject to add some common debugging and logging functions.

## Details

### FoObject

    typedef struct _FoObject FoObject;

### FoObjectClass

    typedef struct {
      GObjectClass parent_class;

      void     (* debug_dump)	      (FoObject     *object,
    				       gint          depth);
      char*    (* debug_sprintf)	      (FoObject     *object);
      char*    (* print_sprintf)	      (FoObject     *object);
      void     (* log_error)              (FoObject     *object,
    				       GError      **error);
      void     (* log_warning)            (FoObject     *object,
    				       GError      **warning);
      void     (* log_debug)              (FoObject     *object,
    				       GError      **debug);
      gboolean (* log_or_propagate_error) (FoObject     *fo_object,
    				       GError      **dest,
    				       GError       *src);
      gboolean (* maybe_propagate_error)  (FoObject     *fo_object,
    				       GError      **dest,
    				       GError       *src,
    				       gboolean      continue_after_error);
      guint    (* hash_func)              (gconstpointer key);
      gboolean (* equal_func)             (gconstpointer a,
    				       gconstpointer b);
    } FoObjectClass;

### fo_object_new ()

    FoObject*           fo_object_new                       (void);

Creates a new FoObject initialized to default value.

Returns : | the new FoObject.

### fo_object_debug_dump ()

    void                fo_object_debug_dump                (gpointer object,
                                                             gint depth);

Calls debug_dump method of class of `object`, if `object` is an FoObject or descendant type of FoObject.

`object` : | The FoObject object.
`depth` : | Indent level to add to the output.

### fo_object_debug_sprintf ()

    gchar*              fo_object_debug_sprintf             (gpointer object);

Calls debug_sprintf method of class of `object`, if `object` is an FoObject or descendant type of FoObject.

`object` : | The FoObject object.
Returns : | Result of debug_sprintf method of class of `object`.

### fo_object_sprintf ()

    gchar*              fo_object_sprintf                   (gpointer object);

Calls sprintf method of class of `object`, if `object` is an FoObject or descendant type of FoObject.

`object` : | The FoObject object.
Returns : | Result of sprintf method of class of `object`.

### fo_object_log_error ()

    void                fo_object_log_error                 (FoObject *object,
                                                             GError **error);

Calls the 'log_error' method of the class of `object`.

The called method clears `error`.

`object` : | FoObject that is subject of `error`.
`error` : | GError with information about error that occurred.

### fo_object_log_warning ()

    void                fo_object_log_warning               (FoObject *object,
                                                             GError **warning);

Calls the 'log_warning' method of the class of `object`.

The called method clears `error`.

`object` : | FoObject that is subject of `error`.
`warning` : | GError with information about warning that occurred.

### fo_object_log_debug ()

    void                fo_object_log_debug                 (FoObject *object,
                                                             GError **debug);

Calls the 'log_debug' method of the class of `object`.

The called method clears `error`.

`object` : | FoObject that is subject of `error`.
`debug` : | GError with debugging information.

### fo_object_log_or_propagate_error ()

    gboolean            fo_object_log_or_propagate_error    (FoObject *fo_object,
                                                             GError **dest,
                                                             GError *src);

If can propagate `src` to `dest`, do so, otherwise log `src` using `fo_object_log_error()`.

`fo_object` : | FoObject that is the subject of `src`.
`dest` : | GError to which to propagate `src`, or NULL.
`src` : | GError with information about error that occurred.
Returns : | `TRUE` if error propagated, otherwise `FALSE`.

### fo_object_maybe_propagate_error ()

    gboolean            fo_object_maybe_propagate_error     (FoObject *fo_object,
                                                             GError **dest,
                                                             GError *src,
                                                             gboolean continue_after_error);

If `continue_after_error` is `FALSE` and can propagate `src` to `dest`, then do so, otherwise log `src` using `fo_object_log_error()`.

`fo_object` : | FoObject that is the subject of `src`.
`dest` : | GError to which to propagate `src`, or NULL.
`src` : | GError with information about error that occurred.
`continue_after_error` : | Whether or not to continue after an error.
Returns : | `TRUE` if error propagated, otherwise `FALSE`.

### fo_object_hash ()

    guint               fo_object_hash                      (FoObject *object,
                                                             GError **error);

Create a hash code for the object.

`object` : | FoObject for which to get hash value.
`error` : | GError with information about error that occurred.
Returns : | Hash code for the object.

### fo_object_equal ()

    gboolean            fo_object_equal                     (FoObject *a,
                                                             FoObject *b,
                                                             GError **error);

Compare `a` to `b` using the 'equal_func' of the class of `a`.

`a` : | First object to compare.
`b` : | Second object to compare.
`error` : | GError with information about error that occurred.
Returns : | `TRUE` if the objects are equal.