Audacious $Id:Doxyfile42802007-03-2104:39:00Znenolod$
|
Basic Tuple handling API. More...
#include <glib.h>
#include <mowgli.h>
#include "tuple.h"
#include "audstrings.h"
#include "stringpool.h"
Go to the source code of this file.
Defines | |
#define | TUPLE_LOCK_WRITE(X) g_static_rw_lock_writer_lock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures. | |
#define | TUPLE_UNLOCK_WRITE(X) g_static_rw_lock_writer_unlock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures. | |
#define | TUPLE_LOCK_READ(X) g_static_rw_lock_reader_lock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures. | |
#define | TUPLE_UNLOCK_READ(X) g_static_rw_lock_reader_unlock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures. | |
Functions | |
static void | tuple_value_destroy (mowgli_dictionary_elem_t *delem, gpointer privdata) |
static void | tuple_destroy (gpointer data) |
static Tuple * | tuple_new_unlocked (void) |
Tuple * | tuple_new (void) |
Allocates a new empty Tuple structure. | |
static TupleValue * | tuple_associate_data (Tuple *tuple, const gint cnfield, const gchar *field, TupleValueType ftype) |
(Re)associates data into given Tuple field. | |
void | tuple_set_filename (Tuple *tuple, const gchar *filename) |
Sets filename/URI related fields of a Tuple structure, based on the given filename argument. | |
static TupleValue * | tuple_copy_value (TupleValue *src) |
Creates a copy of given TupleValue structure, with copied data. | |
Tuple * | tuple_copy (const Tuple *src) |
Creates a copy of given Tuple structure, with copied data. | |
Tuple * | tuple_new_from_filename (const gchar *filename) |
Allocates a new Tuple structure, setting filename/URI related fields based on the given filename argument by calling tuple_set_filename. | |
static gint | tuple_get_nfield (const gchar *field) |
gboolean | tuple_associate_string (Tuple *tuple, const gint nfield, const gchar *field, const gchar *string) |
Associates copy of given string to a field in specified Tuple. | |
gboolean | tuple_associate_string_rel (Tuple *tuple, const gint nfield, const gchar *field, gchar *string) |
Associates given string to a field in specified Tuple. | |
gboolean | tuple_associate_int (Tuple *tuple, const gint nfield, const gchar *field, gint integer) |
Associates given integer to a field in specified Tuple. | |
void | tuple_disassociate (Tuple *tuple, const gint cnfield, const gchar *field) |
Disassociates given field from specified Tuple structure. | |
TupleValueType | tuple_get_value_type (const Tuple *tuple, gint cnfield, const gchar *field) |
Returns TupleValueType of given Tuple field. | |
const gchar * | tuple_get_string (const Tuple *tuple, gint cnfield, const gchar *field) |
Returns pointer to a string associated to Tuple field. | |
gint | tuple_get_int (const Tuple *tuple, gint cnfield, const gchar *field) |
Returns integer associated to Tuple field. | |
Variables | |
const TupleBasicType | tuple_fields [FIELD_LAST] |
Ordered table of basic Tuple field names and their TupleValueType. | |
static mowgli_heap_t * | tuple_heap = NULL |
A mowgli heap containing all the allocated tuples. | |
static mowgli_heap_t * | tuple_value_heap = NULL |
A mowgli heap containing values contained by tuples. | |
static mowgli_object_class_t | tuple_klass |
static GStaticRWLock | tuple_rwlock = G_STATIC_RW_LOCK_INIT |
Global R/W lock for preserve data consistency of heaps. |
#define TUPLE_LOCK_READ | ( | X | ) | g_static_rw_lock_reader_lock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures.
Definition at line 95 of file tuple.c.
Referenced by tuple_get_int(), tuple_get_string(), and tuple_get_value_type().
#define TUPLE_LOCK_WRITE | ( | X | ) | g_static_rw_lock_writer_lock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures.
Definition at line 93 of file tuple.c.
Referenced by tuple_associate_int(), tuple_associate_string(), tuple_copy(), tuple_destroy(), tuple_disassociate(), and tuple_new().
#define TUPLE_UNLOCK_READ | ( | X | ) | g_static_rw_lock_reader_unlock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures.
Definition at line 96 of file tuple.c.
Referenced by tuple_get_int(), tuple_get_string(), and tuple_get_value_type().
#define TUPLE_UNLOCK_WRITE | ( | X | ) | g_static_rw_lock_writer_unlock(&tuple_rwlock) |
Convenience macro for read/write locking of the globally used internal Tuple system structures.
Definition at line 94 of file tuple.c.
Referenced by tuple_associate_data(), tuple_associate_int(), tuple_associate_string(), tuple_copy(), tuple_destroy(), tuple_disassociate(), and tuple_new().
static TupleValue * tuple_associate_data | ( | Tuple * | tuple, |
const gint | cnfield, | ||
const gchar * | field, | ||
TupleValueType | ftype | ||
) | [static] |
(Re)associates data into given Tuple field.
If specified field already exists in the Tuple, any data from it is freed and this current TupleValue struct is returned.
If field does NOT exist, a new structure is allocated from global heap, added to Tuple and returned.
[in] | tuple | Tuple structure to be manipulated. |
[in] | cnfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
[in] | ftype | Type of the field to be associated. |
Definition at line 360 of file tuple.c.
Referenced by tuple_associate_int(), and tuple_associate_string().
gboolean tuple_associate_int | ( | Tuple * | tuple, |
const gint | nfield, | ||
const gchar * | field, | ||
gint | integer | ||
) |
Associates given integer to a field in specified Tuple.
If field already exists, old value is freed and replaced.
Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.
[in] | tuple | Tuple structure pointer. |
[in] | nfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
[in] | integer | Integer to be associated to given field in Tuple. |
Definition at line 486 of file tuple.c.
Referenced by tuple_set_filename().
gboolean tuple_associate_string | ( | Tuple * | tuple, |
const gint | nfield, | ||
const gchar * | field, | ||
const gchar * | string | ||
) |
Associates copy of given string to a field in specified Tuple.
If field already exists, old value is freed and replaced.
Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.
[in] | tuple | Tuple structure pointer. |
[in] | nfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
[in] | string | String to be associated to given field in Tuple. |
Definition at line 425 of file tuple.c.
Referenced by tuple_associate_string_rel(), and tuple_set_filename().
gboolean tuple_associate_string_rel | ( | Tuple * | tuple, |
const gint | nfield, | ||
const gchar * | field, | ||
gchar * | string | ||
) |
Associates given string to a field in specified Tuple.
The caller gives up ownership of the string. If field already exists, old value is freed and replaced.
Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.
[in] | tuple | Tuple structure pointer. |
[in] | nfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
[in] | string | String to be associated to given field in Tuple. |
static TupleValue* tuple_copy_value | ( | TupleValue * | src | ) | [static] |
Creates a copy of given TupleValue structure, with copied data.
[in] | src | TupleValue structure to be made a copy of. |
Definition at line 247 of file tuple.c.
Referenced by tuple_copy().
static void tuple_destroy | ( | gpointer | data | ) | [static] |
Definition at line 114 of file tuple.c.
Referenced by tuple_new_unlocked().
Disassociates given field from specified Tuple structure.
Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.
[in] | tuple | Tuple structure pointer. |
[in] | cnfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
Returns integer associated to Tuple field.
Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.
[in] | tuple | Tuple structure pointer. |
[in] | cnfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
Definition at line 634 of file tuple.c.
Referenced by entry_set_tuple_real(), read_gain_from_tuple(), tuple_compare_int(), tuple_formatter_expression_empty(), tuple_formatter_expression_match(), tuple_formatter_process_expr(), and tuple_value_to_gvalue().
static gint tuple_get_nfield | ( | const gchar * | field | ) | [static] |
Definition at line 331 of file tuple.c.
Referenced by tuple_associate_data(), tuple_disassociate(), tuple_get_int(), tuple_get_string(), and tuple_get_value_type().
Returns pointer to a string associated to Tuple field.
Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.
[in] | tuple | Tuple structure pointer. |
[in] | cnfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
Definition at line 592 of file tuple.c.
Referenced by playlist_select_by_patterns(), title_from_tuple(), tuple_compare_string(), tuple_formatter_expression_empty(), tuple_formatter_expression_match(), tuple_formatter_make_title_string(), tuple_formatter_process_expr(), and tuple_value_to_gvalue().
TupleValueType tuple_get_value_type | ( | const Tuple * | tuple, |
gint | cnfield, | ||
const gchar * | field | ||
) |
Returns TupleValueType of given Tuple field.
Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.
[in] | tuple | Tuple structure pointer. |
[in] | cnfield | TupleBasicType index or -1 if key name is to be used instead. |
[in] | field | String acting as key name or NULL if nfield is used. |
Definition at line 555 of file tuple.c.
Referenced by entry_set_tuple_real(), tuple_compare_int(), tuple_formatter_expression_empty(), tuple_formatter_expression_match(), tuple_formatter_process_expr(), and tuple_value_to_gvalue().
Tuple* tuple_new | ( | void | ) |
Allocates a new empty Tuple structure.
Must be freed via tuple_free().
Definition at line 169 of file tuple.c.
Referenced by tuple_new_from_filename().
Tuple* tuple_new_from_filename | ( | const gchar * | filename | ) |
Allocates a new Tuple structure, setting filename/URI related fields based on the given filename argument by calling tuple_set_filename.
[in] | filename | Filename URI. |
Definition at line 321 of file tuple.c.
Referenced by entry_set_failed().
static Tuple* tuple_new_unlocked | ( | void | ) | [static] |
Definition at line 141 of file tuple.c.
Referenced by tuple_copy(), and tuple_new().
void tuple_set_filename | ( | Tuple * | tuple, |
const gchar * | filename | ||
) |
Sets filename/URI related fields of a Tuple structure, based on the given filename argument.
The fields set are: FIELD_FILE_PATH, FIELD_FILE_NAME and FIELD_FILE_EXT.
[in] | filename | Filename URI. |
[in,out] | tuple | Tuple structure to manipulate. |
Definition at line 194 of file tuple.c.
Referenced by tuple_new_from_filename().
static void tuple_value_destroy | ( | mowgli_dictionary_elem_t * | delem, |
gpointer | privdata | ||
) | [static] |
Definition at line 101 of file tuple.c.
Referenced by tuple_destroy().
const TupleBasicType tuple_fields[FIELD_LAST] |
Ordered table of basic Tuple field names and their TupleValueType.
Definition at line 34 of file tuple.c.
Referenced by audacious_rc_get_tuple_fields(), and tuple_evalctx_add_var().
mowgli_heap_t* tuple_heap = NULL [static] |
A mowgli heap containing all the allocated tuples.
Definition at line 79 of file tuple.c.
Referenced by tuple_destroy(), and tuple_new_unlocked().
mowgli_object_class_t tuple_klass [static] |
Definition at line 83 of file tuple.c.
Referenced by tuple_new_unlocked().
GStaticRWLock tuple_rwlock = G_STATIC_RW_LOCK_INIT [static] |
mowgli_heap_t* tuple_value_heap = NULL [static] |
A mowgli heap containing values contained by tuples.
Definition at line 82 of file tuple.c.
Referenced by tuple_associate_data(), tuple_copy_value(), tuple_destroy(), tuple_disassociate(), tuple_new_unlocked(), and tuple_value_destroy().