GnuCash c935c2f+
Loading...
Searching...
No Matches
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
43extern "C" {
44#endif
45
60int safe_utf8_collate (const char *str1, const char *str2);
61
88gboolean gnc_utf8_validate(const gchar *str, gssize max_len, const gchar **end);
89
99void gnc_utf8_strip_invalid (gchar *str);
100
113gchar *gnc_utf8_strip_invalid_strdup (const gchar* str);
114
122
135gchar *gnc_locale_from_utf8(const gchar* str);
136
149gchar *gnc_locale_to_utf8(const gchar* str);
150
156typedef gpointer (*GncGMapFunc)(gpointer data, gpointer user_data);
157
161GList* gnc_g_list_map(GList* list, GncGMapFunc fn, gpointer user_data);
162
168void gnc_g_list_cut(GList **list, GList *cut_point);
169
186gchar * gnc_g_list_stringjoin (GList *list_of_strings, const gchar *sep);
198gchar * gnc_g_list_stringjoin_nodups (GList *list_of_strings, const gchar *sep);
199
212gint gnc_list_length_cmp (const GList *list, size_t len);
213
214
215#ifdef __cplusplus
216} /* extern "C" */
217#endif
218
219#endif /* GNC_GLIB_UTILS_H */
gchar * gnc_g_list_stringjoin_nodups(GList *list_of_strings, const gchar *sep)
Like stringjoin but ensures that the string to be added isn't already part of the return string.
gboolean gnc_utf8_validate(const gchar *str, gssize max_len, const gchar **end)
Validates UTF-8 encoded text for use in GnuCash.
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.
gchar * gnc_g_list_stringjoin(GList *list_of_strings, const gchar *sep)
Return a string joining a GList whose elements are gchar* strings.
void gnc_utf8_strip_invalid(gchar *str)
Strip any non-UTF-8 characters from a string.
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...
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, , \f,...
GList * gnc_g_list_map(GList *list, GncGMapFunc fn, gpointer user_data)
gchar * gnc_locale_to_utf8(const gchar *str)
Converts a string to UTF-8 from the encoding used for strings in the current locale.
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...
gchar * gnc_locale_from_utf8(const gchar *str)
Converts a string from UTF-8 to the encoding used for strings in the current locale.