XMMS2
Functions
Value

The way values are represented in S4. More...

Functions

s4_val_ts4_val_new_string (const char *str)
 Creates a new string value. More...
 
s4_val_ts4_val_new_int (int32_t i)
 Creates a new integer value. More...
 
s4_val_ts4_val_copy (const s4_val_t *val)
 Copies a value. More...
 
void s4_val_free (s4_val_t *val)
 Frees a value. More...
 
int s4_val_is_str (const s4_val_t *val)
 Checks is a value is a string value. More...
 
int s4_val_is_int (const s4_val_t *val)
 Checks is a value is an integer value. More...
 
int s4_val_get_str (const s4_val_t *val, const char **str)
 Tries to get the string in a string value. More...
 
int s4_val_get_collated_str (const s4_val_t *val, const char **str)
 Tries to get the normalized string in a string value. More...
 
int s4_val_get_casefolded_str (const s4_val_t *val, const char **str)
 Tries to get the normalized string in a string value. More...
 
int s4_val_get_int (const s4_val_t *val, int32_t *i)
 Tries to get the integer in an integer value. More...
 
int s4_val_cmp (const s4_val_t *v1, const s4_val_t *v2, s4_cmp_mode_t mode)
 Compares two values. More...
 
s4_val_ts4_val_new_internal_string (const char *str, s4_t *s4)
 Creates a new internal string value. More...
 

Detailed Description

The way values are represented in S4.

Function Documentation

int s4_val_cmp ( const s4_val_t v1,
const s4_val_t v2,
s4_cmp_mode_t  mode 
)

Compares two values.

Parameters
v1The first value
v2The second value
modeHow to compare the values
Returns
<0 if v1<v2, 0 if v1==v2 and >0 if v1>v2

Referenced by CASE().

s4_val_t* s4_val_copy ( const s4_val_t val)

Copies a value.

Parameters
valThe value to copy
Returns
A new value that's a copy of val, must be freed with s4_val_free

Referenced by CASE().

void s4_val_free ( s4_val_t val)
int s4_val_get_casefolded_str ( const s4_val_t val,
const char **  str 
)

Tries to get the normalized string in a string value.

Parameters
valThe value to get the string of
strA pointer to a pointer where the string pointer will be stored
Returns
0 if val is not a string value, non-zero otherwise

Referenced by CASE(), s4_pattern_match(), and s4_val_cmp().

int s4_val_get_collated_str ( const s4_val_t val,
const char **  str 
)

Tries to get the normalized string in a string value.

Parameters
valThe value to get the string of
strA pointer to a pointer where the string pointer will be stored
Returns
0 if val is not a string value, non-zero otherwise

Referenced by s4_val_cmp().

int s4_val_get_int ( const s4_val_t val,
int32_t *  i 
)

Tries to get the integer in an integer value.

Parameters
valThe value to get the integer of
iA pointer to an integer where the integer will be stored
Returns
0 if val is not an integer value, non-zero otherwise

Referenced by _const_lookup(), CASE(), s4_pattern_match(), s4_val_cmp(), s4_val_copy(), value_to_string(), xmms_medialib_entry_not_resolved_get(), xmms_medialib_entry_property_get_int(), and xmms_medialib_entry_property_get_value().

int s4_val_get_str ( const s4_val_t val,
const char **  str 
)

Tries to get the string in a string value.

Parameters
valThe value to get the string of
strA pointer to a pointer where the string pointer will be stored
Returns
0 if val is not a string value, non-zero otherwise

Referenced by _const_lookup(), _string_lookup(), CASE(), s4_pattern_match(), s4_val_cmp(), s4_val_copy(), value_to_string(), xmms_medialib_entry_property_get_str(), and xmms_medialib_entry_property_get_value().

int s4_val_is_int ( const s4_val_t val)

Checks is a value is an integer value.

Parameters
valThe value to check
Returns
non-zero if val is an integer value, 0 otherwise

Referenced by s4_val_get_int().

int s4_val_is_str ( const s4_val_t val)

Checks is a value is a string value.

Parameters
valThe value to check
Returns
non-zero if val is a string value, 0 otherwise

Referenced by s4_pattern_match(), s4_val_get_casefolded_str(), s4_val_get_collated_str(), and s4_val_get_str().

s4_val_t* s4_val_new_int ( int32_t  i)

Creates a new integer value.

Parameters
iThe integer to use as the value
Returns
A new integer value, must be freed with s4_val_free

Referenced by _int_lookup_val(), CASE(), main(), s4_val_copy(), SETUP(), xmms_medialib_entry_cleanup(), xmms_medialib_entry_property_set_int_source(), xmms_medialib_entry_remove(), xmms_medialib_session_property_set(), and xmms_medialib_session_property_unset().

s4_val_t* s4_val_new_internal_string ( const char *  str,
s4_t s4 
)

Creates a new internal string value.

Internal string values are different from normal string values in that the string is not copied.

Parameters
strThe string to use as the value
s4The database this value belongs to
Returns
A new internal string value, must be freed with s4_val_free

Referenced by _string_lookup_val().

s4_val_t* s4_val_new_string ( const char *  str)

Creates a new string value.

Parameters
strThe string to use as the value
Returns
A new string value, must be freed with s4_val_free

Referenced by CASE(), s4_val_copy(), and xmms_medialib_entry_property_set_str_source().