GnuCash
2.6.99
|
Files | |
file | gnc-glib-utils.h |
GLib helper routines. | |
Character Sets | |
int | safe_utf8_collate (const char *str1, const char *str2) |
gboolean | gnc_utf8_validate (const gchar *str, gssize max_len, const gchar **end) |
Validates UTF-8 encoded text for use in GnuCash. More... | |
void | gnc_utf8_strip_invalid (gchar *str) |
gchar * | gnc_utf8_strip_invalid_strdup (const gchar *str) |
gchar * | gnc_locale_from_utf8 (const gchar *str) |
Converts a string from UTF-8 to the encoding used for strings in the current locale. More... | |
gchar * | gnc_locale_to_utf8 (const gchar *str) |
Converts a string to UTF-8 from the encoding used for strings in the current locale. More... | |
GList Manipulation | |
typedef gpointer(* | GncGMapFunc )(gpointer data, gpointer user_data) |
GList * | gnc_g_list_map (GList *list, GncGMapFunc fn, gpointer user_data) |
void | gnc_g_list_cut (GList **list, GList *cut_point) |
Message Logging | |
void | gnc_scm_log_warn (const gchar *msg) |
void | gnc_scm_log_error (const gchar *msg) |
void | gnc_scm_log_msg (const gchar *msg) |
void | gnc_scm_log_debug (const gchar *msg) |
glib Miscellaneous Functions | |
void | gnc_gpid_kill (GPid pid) |
The API in this file is designed to provide support functions that wrap the base glib functions and make them easier to use.
void gnc_g_list_cut | ( | GList ** | list, |
GList * | cut_point | ||
) |
Cut a GList into two parts; the cut_point is the beginning of the new list; list may need to be modified, but will be the list before the cut_point.
Definition at line 259 of file gnc-glib-utils.c.
GList* gnc_g_list_map | ( | GList * | list, |
GncGMapFunc | fn, | ||
gpointer | user_data | ||
) |
Definition at line 248 of file gnc-glib-utils.c.
void gnc_gpid_kill | ( | GPid | pid | ) |
Kill a process. On UNIX send a SIGKILL, on Windows call TerminateProcess.
pid | The process ID. |
Definition at line 299 of file gnc-glib-utils.c.
gchar* gnc_locale_from_utf8 | ( | const gchar * | str | ) |
Converts a string from UTF-8 to the encoding used for strings in the current locale.
This essentially is a wrapper for g_locale_from_utf8 that can be swigified for use with Scheme to avoid adding a dependency for guile-glib.
str | A pointer to a UTF-8 encoded string to be converted. |
Definition at line 212 of file gnc-glib-utils.c.
gchar* gnc_locale_to_utf8 | ( | const gchar * | str | ) |
Converts a string to UTF-8 from the encoding used for strings in the current locale.
This essentially is a wrapper for g_locale_to_utf8 that can be swigified for use with Scheme to avoid adding a dependency for guile-glib.
str | A pointer to a string encoded according to locale. |
Definition at line 230 of file gnc-glib-utils.c.
void gnc_utf8_strip_invalid | ( | gchar * | str | ) |
Strip any non-UTF-8 characters from a string. This function rewrites the string "in place" instead of allocating and returning a new string. This allows it to operate on strings that are defined as character arrays in a larger data structure. Note that it also removes some subset of invalid XML characters, too. See http://www.w3.org/TR/REC-xml/#NT-Char linked from bug #346535
str | A pointer to the string to strip of invalid characters. |
Definition at line 184 of file gnc-glib-utils.c.
gchar* gnc_utf8_strip_invalid_strdup | ( | const gchar * | str | ) |
Returns a newly allocated copy of the given string but with any non-UTF-8 character stripped from it.
Note that it also removes some subset of invalid XML characters, too. See http://www.w3.org/TR/REC-xml/#NT-Char linked from bug #346535
str | A pointer to the string to be copied and stripped of non-UTF-8 characters. |
Definition at line 204 of file gnc-glib-utils.c.
gboolean gnc_utf8_validate | ( | const gchar * | str, |
gssize | max_len, | ||
const gchar ** | end | ||
) |
Validates UTF-8 encoded text for use in GnuCash.
Validates the strict subset of UTF-8 that is valid XML text, as detailed in http://www.w3.org/TR/REC-xml/#NT-Char linked from bug #346535.
Copied from g_utf8_validate():
Validates UTF-8 encoded text, where str is the text to validate; if str is nul-terminated, then max_len can be -1, otherwise max_len should be the number of bytes to validate. If end is non-NULL, then the end of the valid range will be stored there (i.e. the start of the first invalid character if some bytes were invalid, or the end of the text being validated otherwise).
Returns TRUE if all of str was valid. Many GLib and GTK+ routines require valid UTF-8 as input; so data read from a file or the network should be checked with g_utf8_validate() before doing anything else with it.
str | a pointer to character data |
max_len | max bytes to validate, or -1 to go until NUL |
end | return location for end of valid data |
Definition at line 123 of file gnc-glib-utils.c.
int safe_utf8_collate | ( | const char * | str1, |
const char * | str2 | ||
) |
Collate two UTF-8 strings. This function performs basic argument checking before calling g_utf8_collate.
str1 | The first string. |
str2 | The first string. |
Definition at line 37 of file gnc-glib-utils.c.