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 __EMPATHY_STRING_PARSER_H__
22 #define __EMPATHY_STRING_PARSER_H__
28 typedef struct _EmpathyStringParser EmpathyStringParser
;
30 typedef void (*EmpathyStringReplace
) (const gchar
*text
,
34 typedef void (*EmpathyStringMatch
) (const gchar
*text
,
36 EmpathyStringReplace replace_func
,
37 EmpathyStringParser
*sub_parsers
,
40 struct _EmpathyStringParser
{
41 EmpathyStringMatch match_func
;
42 EmpathyStringReplace replace_func
;
46 empathy_string_parser_substr (const gchar
*text
,
48 EmpathyStringParser
*parsers
,
52 empathy_string_match_link (const gchar
*text
,
54 EmpathyStringReplace replace_func
,
55 EmpathyStringParser
*sub_parsers
,
59 empathy_string_match_smiley (const gchar
*text
,
61 EmpathyStringReplace replace_func
,
62 EmpathyStringParser
*sub_parsers
,
66 empathy_string_match_all (const gchar
*text
,
68 EmpathyStringReplace replace_func
,
69 EmpathyStringParser
*sub_parsers
,
72 /* Replace functions assume user_data is a GString */
74 empathy_string_replace_link (const gchar
*text
,
80 empathy_string_replace_escaped (const gchar
*text
,
85 /* Returns a new string with <a> html tag around links, and escape the rest.
86 * To be used with gtk_label_set_markup() for example */
88 empathy_add_link_markup (const gchar
*text
);
92 #endif /* __EMPATHY_STRING_PARSER_H__ */