XMMS2
Functions
Condition

Functions to create and use S4 search conditions. More...

Functions

s4_condition_ts4_cond_new_combiner (s4_combine_type_t type)
 Creates a new combiner. More...
 
s4_condition_ts4_cond_new_custom_combiner (combine_function_t func)
 Creates a new combiner with a user specified combiner function. More...
 
void s4_cond_add_operand (s4_condition_t *cond, s4_condition_t *operand)
 Adds and references an operand to a combiner condition. More...
 
s4_condition_ts4_cond_get_operand (s4_condition_t *cond, int operand)
 Gets an operand from a combiner condition. More...
 
s4_condition_ts4_cond_new_filter (s4_filter_type_t type, const char *key, const s4_val_t *value, s4_sourcepref_t *sourcepref, s4_cmp_mode_t cmp_mode, int flags)
 Creates a new filter condition. More...
 
s4_condition_ts4_cond_new_custom_filter (filter_function_t func, void *userdata, free_func_t free, const char *key, s4_sourcepref_t *sourcepref, s4_cmp_mode_t cmp_mode, int monotonic, int flags)
 Creates a new filter condition with a user specified filter function. More...
 
int s4_cond_is_filter (s4_condition_t *cond)
 Checks if this condition is a filter condition. More...
 
int s4_cond_is_combiner (s4_condition_t *cond)
 Checks if this condition is a combiner condition. More...
 
s4_filter_type_t s4_cond_get_filter_type (s4_condition_t *cond)
 
s4_combine_type_t s4_cond_get_combiner_type (s4_condition_t *cond)
 
int s4_cond_get_flags (s4_condition_t *cond)
 Gets the flags for a condition. More...
 
const char * s4_cond_get_key (s4_condition_t *cond)
 Gets the key for a condition. More...
 
s4_sourcepref_ts4_cond_get_sourcepref (s4_condition_t *cond)
 Gets the source preference that should be used. More...
 
void * s4_cond_get_funcdata (s4_condition_t *cond)
 Returns the data that should be fed to the filter function. More...
 
void s4_cond_free (s4_condition_t *cond)
 Frees a condition and operands recursively. More...
 
s4_condition_ts4_cond_ref (s4_condition_t *cond)
 Increments the reference count of a condition. More...
 
void s4_cond_unref (s4_condition_t *cond)
 Decrements the reference count of a condition. More...
 
filter_function_t s4_cond_get_filter_function (s4_condition_t *cond)
 Gets the filter function for the condition. More...
 
combine_function_t s4_cond_get_combine_function (s4_condition_t *cond)
 Gets the combine function for the condition. More...
 
int s4_cond_is_monotonic (s4_condition_t *cond)
 Checks if the condition is a monotonic filter. More...
 
int s4_cond_get_cmp_mode (s4_condition_t *cond)
 Gets the comparison mode used by the filter condition. More...
 
void s4_cond_update_key (s4_condition_t *cond, s4_t *s4)
 Change the key with a constant key for faster checking. More...
 

Detailed Description

Functions to create and use S4 search conditions.

Function Documentation

void s4_cond_add_operand ( s4_condition_t cond,
s4_condition_t operand 
)

Adds and references an operand to a combiner condition.

Parameters
condThe condition to add to
operandThe operand to add

Referenced by CASE().

void s4_cond_free ( s4_condition_t cond)

Frees a condition and operands recursively.

Parameters
condThe condition to free

Referenced by CASE(), s4_cond_unref(), xmms_medialib_query_recurs(), and xmms_medialib_session_property_set().

int s4_cond_get_cmp_mode ( s4_condition_t cond)

Gets the comparison mode used by the filter condition.

Parameters
condThe condition to check
Returns
The comparison mode used
combine_function_t s4_cond_get_combine_function ( s4_condition_t cond)

Gets the combine function for the condition.

This function does not check if the condition is actually a combine condition, if it's called on a condition that is not a combiner it will return bogus data

Parameters
condThe condition to get the combine function of
Returns
The combine function
s4_combine_type_t s4_cond_get_combiner_type ( s4_condition_t cond)

Referenced by print_cond().

filter_function_t s4_cond_get_filter_function ( s4_condition_t cond)

Gets the filter function for the condition.

This function does not check if the condition is actually a filter condition, if it is called on a condition that is not a filter it will return bogus data

Parameters
condThe condition to get the filter function of
Returns
The filter function

Referenced by _s4_query(), and CASE().

s4_filter_type_t s4_cond_get_filter_type ( s4_condition_t cond)

Referenced by print_cond().

int s4_cond_get_flags ( s4_condition_t cond)

Gets the flags for a condition.

Parameters
condThe condition to get the flags of
Returns
The flags

Referenced by _s4_query().

void* s4_cond_get_funcdata ( s4_condition_t cond)

Returns the data that should be fed to the filter function.

Parameters
condThe condition to get the function data of
Returns
The function data

Referenced by print_cond().

const char* s4_cond_get_key ( s4_condition_t cond)

Gets the key for a condition.

Parameters
condThe condition to get the key of
Returns
The key

Referenced by _s4_query(), and print_cond().

s4_condition_t* s4_cond_get_operand ( s4_condition_t cond,
int  operand 
)

Gets an operand from a combiner condition.

Parameters
condThe condition to get the operand from
operandThe index of the operand to get
Returns
The operand, or NULL if the index is out of bounds or cond is not a combiner condition. The reference is still held by cond, so you must not call s4_cond_unref on the returned condition.

Referenced by print_cond().

s4_sourcepref_t* s4_cond_get_sourcepref ( s4_condition_t cond)

Gets the source preference that should be used.

Parameters
condThe condition to get the source preference of
Returns
The source preference
int s4_cond_is_combiner ( s4_condition_t cond)

Checks if this condition is a combiner condition.

Parameters
condThe condition to check
Returns
non-zero if the condition is a combiner, 0 otherwise
int s4_cond_is_filter ( s4_condition_t cond)

Checks if this condition is a filter condition.

Parameters
condThe condition to check
Returns
non-zero if the condition is a filter, 0 otherwise

Referenced by _s4_query(), and print_cond().

int s4_cond_is_monotonic ( s4_condition_t cond)

Checks if the condition is a monotonic filter.

A monotonic filter is a filter that preserves the order, and it can thus be used to search in an index.

Parameters
condThe condition to check
Returns
non-zero if the condition is monotonic, 0 otherwise

Referenced by _s4_query().

s4_condition_t* s4_cond_new_combiner ( s4_combine_type_t  type)

Creates a new combiner.

Parameters
typeThe combiner type
Returns
A new combiner
s4_condition_t* s4_cond_new_custom_combiner ( combine_function_t  func)

Creates a new combiner with a user specified combiner function.

Parameters
funcThe combiner function to use
Returns
A new custom combiner

Referenced by CASE().

s4_condition_t* s4_cond_new_custom_filter ( filter_function_t  func,
void *  userdata,
free_func_t  free,
const char *  key,
s4_sourcepref_t sourcepref,
s4_cmp_mode_t  cmp_mode,
int  monotonic,
int  flags 
)

Creates a new filter condition with a user specified filter function.

The filter function should return 0 if the value meets the condition, non-zero otherwise.

Parameters
funcThe filter function to use
userdataThe data that will be passed to the function along with the value to check
freeThe function that should be called to free userdata
keyThe key the condition should check
sourceprefThe source preference
cmp_modeThe comparison mode to use
flagsCondition flags, or 0
Returns
A new custom filter condition

Referenced by CASE().

s4_condition_t* s4_cond_new_filter ( s4_filter_type_t  type,
const char *  key,
const s4_val_t value,
s4_sourcepref_t sourcepref,
s4_cmp_mode_t  cmp_mode,
int  flags 
)

Creates a new filter condition.

Parameters
typeThe type of the filter
keyThe key the condition should check
valueThe value to check against
sourceprefThe source preference
cmp_modeThe comparison mode to use
flagsCondition flags, or 0
Returns
A new filter condition

Referenced by CASE(), and xmms_medialib_session_property_set().

s4_condition_t* s4_cond_ref ( s4_condition_t cond)

Increments the reference count of a condition.

Parameters
condThe condition to reference
Returns
The condition given

Referenced by s4_cond_add_operand().

void s4_cond_unref ( s4_condition_t cond)

Decrements the reference count of a condition.

If the reference count is 0 after this, the condition is freed.

Parameters
condThe condition to decrement the count of

Referenced by CASE(), s4_cond_new_combiner(), and s4_cond_new_custom_combiner().

void s4_cond_update_key ( s4_condition_t cond,
s4_t s4 
)

Change the key with a constant key for faster checking.

Parameters
s4The database to optimize for
condThe condition to update

Referenced by _s4_query().