## FMAObject FMAObject — The Deepest Base Class Definition |

## Functions

#define | FMA_OBJECT()
#define | FMA_IS_OBJECT()
void | fma_object_object_reset_origin ()
FMAObject * | fma_object_object_ref ()
void | fma_object_object_unref ()
void | fma_object_object_dump ()
void | fma_object_object_dump_norec ()
void | fma_object_object_dump_tree ()
void | fma_object_object_check_status_rec ()
GList * | fma_object_get_hierarchy ()
void | fma_object_free_hierarchy ()
void | fma_object_object_debug_invalid ()

## Types and Values

#define | FMA_TYPE_OBJECT
| FMAObject
| FMAObjectClass

## Includes

    #include <filemanager-actions/fma-object.h>

## Description

This is the base class of all our data object hierarchy. FMAObject is supposed to be used as a pure virtual base class, i.e. should only be derived.

All the API described here is rather private. External code should use the API described in `filemanager-actions/fma-object-api.h`.

## Functions

### FMA_OBJECT()

    #define FMA_OBJECT( object )           ( G_TYPE_CHECK_INSTANCE_CAST( object, FMA_TYPE_OBJECT, FMAObject ))

### FMA_IS_OBJECT()

    #define FMA_IS_OBJECT( object )        ( G_TYPE_CHECK_INSTANCE_TYPE( object, FMA_TYPE_OBJECT ))

### fma_object_object_reset_origin ()

    void
    fma_object_object_reset_origin (FMAObject *object,
                                    const FMAObject *origin);

Recursively reset origin of `object` and its children to `origin` (and its children), so that `origin` appears as the actual origin of `object` .

The origin of `origin` itself is set to NULL.

This only works if `origin` has just been duplicated from `object` , and thus we do not have to check if children lists are equal.

#### Parameters

object | a FMAObject -derived object. |
origin | must be a duplication of `object` . |

Since: 2.30

### fma_object_object_ref ()

    FMAObject *
    fma_object_object_ref (FMAObject *object);

Recursively ref the `object` and all its children, incrementing their reference_count by 1.

#### Parameters

object | a FMAObject -derived object. |

#### Returns

a reference on the `object` .

Since: 2.30

### fma_object_object_unref ()

    void
    fma_object_object_unref (FMAObject *object);

Recursively unref the `object` and all its children, decrementing their reference count by 1.

Note that we may want to free a copy+ref of a list of items which have had already disposed (which is probably a bug somewhere). So first test is to determine if the object is still alive.

#### Parameters

object | a FMAObject -derived object. |

Since: 2.30

### fma_object_object_dump ()

    void
    fma_object_object_dump (const FMAObject *object);

Dumps via `g_debug()` the actual content of the object.

The recursivity is dealt with here because, if we would let FMAObjectItem do this, the dump of FMAObjectItem -derived object would be splitted, children being inserted inside.

fma_object_dump() doesn't modify the reference count of the dumped object.

#### Parameters

object | the FMAObject -derived object to be dumped. |

Since: 2.30

### fma_object_object_dump_norec ()

    void
    fma_object_object_dump_norec (const FMAObject *object);

Dumps via g_debug the actual content of the object.

This function is not recursive.

#### Parameters

object | the FMAObject -derived object to be dumped. |

Since: 2.30

### fma_object_object_dump_tree ()

    void
    fma_object_object_dump_tree (GList *tree);

Outputs a brief, hierarchical dump of the provided list.

#### Parameters

tree | a hierarchical list of FMAObject -derived objects. |

Since: 2.30

### fma_object_object_check_status_rec ()

    void
    fma_object_object_check_status_rec (const FMAObject *object);

Recursively checks for the edition status of `object` and its children (if any).

Internally set some properties which may be requested later. This two-steps check-request let us optimize some work in the UI.

fma_object_object_check_status_rec( object )
+- fma_iduplicable_check_status( object )
+- get_origin( object )
+- modified_status = v_are_equal( origin, object )
| +-> interface `FMAObjectClass::are_equal`
| which happens to be iduplicable_are_equal( a, b )
| +- v_are_equal( a, b )
| +- FMAObjectAction::`are_equal()`
| +- `fma_factory_object_are_equal()`
| +- check FMAObjectActionPrivate data
| +- call parent class
| +- FMAObjectItem::`are_equal()`
| +- check FMAObjectItemPrivate data
| +- call parent class
| +- FMAObjectId::`are_equal()`
|
+- valid_status = v_is_valid( object ) -> interface `FMAObjectClass::is_valid`

Note that the recursivity is managed here, so that we can be sure that edition status of children is actually checked before those of the parent.

As of 3.1.0: .

- when the modification status of a FMAObjectProfile changes, then its FMAObjectAction parent is rechecked;

- when the validity status of an object is changed, then its parent is also rechecked.

#### Parameters

object | the FMAObject -derived object to be checked. |

Since: 2.30

### fma_object_get_hierarchy ()

    GList *
    fma_object_get_hierarchy (const FMAObject *object);

`fma_object_get_hierarchy` has been deprecated since version 3.1 and should not be used in newly-written code.

#### Parameters

object | the FMAObject -derived object. |

#### Returns

the class hierarchy, from the topmost base class, to the most-derived one.

Since: 2.30

### fma_object_free_hierarchy ()

    void
    fma_object_free_hierarchy (GList *hierarchy);

`fma_object_free_hierarchy` has been deprecated since version 3.1 and should not be used in newly-written code.

Releases the FMAObject hierarchy.

#### Parameters

hierarchy | the GList of hierarchy, as returned from `fma_object_get_hierarchy()`. |

Since: 2.30

### fma_object_object_debug_invalid ()

    void
    fma_object_object_debug_invalid (const FMAObject *object,
                                     const gchar *reason);

Dump the object with the invalidity reason.

#### Parameters

object | the FMAObject -derived object which is invalid. |
reason | the reason. |

Since: 2.30

## Types and Values

### FMA_TYPE_OBJECT

    #define FMA_TYPE_OBJECT                ( fma_object_object_get_type())

### FMAObject

    typedef struct {
    } FMAObject;

### FMAObjectClass

    typedef struct {
    	/**
    	 * dump:
    	 * @object: the FMAObject-derived object to be dumped.
    	 *
    	 * Dumps via g_debug the content of the object.
    	 *
    	 * The derived class should call its parent class at the end of the
    	 * dump of its own datas.
    	 *
    	 * Since: 2.30
    	 */
    	void     ( *dump )     ( const FMAObject *object );

    	/**
    	 * copy:
    	 * @target: the FMAObject-derived object which will receive data.
    	 * @source: the FMAObject-derived object which provides data.
    	 * @mode: the copy mode.
    	 *
    	 * Copies data and properties from @source to @target.
    	 *
    	 * The derived class should call its parent class at the end of the
    	 * copy of its own datas.
    	 *
    	 * Since: 2.30
    	 */
    	void     ( *copy )     ( FMAObject *target, const FMAObject *source, guint mode );

    	/**
    	 * are_equal:
    	 * @a: a first FMAObject object.
    	 * @b: a second FMAObject object to be compared to the first one.
    	 *
    	 * Compares the two objects.
    	 *
    	 * When testing for the modification status of an object, @a stands for
    	 * the original object, while @b stands for the duplicated one.
    	 *
    	 * As long as no difference is detected, the derived class should call
    	 * its parent class at the end of its comparison.
    	 * As soon as a difference is detected, the calling sequence should
    	 * be stopped, and the result returned.
    	 *
    	 * Returns: TRUE if @a and @b are identical, FALSE else.
    	 *
    	 * Since: 2.30
    	 */
    	gboolean ( *are_equal )( const FMAObject *a, const FMAObject *b );

    	/**
    	 * is_valid:
    	 * @object: the FMAObject object to be checked.
    	 *
    	 * Checks @object for validity.
    	 *
    	 * A FMAObject is valid if its internal identifier is set.
    	 *
    	 * As long as the item is valid, the derived class should call its parent
    	 * at the end of its checks.
    	 * As soon as an error is detected, the calling sequence should be stopped,
    	 * and the result returned.
    	 *
    	 * Returns: TRUE if @object is valid, FALSE else.
    	 *
    	 * Since: 2.30
    	 */
    	gboolean ( *is_valid ) ( const FMAObject *object );
    } FMAObjectClass;

The FMAObjectClass defines some methods available to derived classes.

#### Members

`dump` () | Dumps the FMAObject -part of the FMAObject -derived object. |
`copy` () | Copies a FMAObject to another. |
`are_equal` () | Tests if two FMAObject are equal. |
`is_valid` () | Tests if a FMAObject is valid. |