Sun, 21 Jun 2020 04:16:15 -0500
Make it so only libpurple can directly include libpurple header files.
This is part of our on going effort to make it easier to develop against libpurple as well as making our filenames not part of our api.
Make it so only libpurple can directly include libpurple header files.
Testing Done:
Just a normal compile to make sure everything builds again.
Reviewed at https://reviews.imfreedom.org/r/8/
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
2 | * Purple |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
5 | * numerous to list here. Please refer to the COPYRIGHT file distributed |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
6 | * with this source distribution |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
7 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or (at |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
11 | * your option) any later version. |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
12 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, but |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
16 | * General Public License for more details. |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
17 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
21 | */ |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
22 | |
|
40474
1341be8e3402
Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents:
39544
diff
changeset
|
23 | #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION) |
|
1341be8e3402
Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents:
39544
diff
changeset
|
24 | # error "only <purple.h> may be included directly" |
|
1341be8e3402
Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents:
39544
diff
changeset
|
25 | #endif |
|
1341be8e3402
Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents:
39544
diff
changeset
|
26 | |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
27 | #ifndef PURPLE_TRIE_H |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
28 | #define PURPLE_TRIE_H |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
29 | /** |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
30 | * SECTION:trie |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
31 | * @include:trie.h |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
32 | * @section_id: libpurple-trie |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
33 | * @short_description: a structure for linear-time text searching |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
34 | * @title: Tries |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
35 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
36 | * A #PurpleTrie is a structure for quick searching of multiple phrases within |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
37 | * a text. It's intended for repeated searches of the same set of patterns |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
38 | * within multiple source texts (or a single, big one). |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
39 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
40 | * It's preparation time is <literal>O(p)</literal>, where <literal>p</literal> |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
41 | * is the total length of searched phrases. In current implementation, the |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
42 | * internal structure is invalidated after every modification of the |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
43 | * #PurpleTrie's contents, so it's not efficient to do alternating modifications |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
44 | * and searches. Search time does not depend on patterns being stored within |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
45 | * a trie and is always <literal>O(n)</literal>, where <literal>n</literal> is |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
46 | * the size of a text. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
47 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
48 | * Its main drawback is a significant memory usage - every internal trie node |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
49 | * needs about 1kB of memory on 32-bit machine and 2kB on 64-bit. Fortunately, |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
50 | * the trie grows slower when more words (with common prefixes) are added. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
51 | * We could avoid invalidating the whole tree when altering it, but it would |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
52 | * require figuring out, how to update <literal>longest_suffix</literal> fields |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
53 | * in satisfying time. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
54 | */ |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
55 | |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
56 | #include <glib-object.h> |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
57 | |
|
39544
8e488a91262f
Use G_DECLARE_FINAL_TYPE for PurpleTrie.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37401
diff
changeset
|
58 | #define PURPLE_TYPE_TRIE purple_trie_get_type() |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
59 | |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
60 | /** |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
61 | * PurpleTrieReplaceCb: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
62 | * @out: currently built output string, append replacement to it. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
63 | * @word: found word. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
64 | * @word_data: the user data bound with this word, when added with |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
65 | * #purple_trie_add. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
66 | * @user_data: the user supplied data passed when calling #purple_trie_replace. |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
67 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
68 | * A funtion called on every matching substring to be replaced. |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
69 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
70 | * If you decide to replace the word, append your text to @out and return %TRUE. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
71 | * Otherwise, you must not touch @out. In both cases, you must not do any |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
72 | * operations on @out other than appending text to it. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
73 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
74 | * Returns: %TRUE if the word was replaced, %FALSE otherwise. |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
75 | */ |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
76 | typedef gboolean (*PurpleTrieReplaceCb)(GString *out, const gchar *word, |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
77 | gpointer word_data, gpointer user_data); |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
78 | |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
79 | /** |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
80 | * PurpleTrieFindCb: |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
81 | * @word: found word. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
82 | * @word_data: the user data bound with this word, when added with |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
83 | * #purple_trie_add. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
84 | * @user_data: the user data passed when calling #purple_trie_find. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
85 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
86 | * A function called on every matching substring. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
87 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
88 | * You can decide to count the match or not (for the total number of found |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
89 | * words, that is returned by #purple_trie_find). In both cases you can |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
90 | * obviously do some processing outside the #PurpleTrie object. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
91 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
92 | * If you decide to count the word and #PurpleTrie:reset-on-match property |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
93 | * is set, no overlapping words will be found - the processing will skip after |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
94 | * the end of this word. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
95 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
96 | * Returns: %TRUE if the word should be counter, %FALSE otherwise. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
97 | */ |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
98 | typedef gboolean (*PurpleTrieFindCb)(const gchar *word, gpointer word_data, |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
99 | gpointer user_data); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
100 | |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
101 | G_BEGIN_DECLS |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
102 | |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
103 | /** |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
104 | * purple_trie_get_type: |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
105 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
106 | * Returns: the #GType for a #PurpleTrie. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
107 | */ |
|
39544
8e488a91262f
Use G_DECLARE_FINAL_TYPE for PurpleTrie.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37401
diff
changeset
|
108 | G_DECLARE_FINAL_TYPE(PurpleTrie, purple_trie, PURPLE, TRIE, GObject) |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
109 | |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
110 | /** |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
111 | * purple_trie_new: |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
112 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
113 | * Creates a new trie. |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
114 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
115 | * Returns: the new #PurpleTrie. |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
116 | */ |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
117 | PurpleTrie * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
118 | purple_trie_new(void); |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
119 | |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
120 | /** |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
121 | * purple_trie_get_reset_on_match: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
122 | * @trie: the trie. |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
123 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
124 | * Checks, if the trie will reset its internal state after every match. |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
125 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
126 | * Returns: %TRUE, if trie will reset, %FALSE otherwise. |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
127 | */ |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
128 | gboolean |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
129 | purple_trie_get_reset_on_match(PurpleTrie *trie); |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
130 | |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
131 | /** |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
132 | * purple_trie_set_reset_on_match: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
133 | * @trie: the trie. |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
134 | * @reset: %TRUE, if trie should reset, %FALSE otherwise. |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
135 | * |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
136 | * Enables or disables a feature of resetting trie's state after every match. |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
137 | * When enabled, it will not search for overlapping matches. |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
138 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
139 | * It's well defined for #purple_trie_find, but not for replace operations. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
140 | * Thus, for the latter, it's better to stay with this option enabled, because |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
141 | * its behavior may be changed in future. |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
142 | */ |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
143 | void |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
144 | purple_trie_set_reset_on_match(PurpleTrie *trie, gboolean reset); |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
145 | |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
146 | /** |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
147 | * purple_trie_add: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
148 | * @trie: the trie. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
149 | * @word: the word. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
150 | * @data: the word-related data (may be %NULL). |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
151 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
152 | * Adds a word to the trie. Current implementation doesn't allow for duplicates, |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
153 | * so please avoid adding those. |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
154 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
155 | * Please note, that altering a trie invalidates its internal structure, so by |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
156 | * the occasion of next search, it will be rebuilt. It's done in |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
157 | * <literal>O(n)</literal>, where n is the total length of strings |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
158 | * in #PurpleTrie. |
|
35700
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
159 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
160 | * Returns: %TRUE if succeeded, %FALSE otherwise. |
|
35700
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
161 | */ |
|
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
162 | gboolean |
|
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
163 | purple_trie_add(PurpleTrie *trie, const gchar *word, gpointer data); |
|
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
164 | |
|
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
165 | /** |
|
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
166 | * purple_trie_remove: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
167 | * @trie: the trie. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
168 | * @word: the word. |
|
35700
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
169 | * |
|
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
170 | * Removes a word from the trie. Depending on used memory pool, this may not |
|
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
171 | * free allocated memory (that will be freed when destroying the whole |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
172 | * collection), so use it wisely. See #purple_memory_pool_free. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
173 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
174 | * Please note, that altering a trie invalidates its internal structure. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
175 | * See #purple_trie_add. |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
176 | */ |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
177 | void |
|
35700
a032063e50c7
Trie: implement purple_trie_remove
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35665
diff
changeset
|
178 | purple_trie_remove(PurpleTrie *trie, const gchar *word); |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
179 | |
|
35766
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
180 | /** |
|
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
181 | * purple_trie_get_size: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
182 | * @trie: the trie. |
|
35766
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
183 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
184 | * Returns the number of elements contained in the #PurpleTrie. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
185 | * |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
186 | * Returns: the number of stored words in @trie. |
|
35766
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
187 | */ |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35700
diff
changeset
|
188 | guint |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35700
diff
changeset
|
189 | purple_trie_get_size(PurpleTrie *trie); |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35700
diff
changeset
|
190 | |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
191 | /** |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
192 | * purple_trie_replace: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
193 | * @trie: the trie. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
194 | * @src: the source string. |
|
37401
11138a33d498
Add GIntrospection Annotations to Trie documentation
Jorge Villaseñor <salinasv@pidgin.im>
parents:
35790
diff
changeset
|
195 | * @replace_cb: (scope call): the replacement function. |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
196 | * @user_data: custom data to be passed to @replace_cb. |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
197 | * |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
198 | * Processes @src string and replaces all occuriences of words added to @trie. |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
199 | * It's <literal>O(strlen(src))</literal>, if @replace_cb runs in |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
200 | * <literal>O(strlen(word))</literal> and #PurpleTrie:reset-on-match is set. |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
201 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
202 | * Returns: resulting string. Must be #g_free'd when you are done using it. |
|
35658
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
203 | */ |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
204 | gchar * |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
205 | purple_trie_replace(PurpleTrie *trie, const gchar *src, |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
206 | PurpleTrieReplaceCb replace_cb, gpointer user_data); |
|
799b62769bd3
Trie: implement search-and-replace (not yet tested)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35651
diff
changeset
|
207 | |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
208 | /** |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
209 | * purple_trie_multi_replace: |
|
37401
11138a33d498
Add GIntrospection Annotations to Trie documentation
Jorge Villaseñor <salinasv@pidgin.im>
parents:
35790
diff
changeset
|
210 | * @tries: (element-type PurpleTrie): the list of tries. |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
211 | * @src: the source string. |
|
37401
11138a33d498
Add GIntrospection Annotations to Trie documentation
Jorge Villaseñor <salinasv@pidgin.im>
parents:
35790
diff
changeset
|
212 | * @replace_cb: (scope call): the replacement function. |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
213 | * @user_data: custom data to be passed to @replace_cb. |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
214 | * |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
215 | * Processes @src and replaces all occuriences of words added to tries in list |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
216 | * @tries. Entries added to tries on the beginning of the list have higher |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
217 | * priority, than ones added further. |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
218 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
219 | * Different #GSList's can be combined to possess common parts, so you can create |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
220 | * a "tree of tries". |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
221 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
222 | * Returns: resulting string. Must be #g_free'd when you are done using it. |
|
35665
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
223 | */ |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
224 | gchar * |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
225 | purple_trie_multi_replace(const GSList *tries, const gchar *src, |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
226 | PurpleTrieReplaceCb replace_cb, gpointer user_data); |
|
f1310093e434
Implement and test multi-trie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35662
diff
changeset
|
227 | |
|
35766
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
228 | /** |
|
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
229 | * purple_trie_find: |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
230 | * @trie: the trie. |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
231 | * @src: the source string. |
|
37401
11138a33d498
Add GIntrospection Annotations to Trie documentation
Jorge Villaseñor <salinasv@pidgin.im>
parents:
35790
diff
changeset
|
232 | * @find_cb: (nullable) (scope call): the callback for the found entries (may be %NULL). |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
233 | * @user_data: custom data to be passed to @find_cb. |
|
35766
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
234 | * |
|
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
235 | * Processes @src string and finds all occuriences of words added to @trie. |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
236 | * It's <literal>O(strlen(src))</literal>, if find_cb runs |
|
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
237 | * in <literal>O(1)</literal>. |
|
35766
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
238 | * |
|
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
239 | * The word is counted as found if it's found and the callback returns %TRUE. |
|
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
240 | * |
|
35773
8c63d334ad44
Comments: PurpleTrie
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35766
diff
changeset
|
241 | * Returns: the number of found words. |
|
35766
f29bb25cfbd8
Smileys: fill comments for old files
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35756
diff
changeset
|
242 | */ |
|
35756
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
243 | gulong |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
244 | purple_trie_find(PurpleTrie *trie, const gchar *src, |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
245 | PurpleTrieFindCb find_cb, gpointer user_data); |
|
fe6aba70046e
Custom smileys: make it possible to find them by prpl
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
246 | |
|
35790
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
247 | /** |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
248 | * purple_trie_multi_find: |
|
37401
11138a33d498
Add GIntrospection Annotations to Trie documentation
Jorge Villaseñor <salinasv@pidgin.im>
parents:
35790
diff
changeset
|
249 | * @tries: (element-type PurpleTrie): the list of tries. |
|
35790
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
250 | * @src: the source string. |
|
37401
11138a33d498
Add GIntrospection Annotations to Trie documentation
Jorge Villaseñor <salinasv@pidgin.im>
parents:
35790
diff
changeset
|
251 | * @find_cb: (nullable) (scope call): the callback for the found entries (may be %NULL). |
|
35790
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
252 | * @user_data: custom data to be passed to @find_cb. |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
253 | * |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
254 | * Processes @src and replaces all occuriences of words added to tries in |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
255 | * list @tries. Entries added to tries on the beginning of the list have higher |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
256 | * priority, than ones added further. |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
257 | * |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
258 | * Different #GSList's can be combined to possess common parts, so you can create |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
259 | * a "tree of tries". |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
260 | * |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
261 | * Returns: the number of found words. |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
262 | */ |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
263 | gulong |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
264 | purple_trie_multi_find(const GSList *tries, const gchar *src, |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
265 | PurpleTrieFindCb find_cb, gpointer user_data); |
|
3118fb87573e
Trie: implement purple_trie_multi_find
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35773
diff
changeset
|
266 | |
|
35651
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
267 | G_END_DECLS |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
268 | |
|
95f34a3f4172
Initial trie class implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
diff
changeset
|
269 | #endif /* PURPLE_MEMORY_POOL_H */ |