2 * Copyright (C) 2010 Collabora Ltd.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Xavier Claessens <xclaesse@gmail.com>
21 #ifndef __TPAW_STRING_PARSER_H__
22 #define __TPAW_STRING_PARSER_H__
28 typedef struct _TpawStringParser TpawStringParser;
30 typedef void (*TpawStringReplace) (const gchar *text,
34 typedef void (*TpawStringMatch) (const gchar *text,
36 TpawStringReplace replace_func,
37 TpawStringParser *sub_parsers,
40 struct _TpawStringParser {
41 TpawStringMatch match_func;
42 TpawStringReplace replace_func;
46 tpaw_string_parser_substr (const gchar *text,
48 TpawStringParser *parsers,
52 tpaw_string_match_link (const gchar *text,
54 TpawStringReplace replace_func,
55 TpawStringParser *sub_parsers,
59 tpaw_string_match_all (const gchar *text,
61 TpawStringReplace replace_func,
62 TpawStringParser *sub_parsers,
65 /* Replace functions assume user_data is a GString */
67 tpaw_string_replace_link (const gchar *text,
73 tpaw_string_replace_escaped (const gchar *text,
78 /* Returns a new string with <a> html tag around links, and escape the rest.
79 * To be used with gtk_label_set_markup() for example */
81 tpaw_add_link_markup (const gchar *text);
85 #endif /* __TPAW_STRING_PARSER_H__ */