NABoxed

## NABoxed NABoxed — The NABoxed Structure |

## Functions

#define | NA_TYPE_BOXED
#define | NA_BOXED()
#define | NA_IS_BOXED()
void | na_boxed_set_type ()
gboolean | na_boxed_are_equal ()
NABoxed * | na_boxed_copy ()
void | na_boxed_dump ()
gboolean | na_boxed_get_boolean ()
gconstpointer | na_boxed_get_pointer ()
gchar * | na_boxed_get_string ()
GSList * | na_boxed_get_string_list ()
guint | na_boxed_get_uint ()
GList * | na_boxed_get_uint_list ()
void | na_boxed_get_as_value ()
void * | na_boxed_get_as_void ()
NABoxed * | na_boxed_new_from_string ()
void | na_boxed_set_from_boxed ()
void | na_boxed_set_from_string ()
void | na_boxed_set_from_value ()
void | na_boxed_set_from_void ()

## Types and Values

| NABoxed

## Object Hierarchy

        GObject
        ╰── NABoxed
            ╰── NADataBoxed

## Includes

    #include <caja-actions/na-boxed.h>

## Description

The NABoxed structure is a way of handling various types of data in an opaque structure.

## Functions

### NA_TYPE_BOXED

    #define NA_TYPE_BOXED                ( na_boxed_get_type())

### NA_BOXED()

    #define NA_BOXED( object )           ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_TYPE_BOXED, NABoxed ))

### NA_IS_BOXED()

    #define NA_IS_BOXED( object )        ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_TYPE_BOXED ))

### na_boxed_set_type ()

    void
    na_boxed_set_type (NABoxed *boxed,
                       guint type);

Set the type of the just-allocated `boxed` object.

#### Parameters

boxed | this NABoxed object. |
type | the required type as defined in na-data-types.h |

Since 3.1

### na_boxed_are_equal ()

    gboolean
    na_boxed_are_equal (const NABoxed *a,
                        const NABoxed *b);

#### Parameters

a | the first NABoxed object. |
b | the second NABoxed object. |

#### Returns

`TRUE` if `a` and `b` are equal, `FALSE` else.

Since 3.1

### na_boxed_copy ()

    NABoxed *
    na_boxed_copy (const NABoxed *boxed);

#### Parameters

boxed | the source NABoxed box. |

#### Returns

a copy of `boxed` , as a newly allocated NABoxed which should be `g_object_unref()` by the caller.

Since 3.1

### na_boxed_dump ()

    void
    na_boxed_dump (const NABoxed *boxed);

Dumps the `boxed` box.

#### Parameters

boxed | the NABoxed box to be dumped. |

Since 3.1

### na_boxed_get_boolean ()

    gboolean
    na_boxed_get_boolean (const NABoxed *boxed);

#### Parameters

boxed | the NABoxed structure. |

#### Returns

the boolean value if `boxed` is of `NA_DATA_TYPE_BOOLEAN` type, `FALSE` else.

Since 3.1

### na_boxed_get_pointer ()

    gconstpointer
    na_boxed_get_pointer (const NABoxed *boxed);

#### Parameters

boxed | the NABoxed structure. |

#### Returns

a const pointer to the data if `boxed` is of `NA_DATA_TYPE_POINTER` type, `NULL` else.

Since 3.1

### na_boxed_get_string ()

    gchar *
    na_boxed_get_string (const NABoxed *boxed);

#### Parameters

boxed | the NABoxed structure. |

#### Returns

a newly allocated string if `boxed` is of `NA_DATA_TYPE_STRING` type, which should be `g_free()` by the caller, `NULL` else.

Since 3.1

### na_boxed_get_string_list ()

    GSList *
    na_boxed_get_string_list (const NABoxed *boxed);

#### Parameters

boxed | the NABoxed structure. |

#### Returns

a newly allocated string list if `boxed` is of `NA_DATA_TYPE_STRING_LIST` type, which should be `na_core_utils_slist_free()` by the caller, `NULL` else.

Since 3.1

### na_boxed_get_uint ()

    guint
    na_boxed_get_uint (const NABoxed *boxed);

#### Parameters

boxed | the NABoxed structure. |

#### Returns

an unsigned integer if `boxed` is of `NA_DATA_TYPE_UINT` type, zero else.

Since 3.1

### na_boxed_get_uint_list ()

    GList *
    na_boxed_get_uint_list (const NABoxed *boxed);

#### Parameters

boxed | the NABoxed structure. |

#### Returns

a newly allocated list if `boxed` is of `NA_DATA_TYPE_UINT_LIST` type, which should be `g_list_free()` by the caller, `FALSE` else.

Since 3.1

### na_boxed_get_as_value ()

    void
    na_boxed_get_as_value (const NABoxed *boxed,
                           GValue *value);

Setup `value` with the content of the `boxed` .

#### Parameters

boxed | the NABoxed whose value is to be got. |
value | the GValue which holds the string to be set. |

Since 3.1

### na_boxed_get_as_void ()

    void *
    na_boxed_get_as_void (const NABoxed *boxed);

#### Parameters

boxed | the NABoxed whose value is to be got. |

#### Returns

the content of the `boxed` .

If of type NA_DATA_TYPE_STRING (resp. NA_DATA_TYPE_LOCALE_STRING, NA_DATA_TYPE_STRING_LIST or NA_DATA_TYPE_UINT_LIST), then the content is returned in a newly allocated value, which should be `g_free()` (resp. `g_free()`, `na_core_utils_slist_free()`, `g_list_free()`) by the caller.

Since 3.1

### na_boxed_new_from_string ()

    NABoxed *
    na_boxed_new_from_string (guint type,
                              const gchar *string);

Allocates a new NABoxed of the specified `type` , and initializes it with `string` .

If the type is a list, then the last separator is automatically stripped.

#### Parameters

type | the type of the NABoxed to be allocated. |
string | the initial value of the NABoxed as a string. |

#### Returns

a newly allocated NABoxed, which should be `g_object_unref()` by the caller, or `NULL` if the type is unknowned, or does not provide the 'from_string' function.

Since 3.1

### na_boxed_set_from_boxed ()

    void
    na_boxed_set_from_boxed (NABoxed *boxed,
                             const NABoxed *value);

Copy value from `value` to `boxed` .

#### Parameters

boxed | the NABoxed whose value is to be set. |
value | the source NABoxed. |

Since 3.1

### na_boxed_set_from_string ()

    void
    na_boxed_set_from_string (NABoxed *boxed,
                              const gchar *value);

Evaluates the `value` and set it to the `boxed` .

#### Parameters

boxed | the NABoxed whose value is to be set. |
value | the string to be set. |

Since 3.1

### na_boxed_set_from_value ()

    void
    na_boxed_set_from_value (NABoxed *boxed,
                             const GValue *value);

Evaluates the `value` and set it to the `boxed` .

#### Parameters

boxed | the NABoxed whose value is to be set. |
value | the value whose content is to be got. |

Since 3.1

### na_boxed_set_from_void ()

    void
    na_boxed_set_from_void (NABoxed *boxed,
                            const void *value);

Evaluates the `value` and set it to the `boxed` .

#### Parameters

boxed | the NABoxed whose value is to be set. |
value | the value whose content is to be got. |

Since 3.1

## Types and Values

### NABoxed

    typedef struct _NABoxed NABoxed;