libpurple/circularbuffer.h

Mon, 18 Oct 2021 01:36:58 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 18 Oct 2021 01:36:58 -0500
changeset 41105
02c3569bc32b
parent 40524
a3b1cde8d2d8
child 41200
92a47aa620cf
permissions
-rw-r--r--

Add gi-docgen as a subproject so we can convert the documentation to it

Testing Done:
Just compiled and verified that our `.wrap` file didn't get overwritten by a `wrap-file` from gplugin.

Reviewed at https://reviews.imfreedom.org/r/1055/

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
1 /* Purple is the legal property of its developers, whose names are too numerous
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
2 * to list here. Please refer to the COPYRIGHT file distributed with this
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
3 * source distribution.
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
4 *
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
8 * (at your option) any later version.
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
9 *
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
13 * GNU General Public License for more details.
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
14 *
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
16 * 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: 15884
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
18 */
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35436
diff changeset
19
40474
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 39978
diff changeset
20 #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: 39978
diff changeset
21 # 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: 39978
diff changeset
22 #endif
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 39978
diff changeset
23
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35436
diff changeset
24 #ifndef PURPLE_CIRCULAR_BUFFER_H
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35436
diff changeset
25 #define PURPLE_CIRCULAR_BUFFER_H
35433
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
26 /**
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
27 * SECTION:circularbuffer
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
28 * @section_id: libpurple-circularbuffer
35436
a69d2e5604c5 Swap @title and @short_description roles
Ankit Vani <a@nevitus.org>
parents: 35433
diff changeset
29 * @short_description: <filename>circularbuffer.h</filename>
a69d2e5604c5 Swap @title and @short_description roles
Ankit Vani <a@nevitus.org>
parents: 35433
diff changeset
30 * @title: Buffer Utility Functions
35433
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
31 */
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
32
14013
86dac5633bd9 [gaim-migrate @ 16496]
Mark Doliner <markdoliner@pidgin.im>
parents: 13233
diff changeset
33 #include <glib.h>
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
34 #include <glib-object.h>
13230
44b216532ea2 [gaim-migrate @ 15594]
Mark Doliner <markdoliner@pidgin.im>
parents: 13213
diff changeset
35
39661
c8f98b167882 Change some libpurple object to GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39380
diff changeset
36 G_BEGIN_DECLS
13230
44b216532ea2 [gaim-migrate @ 15594]
Mark Doliner <markdoliner@pidgin.im>
parents: 13213
diff changeset
37
40524
a3b1cde8d2d8 Add documentation for all PURPLE_TYPE_ functions as well as PURPLE_TUNE_ constants
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
38 /**
a3b1cde8d2d8 Add documentation for all PURPLE_TYPE_ functions as well as PURPLE_TUNE_ constants
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
39 * PURPLE_TYPE_CIRCULAR_BUFFER:
a3b1cde8d2d8 Add documentation for all PURPLE_TYPE_ functions as well as PURPLE_TUNE_ constants
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
40 *
a3b1cde8d2d8 Add documentation for all PURPLE_TYPE_ functions as well as PURPLE_TUNE_ constants
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
41 * The standard _get_type macro for #PurpleCircularBuffer.
a3b1cde8d2d8 Add documentation for all PURPLE_TYPE_ functions as well as PURPLE_TUNE_ constants
Gary Kramlich <grim@reaperworld.com>
parents: 40474
diff changeset
42 */
39661
c8f98b167882 Change some libpurple object to GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39380
diff changeset
43 #define PURPLE_TYPE_CIRCULAR_BUFFER (purple_circular_buffer_get_type())
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
44
39661
c8f98b167882 Change some libpurple object to GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39380
diff changeset
45 G_DECLARE_DERIVABLE_TYPE(PurpleCircularBuffer, purple_circular_buffer, PURPLE,
c8f98b167882 Change some libpurple object to GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39380
diff changeset
46 CIRCULAR_BUFFER, GObject)
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
47
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
48 struct _PurpleCircularBufferClass {
34691
3acdd397a9c1 Removed reserved fields from instance structs.
Ankit Vani <a@nevitus.org>
parents: 34570
diff changeset
49 /*< private >*/
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
50 GObjectClass parent;
13230
44b216532ea2 [gaim-migrate @ 15594]
Mark Doliner <markdoliner@pidgin.im>
parents: 13213
diff changeset
51
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
52 void (*grow)(PurpleCircularBuffer *buffer, gsize len);
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
53 void (*append)(PurpleCircularBuffer *buffer, gconstpointer src, gsize len);
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38715
diff changeset
54 gsize (*max_read_size)(PurpleCircularBuffer *buffer);
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
55 gboolean (*mark_read)(PurpleCircularBuffer *buffer, gsize len);
13230
44b216532ea2 [gaim-migrate @ 15594]
Mark Doliner <markdoliner@pidgin.im>
parents: 13213
diff changeset
56
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
57 void (*purple_reserved1)(void);
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
58 void (*purple_reserved2)(void);
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
59 void (*purple_reserved3)(void);
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
60 void (*purple_reserved4)(void);
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
61 };
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
62
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
63 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
64 * purple_circular_buffer_new:
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
65 * @growsize: The amount that the buffer should grow the first time data
13213
8dcf2385a862 [gaim-migrate @ 15576]
Mark Doliner <markdoliner@pidgin.im>
parents: 13201
diff changeset
66 * is appended and every time more space is needed. Pass in
8dcf2385a862 [gaim-migrate @ 15576]
Mark Doliner <markdoliner@pidgin.im>
parents: 13201
diff changeset
67 * "0" to use the default of 256 bytes.
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
68 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
69 * Creates a new circular buffer. This will not allocate any memory for the
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
70 * actual buffer until data is appended to it.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
71 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
72 * Returns: The new PurpleCircularBuffer.
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
73 */
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
74 PurpleCircularBuffer *purple_circular_buffer_new(gsize growsize);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
75
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
76 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
77 * purple_circular_buffer_append:
38715
98d5a19c04a9 Fix inconsistent parameter names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37094
diff changeset
78 * @buffer: The PurpleCircularBuffer to which to append the data
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
79 * @src: pointer to the data to copy into the buffer
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
80 * @len: number of bytes to copy into the buffer
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
81 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
82 * Append data to the PurpleCircularBuffer. This will grow the internal
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
83 * buffer to fit the added data, if needed.
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
84 */
38715
98d5a19c04a9 Fix inconsistent parameter names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37094
diff changeset
85 void purple_circular_buffer_append(PurpleCircularBuffer *buffer, gconstpointer src, gsize len);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
86
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
87 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
88 * purple_circular_buffer_get_max_read:
38715
98d5a19c04a9 Fix inconsistent parameter names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37094
diff changeset
89 * @buffer: the PurpleCircularBuffer for which to determine the maximum
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
90 * contiguous bytes that can be read.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
91 *
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
92 * Determine the maximum number of contiguous bytes that can be read from the
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
93 * PurpleCircularBuffer.
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
94 * Note: This may not be the total number of bytes that are buffered - a
35057
312f92e61d21 Fixed some doc comments
Ankit Vani <a@nevitus.org>
parents: 34691
diff changeset
95 * subsequent call after calling purple_circular_buffer_mark_read() may indicate
312f92e61d21 Fixed some doc comments
Ankit Vani <a@nevitus.org>
parents: 34691
diff changeset
96 * more data is available to read.
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
97 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
98 * Returns: the number of bytes that can be read from the PurpleCircularBuffer
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
99 */
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38715
diff changeset
100 gsize purple_circular_buffer_get_max_read(PurpleCircularBuffer *buffer);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
101
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
102 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
103 * purple_circular_buffer_mark_read:
38715
98d5a19c04a9 Fix inconsistent parameter names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37094
diff changeset
104 * @buffer: The PurpleCircularBuffer to mark bytes read from
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
105 * @len: The number of bytes to mark as read
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
106 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
107 * Mark the number of bytes that have been read from the buffer.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
108 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
109 * Returns: TRUE if we successfully marked the bytes as having been read, FALSE
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
110 * otherwise.
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
111 */
38715
98d5a19c04a9 Fix inconsistent parameter names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37094
diff changeset
112 gboolean purple_circular_buffer_mark_read(PurpleCircularBuffer *buffer, gsize len);
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
113
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
114 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
115 * purple_circular_buffer_grow:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
116 * @buffer: The PurpleCircularBuffer to grow.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
117 * @len: The number of bytes the buffer should be able to hold.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
118 *
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
119 * Increases the buffer size by a multiple of grow size, so that it can hold at
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
120 * least 'len' bytes.
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
121 */
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
122 void purple_circular_buffer_grow(PurpleCircularBuffer *buffer, gsize len);
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
123
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
124 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
125 * purple_circular_buffer_get_grow_size:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
126 * @buffer: The PurpleCircularBuffer from which to get grow size.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
127 *
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
128 * Returns the number of bytes by which the buffer grows when more space is
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
129 * needed.
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
130 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
131 * Returns: The grow size of the buffer.
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
132 */
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38715
diff changeset
133 gsize purple_circular_buffer_get_grow_size(PurpleCircularBuffer *buffer);
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
134
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
135 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
136 * purple_circular_buffer_get_used:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
137 * @buffer: The PurpleCircularBuffer from which to get used count.
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
138 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
139 * Returns the number of bytes of this buffer that contain unread data.
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
140 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
141 * Returns: The number of bytes that contain unread data.
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
142 */
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38715
diff changeset
143 gsize purple_circular_buffer_get_used(PurpleCircularBuffer *buffer);
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
144
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
145 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
146 * purple_circular_buffer_get_output:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
147 * @buffer: The PurpleCircularBuffer from which to get the output pointer.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
148 *
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
149 * Returns the output pointer of the buffer, where unread data is available.
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
150 * Use purple_circular_buffer_get_max_read() to determine the number of
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
151 * contiguous bytes that can be read from this output. After reading the data,
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
152 * call purple_circular_buffer_mark_read() to mark the retrieved data as read.
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
153 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 35071
diff changeset
154 * Returns: The output pointer for the buffer.
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
155 */
39380
3088866c22f4 libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38715
diff changeset
156 const gchar *purple_circular_buffer_get_output(PurpleCircularBuffer *buffer);
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
157
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
158 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
159 * purple_circular_buffer_reset:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
160 * @buffer: The PurpleCircularBuffer to reset.
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
161 *
39975
f691f3812205 Add some unit tests for the circular buffer.. they're not great, was just trying to test somethings
Gary Kramlich <grim@reaperworld.com>
parents: 39380
diff changeset
162 * Resets the buffer input and output pointers to the start of the buffer.
35071
1eedcfcb91ef Added doc comments for new PurpleCircularBuffer functions. Removed purple_circular_buffer_get_input from public API.
Ankit Vani <a@nevitus.org>
parents: 35057
diff changeset
163 */
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
164 void purple_circular_buffer_reset(PurpleCircularBuffer *buffer);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
165
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20147
diff changeset
166 G_END_DECLS
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
167
34529
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
168 #endif /* PURPLE_CIRCULAR_BUFFER_H */
68cf25486001 GObjectify PurpleCircBuffer as PurpleCircularBuffer (from gobjectification branch)
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
169

mercurial