GnuCash  5.6-150-g038405b370+
gnc-glib-utils.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gnc-glib-utils.c -- utility functions based on glib functions *
3  * Copyright (C) 2006 David Hampton <hampton@employees.org> *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License*
16  * along with this program; if not, contact: *
17  * *
18  * Free Software Foundation Voice: +1-617-542-5942 *
19  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20  * Boston, MA 02110-1301, USA gnu@gnu.org *
21  * *
22 \********************************************************************/
23 
37 #ifndef GNC_GLIB_UTILS_H
38 #define GNC_GLIB_UTILS_H
39 
40 #include <glib.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
60 int safe_utf8_collate (const char *str1, const char *str2);
61 
88 gboolean gnc_utf8_validate(const gchar *str, gssize max_len, const gchar **end);
89 
99 void gnc_utf8_strip_invalid (gchar *str);
100 
113 gchar *gnc_utf8_strip_invalid_strdup (const gchar* str);
114 
121 void gnc_utf8_strip_invalid_and_controls (gchar* str);
122 
135 gchar *gnc_locale_from_utf8(const gchar* str);
136 
149 gchar *gnc_locale_to_utf8(const gchar* str);
150 
156 typedef gpointer (*GncGMapFunc)(gpointer data, gpointer user_data);
157 
161 GList* gnc_g_list_map(GList* list, GncGMapFunc fn, gpointer user_data);
162 
168 void gnc_g_list_cut(GList **list, GList *cut_point);
169 
186 gchar * gnc_g_list_stringjoin (GList *list_of_strings, const gchar *sep);
199 gint gnc_list_length_cmp (const GList *list, size_t len);
200 
201 
202 #ifdef __cplusplus
203 } /* extern "C" */
204 #endif
205 
206 #endif /* GNC_GLIB_UTILS_H */
207 
GList * gnc_g_list_map(GList *list, GncGMapFunc fn, gpointer user_data)
gchar * gnc_g_list_stringjoin(GList *list_of_strings, const gchar *sep)
Return a string joining a GList whose elements are gchar* strings.
int safe_utf8_collate(const char *str1, const char *str2)
Collate two UTF-8 strings.
void gnc_utf8_strip_invalid_and_controls(gchar *str)
Strip any non-utf8 characters and any control characters (everything < 0x20, , , ...
gchar * gnc_locale_from_utf8(const gchar *str)
Converts a string from UTF-8 to the encoding used for strings in the current locale.
gboolean gnc_utf8_validate(const gchar *str, gssize max_len, const gchar **end)
Validates UTF-8 encoded text for use in GnuCash.
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 modif...
void gnc_utf8_strip_invalid(gchar *str)
Strip any non-UTF-8 characters from a string.
gchar * gnc_locale_to_utf8(const gchar *str)
Converts a string to UTF-8 from the encoding used for strings in the current locale.
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...
gint gnc_list_length_cmp(const GList *list, size_t len)
Scans the GList elements the minimum number of iterations required to test it against a specified siz...