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