libpurple/circularbuffer.h

branch
gtkdoc-conversion
changeset 35393
00f876b129bc
parent 35071
1eedcfcb91ef
child 35397
31fa3a1aeff5
child 37023
d9bcdc9a91e6
equal deleted inserted replaced
35392:cc123f0d84af 35393:00f876b129bc
63 63
64 /** 64 /**
65 * Creates a new circular buffer. This will not allocate any memory for the 65 * Creates a new circular buffer. This will not allocate any memory for the
66 * actual buffer until data is appended to it. 66 * actual buffer until data is appended to it.
67 * 67 *
68 * @param growsize The amount that the buffer should grow the first time data 68 * @growsize: The amount that the buffer should grow the first time data
69 * is appended and every time more space is needed. Pass in 69 * is appended and every time more space is needed. Pass in
70 * "0" to use the default of 256 bytes. 70 * "0" to use the default of 256 bytes.
71 * 71 *
72 * @return The new PurpleCircularBuffer. 72 * Returns: The new PurpleCircularBuffer.
73 */ 73 */
74 PurpleCircularBuffer *purple_circular_buffer_new(gsize growsize); 74 PurpleCircularBuffer *purple_circular_buffer_new(gsize growsize);
75 75
76 /** 76 /**
77 * Append data to the PurpleCircularBuffer. This will grow the internal 77 * Append data to the PurpleCircularBuffer. This will grow the internal
78 * buffer to fit the added data, if needed. 78 * buffer to fit the added data, if needed.
79 * 79 *
80 * @param buf The PurpleCircularBuffer to which to append the data 80 * @buf: The PurpleCircularBuffer to which to append the data
81 * @param src pointer to the data to copy into the buffer 81 * @src: pointer to the data to copy into the buffer
82 * @param len number of bytes to copy into the buffer 82 * @len: number of bytes to copy into the buffer
83 */ 83 */
84 void purple_circular_buffer_append(PurpleCircularBuffer *buf, gconstpointer src, gsize len); 84 void purple_circular_buffer_append(PurpleCircularBuffer *buf, gconstpointer src, gsize len);
85 85
86 /** 86 /**
87 * Determine the maximum number of contiguous bytes that can be read from the 87 * Determine the maximum number of contiguous bytes that can be read from the
88 * PurpleCircularBuffer. 88 * PurpleCircularBuffer.
89 * Note: This may not be the total number of bytes that are buffered - a 89 * Note: This may not be the total number of bytes that are buffered - a
90 * subsequent call after calling purple_circular_buffer_mark_read() may indicate 90 * subsequent call after calling purple_circular_buffer_mark_read() may indicate
91 * more data is available to read. 91 * more data is available to read.
92 * 92 *
93 * @param buf the PurpleCircularBuffer for which to determine the maximum 93 * @buf: the PurpleCircularBuffer for which to determine the maximum
94 * contiguous bytes that can be read. 94 * contiguous bytes that can be read.
95 * 95 *
96 * @return the number of bytes that can be read from the PurpleCircularBuffer 96 * Returns: the number of bytes that can be read from the PurpleCircularBuffer
97 */ 97 */
98 gsize purple_circular_buffer_get_max_read(const PurpleCircularBuffer *buf); 98 gsize purple_circular_buffer_get_max_read(const PurpleCircularBuffer *buf);
99 99
100 /** 100 /**
101 * Mark the number of bytes that have been read from the buffer. 101 * Mark the number of bytes that have been read from the buffer.
102 * 102 *
103 * @param buf The PurpleCircularBuffer to mark bytes read from 103 * @buf: The PurpleCircularBuffer to mark bytes read from
104 * @param len The number of bytes to mark as read 104 * @len: The number of bytes to mark as read
105 * 105 *
106 * @return TRUE if we successfully marked the bytes as having been read, FALSE 106 * Returns: TRUE if we successfully marked the bytes as having been read, FALSE
107 * otherwise. 107 * otherwise.
108 */ 108 */
109 gboolean purple_circular_buffer_mark_read(PurpleCircularBuffer *buf, gsize len); 109 gboolean purple_circular_buffer_mark_read(PurpleCircularBuffer *buf, gsize len);
110 110
111 /** 111 /**
112 * Increases the buffer size by a multiple of grow size, so that it can hold at 112 * Increases the buffer size by a multiple of grow size, so that it can hold at
113 * least 'len' bytes. 113 * least 'len' bytes.
114 * 114 *
115 * @param buffer The PurpleCircularBuffer to grow. 115 * @buffer: The PurpleCircularBuffer to grow.
116 * @param len The number of bytes the buffer should be able to hold. 116 * @len: The number of bytes the buffer should be able to hold.
117 */ 117 */
118 void purple_circular_buffer_grow(PurpleCircularBuffer *buffer, gsize len); 118 void purple_circular_buffer_grow(PurpleCircularBuffer *buffer, gsize len);
119 119
120 /** 120 /**
121 * Returns the number of bytes by which the buffer grows when more space is 121 * Returns the number of bytes by which the buffer grows when more space is
122 * needed. 122 * needed.
123 * 123 *
124 * @param buffer The PurpleCircularBuffer from which to get grow size. 124 * @buffer: The PurpleCircularBuffer from which to get grow size.
125 * 125 *
126 * @return The grow size of the buffer. 126 * Returns: The grow size of the buffer.
127 */ 127 */
128 gsize purple_circular_buffer_get_grow_size(const PurpleCircularBuffer *buffer); 128 gsize purple_circular_buffer_get_grow_size(const PurpleCircularBuffer *buffer);
129 129
130 /** 130 /**
131 * Returns the number of bytes of this buffer that contain unread data. 131 * Returns the number of bytes of this buffer that contain unread data.
132 * 132 *
133 * @param buffer The PurpleCircularBuffer from which to get used count. 133 * @buffer: The PurpleCircularBuffer from which to get used count.
134 * 134 *
135 * @return The number of bytes that contain unread data. 135 * Returns: The number of bytes that contain unread data.
136 */ 136 */
137 gsize purple_circular_buffer_get_used(const PurpleCircularBuffer *buffer); 137 gsize purple_circular_buffer_get_used(const PurpleCircularBuffer *buffer);
138 138
139 /** 139 /**
140 * Returns the output pointer of the buffer, where unread data is available. 140 * Returns the output pointer of the buffer, where unread data is available.
141 * Use purple_circular_buffer_get_max_read() to determine the number of 141 * Use purple_circular_buffer_get_max_read() to determine the number of
142 * contiguous bytes that can be read from this output. After reading the data, 142 * contiguous bytes that can be read from this output. After reading the data,
143 * call purple_circular_buffer_mark_read() to mark the retrieved data as read. 143 * call purple_circular_buffer_mark_read() to mark the retrieved data as read.
144 * 144 *
145 * @param buffer The PurpleCircularBuffer from which to get the output pointer. 145 * @buffer: The PurpleCircularBuffer from which to get the output pointer.
146 * 146 *
147 * @return The output pointer for the buffer. 147 * Returns: The output pointer for the buffer.
148 */ 148 */
149 const gchar *purple_circular_buffer_get_output(const PurpleCircularBuffer *buffer); 149 const gchar *purple_circular_buffer_get_output(const PurpleCircularBuffer *buffer);
150 150
151 /** 151 /**
152 * Resets the buffer contents. 152 * Resets the buffer contents.
153 * 153 *
154 * @param buffer The PurpleCircularBuffer to reset. 154 * @buffer: The PurpleCircularBuffer to reset.
155 */ 155 */
156 void purple_circular_buffer_reset(PurpleCircularBuffer *buffer); 156 void purple_circular_buffer_reset(PurpleCircularBuffer *buffer);
157 157
158 G_END_DECLS 158 G_END_DECLS
159 159

mercurial