Fri, 04 Apr 2014 21:09:16 +0200
Remote smileys: correctly handle failed smileys
|
19050
78ed2f8cd58d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
1 | /* TODO: Can we just replace this whole thing with a GCache */ |
|
78ed2f8cd58d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
2 | |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
3 | /* purple |
| 7763 | 4 | * |
| 15884 | 5 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 7 | * source distribution. | |
| 7763 | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | |
| 10 | * it under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, | |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | * GNU General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 20 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19050
diff
changeset
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7763 | 22 | * |
| 23 | */ | |
|
35487
494f09f7f331
Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents:
35444
diff
changeset
|
24 | |
|
494f09f7f331
Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents:
35444
diff
changeset
|
25 | #ifndef _PURPLE_STRINGREF_H_ |
|
494f09f7f331
Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents:
35444
diff
changeset
|
26 | #define _PURPLE_STRINGREF_H_ |
|
35442
84e906df98dd
Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35403
diff
changeset
|
27 | /** |
|
84e906df98dd
Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35403
diff
changeset
|
28 | * SECTION:stringref |
|
84e906df98dd
Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35403
diff
changeset
|
29 | * @section_id: libpurple-stringref |
|
84e906df98dd
Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35403
diff
changeset
|
30 | * @short_description: <filename>stringref.h</filename> |
| 35444 | 31 | * @title: Reference-counted Immutable Strings |
|
35442
84e906df98dd
Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35403
diff
changeset
|
32 | */ |
|
84e906df98dd
Add section blocks for purple-socket.h to xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35403
diff
changeset
|
33 | |
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20147
diff
changeset
|
34 | typedef struct _PurpleStringref PurpleStringref; |
|
14988
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14254
diff
changeset
|
35 | |
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20147
diff
changeset
|
36 | G_BEGIN_DECLS |
| 7763 | 37 | |
| 38 | /** | |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
39 | * purple_stringref_new: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
40 | * @value: This will be the value of the string; it will be |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
41 | * duplicated. |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
42 | * |
| 7763 | 43 | * Creates an immutable reference-counted string object. The newly |
| 44 | * created object will have a reference count of 1. | |
| 45 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
46 | * Returns: A newly allocated string reference object with a refcount |
| 7767 | 47 | * of 1. |
| 7763 | 48 | */ |
| 15884 | 49 | PurpleStringref *purple_stringref_new(const char *value); |
| 7763 | 50 | |
| 51 | /** | |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
52 | * purple_stringref_new_noref: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
53 | * @value: This will be the value of the string; it will be |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
54 | * duplicated. |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
55 | * |
| 7786 | 56 | * Creates an immutable reference-counted string object. The newly |
| 57 | * created object will have a reference count of zero, and if it is | |
| 58 | * not referenced before the next iteration of the mainloop it will | |
| 59 | * be freed at that time. | |
| 60 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
61 | * Returns: A newly allocated string reference object with a refcount |
| 7786 | 62 | * of zero. |
| 63 | */ | |
| 15884 | 64 | PurpleStringref *purple_stringref_new_noref(const char *value); |
| 7786 | 65 | |
| 66 | /** | |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
67 | * purple_stringref_printf: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
68 | * @format: A printf-style format specification. |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
69 | * |
| 7767 | 70 | * Creates an immutable reference-counted string object from a printf |
| 71 | * format specification and arguments. The created object will have a | |
| 72 | * reference count of 1. | |
| 73 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
74 | * Returns: A newly allocated string reference object with a refcount |
| 7767 | 75 | * of 1. |
| 76 | */ | |
| 15884 | 77 | PurpleStringref *purple_stringref_printf(const char *format, ...); |
| 7767 | 78 | |
| 79 | /** | |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
80 | * purple_stringref_ref: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
81 | * @stringref: String to be referenced. |
| 7763 | 82 | * |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
83 | * Increase the reference count of the given stringref. |
| 7763 | 84 | * |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
85 | * Returns: A pointer to the referenced string. |
| 7763 | 86 | */ |
| 15884 | 87 | PurpleStringref *purple_stringref_ref(PurpleStringref *stringref); |
| 7763 | 88 | |
| 89 | /** | |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
90 | * purple_stringref_unref: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
91 | * @stringref: String to be dereferenced. |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
92 | * |
| 7763 | 93 | * Decrease the reference count of the given stringref. If this |
| 94 | * reference count reaches zero, the stringref will be freed; thus | |
| 95 | * you MUST NOT use this string after dereferencing it. | |
| 96 | */ | |
| 15884 | 97 | void purple_stringref_unref(PurpleStringref *stringref); |
| 7763 | 98 | |
| 99 | /** | |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
100 | * purple_stringref_value: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
101 | * @stringref: String reference from which to retrieve the value. |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
102 | * |
| 7763 | 103 | * Retrieve the value of a stringref. |
| 104 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
105 | * Note: This value should not be cached or stored in a local variable. |
| 7763 | 106 | * While there is nothing inherently incorrect about doing so, it |
| 107 | * is easy to forget that the cached value is in fact a | |
| 108 | * reference-counted object and accidentally use it after | |
| 109 | * dereferencing. This is more problematic for a reference- | |
| 110 | * counted object than a heap-allocated object, as it may seem to | |
| 111 | * be valid or invalid nondeterministically based on how many | |
| 112 | * other references to it exist. | |
| 113 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
114 | * Returns: The contents of the string reference. |
| 7763 | 115 | */ |
| 15884 | 116 | const char *purple_stringref_value(const PurpleStringref *stringref); |
| 7763 | 117 | |
| 7786 | 118 | /** |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
119 | * purple_stringref_cmp: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
120 | * @s1: The reference string. |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
121 | * @s2: The string to compare against the reference. |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
122 | * |
| 7786 | 123 | * Compare two stringrefs for string equality. This returns the same |
| 124 | * value as strcmp would, where <0 indicates that s1 is "less than" s2 | |
| 125 | * in the ASCII lexicography, 0 indicates equality, etc. | |
| 126 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
127 | * Returns: An ordering indication on s1 and s2. |
| 7786 | 128 | */ |
| 15884 | 129 | int purple_stringref_cmp(const PurpleStringref *s1, const PurpleStringref *s2); |
| 7786 | 130 | |
| 131 | /** | |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
132 | * purple_stringref_len: |
|
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
133 | * @stringref: The string in whose length we are interested. |
| 7786 | 134 | * |
|
35403
9282701d7aa9
Convert docs from doxygen to gtk-doc format for sound-theme-loader to xmlnode
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
135 | * Find the length of the string inside a stringref. |
| 7786 | 136 | * |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
137 | * Returns: The length of the string in stringref |
| 7786 | 138 | */ |
| 15884 | 139 | size_t purple_stringref_len(const PurpleStringref *stringref); |
| 7786 | 140 | |
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20147
diff
changeset
|
141 | G_END_DECLS |
|
14988
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14254
diff
changeset
|
142 | |
| 15884 | 143 | #endif /* _PURPLE_STRINGREF_H_ */ |