audstrings.h File Reference

#include <stdlib.h>
#include <glib.h>

Go to the source code of this file.

Functions

G_BEGIN_DECLS gchar * escape_shell_chars (const gchar *string)
 Escapes characters that are special to the shell inside double quotes.
gchar * str_append (gchar *str, const gchar *add_str)
gchar * str_replace (gchar *str, gchar *new_str)
void str_replace_in (gchar **str, gchar *new_str)
gboolean str_has_prefix_nocase (const gchar *str, const gchar *prefix)
gboolean str_has_suffix_nocase (const gchar *str, const gchar *suffix)
gboolean str_has_suffixes_nocase (const gchar *str, gchar *const *suffixes)
gchar * str_assert_utf8 (const gchar *str)
 This function can be used to assert that a given string is valid UTF-8.
gchar * str_to_utf8_fallback (const gchar *str)
const gchar * str_skip_chars (const gchar *str, const gchar *chars)
gchar * convert_dos_path (gchar *text)
gchar *(*) chardet_to_utf8 (const gchar *str, gssize len, gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error)
gchar * filename_get_subtune (const gchar *filename, gint *track)
 Checks if given URI contains a subtune indicator/number.
gchar * filename_split_subtune (const gchar *filename, gint *track)
 Given file path/URI contains ending indicating subtune number "?<number>", splits the string into filename without subtune value.
void string_replace_char (gchar *string, gchar old_str, gchar new_str)
void string_decode_percent (gchar *string)
gchar * string_encode_percent (const gchar *string, gboolean is_filename)
gboolean uri_is_utf8 (const gchar *uri, gboolean warn)
gchar * uri_to_utf8 (const gchar *uri)
void uri_check_utf8 (gchar **uri, gboolean warn)
gchar * filename_to_uri (const gchar *filename)
gchar * uri_to_filename (const gchar *uri)
void string_cut_extension (gchar *string)
gint string_compare (const gchar *a, const gchar *b)
gint string_compare_encoded (const gchar *a, const gchar *b)
const void * memfind (const void *mem, gint size, const void *token, gint length)

Variables

gchar *(* str_to_utf8 )(const gchar *str)
 Convert given string from nearly any encoding to UTF-8 encoding.
gchar *(* chardet_to_utf8 )(const gchar *string, gssize length, gsize *bytes_read, gsize *bytes_written, GError **error)

Function Documentation

gchar*(*) chardet_to_utf8 ( const gchar *  str,
gssize  len,
gsize *  arg_bytes_read,
gsize *  arg_bytes_write,
GError **  arg_error 
)
gchar* convert_dos_path ( gchar *  text  ) 

Definition at line 259 of file audstrings.c.

Referenced by construct_uri().

G_BEGIN_DECLS gchar* escape_shell_chars ( const gchar *  string  ) 

Escapes characters that are special to the shell inside double quotes.

Parameters:
string String to be escaped.
Returns:
Given string with special characters escaped. Must be freed with g_free().

Definition at line 45 of file audstrings.c.

gchar* filename_get_subtune ( const gchar *  filename,
gint track 
)

Checks if given URI contains a subtune indicator/number.

If it does, track is set to to it, and position of subtune separator in the URI string is returned.

Parameters:
filename Filename/URI to split.
track Pointer to variable where subtune number should be assigned or NULL if it is not needed.
Returns:
Position of subtune separator character in filename or NULL if none found. Notice that this value should NOT be modified, even though it is not declared const for technical reasons.

Definition at line 285 of file audstrings.c.

Referenced by filename_split_subtune().

gchar* filename_split_subtune ( const gchar *  filename,
gint track 
)

Given file path/URI contains ending indicating subtune number "?<number>", splits the string into filename without subtune value.

If given track pointer is non-NULL, subtune number is assigned into it.

Parameters:
filename Filename/URI to split.
track Pointer to variable where subtune number should be assigned or NULL if it is not needed.
Returns:
Newly allocated splitted filename without the subtune indicator. This string must be freed with g_free(). NULL will be returned if there was any failure.

Definition at line 316 of file audstrings.c.

Referenced by file_find_decoder().

gchar* filename_to_uri ( const gchar *  filename  ) 
const void* memfind ( const void *  mem,
gint  size,
const void *  token,
gint  length 
)

Definition at line 233 of file audstrings.c.

gchar* str_append ( gchar *  str,
const gchar *  add_str 
)

Definition at line 97 of file audstrings.c.

gchar* str_assert_utf8 ( const gchar *  str  ) 

This function can be used to assert that a given string is valid UTF-8.

If it is, a copy of the string is returned. However, if the string is NOT valid UTF-8, a warning and a callstack backtrace is printed in order to see where the problem occured.

This is a temporary measure for removing useless str_to_utf8 etc. calls and will be eventually removed. This function should be used in place of str_to_utf8() calls when it can be reasonably assumed that the input should already be in unicode encoding.

Parameters:
str String to be tested and converted to UTF-8 encoding.
Returns:
String in UTF-8 encoding, or NULL if conversion failed or input was NULL.

Definition at line 194 of file audstrings.c.

gboolean str_has_prefix_nocase ( const gchar *  str,
const gchar *  prefix 
)

Definition at line 116 of file audstrings.c.

gboolean str_has_suffix_nocase ( const gchar *  str,
const gchar *  suffix 
)

Definition at line 122 of file audstrings.c.

Referenced by scan_plugin_func(), and str_has_suffixes_nocase().

gboolean str_has_suffixes_nocase ( const gchar *  str,
gchar *const *  suffixes 
)

Definition at line 129 of file audstrings.c.

gchar* str_replace ( gchar *  str,
gchar *  new_str 
)

Definition at line 103 of file audstrings.c.

Referenced by str_append(), and str_replace_in().

void str_replace_in ( gchar **  str,
gchar *  new_str 
)

Definition at line 110 of file audstrings.c.

const gchar* str_skip_chars ( const gchar *  str,
const gchar *  chars 
)

Definition at line 226 of file audstrings.c.

gchar* str_to_utf8_fallback ( const gchar *  str  ) 

Definition at line 144 of file audstrings.c.

Referenced by cd_str_to_utf8().

gint string_compare ( const gchar *  a,
const gchar *  b 
)

Definition at line 529 of file audstrings.c.

Referenced by plugin_compare(), and tuple_compare_string().

gint string_compare_encoded ( const gchar *  a,
const gchar *  b 
)

Definition at line 573 of file audstrings.c.

Referenced by add_cb(), and filename_compare_basename().

void string_cut_extension ( gchar *  string  ) 

Definition at line 517 of file audstrings.c.

Referenced by tuple_formatter_make_title_string().

void string_decode_percent ( gchar *  string  ) 

Definition at line 370 of file audstrings.c.

Referenced by tuple_set_filename().

gchar* string_encode_percent ( const gchar *  string,
gboolean  is_filename 
)

Definition at line 393 of file audstrings.c.

Referenced by filename_to_uri().

void string_replace_char ( gchar *  string,
gchar  old_str,
gchar  new_str 
)

Definition at line 332 of file audstrings.c.

Referenced by convert_dos_path().

void uri_check_utf8 ( gchar **  uri,
gboolean  warn 
)

Definition at line 482 of file audstrings.c.

Referenced by make_entries().

gboolean uri_is_utf8 ( const gchar *  uri,
gboolean  warn 
)

Definition at line 430 of file audstrings.c.

Referenced by playlist_rescan_file(), and uri_check_utf8().

gchar* uri_to_filename ( const gchar *  uri  ) 
gchar* uri_to_utf8 ( const gchar *  uri  ) 

Definition at line 465 of file audstrings.c.

Referenced by playlist_rescan_file(), and uri_check_utf8().


Variable Documentation

gchar*(* chardet_to_utf8)(const gchar *str, gssize len, gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error) ( const gchar *  string,
gssize  length,
gsize *  bytes_read,
gsize *  bytes_written,
GError **  error 
)

Referenced by chardet_init().

gchar*(* str_to_utf8)(const gchar *str)

Convert given string from nearly any encoding to UTF-8 encoding.

Parameters:
str Local filename/path to convert.
Returns:
String in UTF-8 encoding. Must be freed with g_free().

Referenced by chardet_init(), str_assert_utf8(), tuple_associate_string(), and tuple_set_filename().


Generated on 8 Jun 2011 for Audacious by  doxygen 1.6.1