Frameworks/libpurple.framework/Versions/0.5.6/Headers/circbuffer.h
branchadium-1.3
changeset 350 708bedafdc3a
parent 349 17ef128722b7
child 351 b01ab9b157f9
     1.1 --- a/Frameworks/libpurple.framework/Versions/0.5.6/Headers/circbuffer.h	Sun Jun 21 22:04:11 2009 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,118 +0,0 @@
     1.4 -/**
     1.5 - * @file circbuffer.h Buffer Utility Functions
     1.6 - * @ingroup core
     1.7 - */
     1.8 -
     1.9 -/* Purple is the legal property of its developers, whose names are too numerous
    1.10 - * to list here.  Please refer to the COPYRIGHT file distributed with this
    1.11 - * source distribution.
    1.12 - *
    1.13 - * This program is free software; you can redistribute it and/or modify
    1.14 - * it under the terms of the GNU General Public License as published by
    1.15 - * the Free Software Foundation; either version 2 of the License, or
    1.16 - * (at your option) any later version.
    1.17 - *
    1.18 - * This program is distributed in the hope that it will be useful,
    1.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.21 - * GNU General Public License for more details.
    1.22 - *
    1.23 - * You should have received a copy of the GNU General Public License
    1.24 - * along with this program; if not, write to the Free Software
    1.25 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    1.26 - */
    1.27 -#ifndef _CIRCBUFFER_H
    1.28 -#define _CIRCBUFFER_H
    1.29 -
    1.30 -#include <glib.h>
    1.31 -
    1.32 -#ifdef __cplusplus
    1.33 -extern "C" {
    1.34 -#endif
    1.35 -
    1.36 -typedef struct _PurpleCircBuffer {
    1.37 -
    1.38 -	/** A pointer to the starting address of our chunk of memory. */
    1.39 -	gchar *buffer;
    1.40 -
    1.41 -	/** The incremental amount to increase this buffer by when
    1.42 -	 *  the buffer is not big enough to hold incoming data, in bytes. */
    1.43 -	gsize growsize;
    1.44 -
    1.45 -	/** The length of this buffer, in bytes. */
    1.46 -	gsize buflen;
    1.47 -
    1.48 -	/** The number of bytes of this buffer that contain unread data. */
    1.49 -	gsize bufused;
    1.50 -
    1.51 -	/** A pointer to the next byte where new incoming data is
    1.52 -	 *  buffered to. */
    1.53 -	gchar *inptr;
    1.54 -
    1.55 -	/** A pointer to the next byte of buffered data that should be
    1.56 -	 *  read by the consumer. */
    1.57 -	gchar *outptr;
    1.58 -
    1.59 -} PurpleCircBuffer;
    1.60 -
    1.61 -/**
    1.62 - * Creates a new circular buffer.  This will not allocate any memory for the
    1.63 - * actual buffer until data is appended to it.
    1.64 - *
    1.65 - * @param growsize The amount that the buffer should grow the first time data
    1.66 - *                 is appended and every time more space is needed.  Pass in
    1.67 - *                 "0" to use the default of 256 bytes.
    1.68 - *
    1.69 - * @return The new PurpleCircBuffer. This should be freed with
    1.70 - *         purple_circ_buffer_destroy when you are done with it
    1.71 - */
    1.72 -PurpleCircBuffer *purple_circ_buffer_new(gsize growsize);
    1.73 -
    1.74 -/**
    1.75 - * Dispose of the PurpleCircBuffer and free any memory used by it (including any
    1.76 - * memory used by the internal buffer).
    1.77 - *
    1.78 - * @param buf The PurpleCircBuffer to free
    1.79 - */
    1.80 -void purple_circ_buffer_destroy(PurpleCircBuffer *buf);
    1.81 -
    1.82 -/**
    1.83 - * Append data to the PurpleCircBuffer.  This will grow the internal
    1.84 - * buffer to fit the added data, if needed.
    1.85 - *
    1.86 - * @param buf The PurpleCircBuffer to which to append the data
    1.87 - * @param src pointer to the data to copy into the buffer
    1.88 - * @param len number of bytes to copy into the buffer
    1.89 - */
    1.90 -void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize len);
    1.91 -
    1.92 -/**
    1.93 - * Determine the maximum number of contiguous bytes that can be read from the
    1.94 - * PurpleCircBuffer.
    1.95 - * Note: This may not be the total number of bytes that are buffered - a
    1.96 - * subsequent call after calling purple_circ_buffer_mark_read() may indicate more
    1.97 - * data is available to read.
    1.98 - *
    1.99 - * @param buf the PurpleCircBuffer for which to determine the maximum contiguous
   1.100 - *            bytes that can be read.
   1.101 - *
   1.102 - * @return the number of bytes that can be read from the PurpleCircBuffer
   1.103 - */
   1.104 -gsize purple_circ_buffer_get_max_read(const PurpleCircBuffer *buf);
   1.105 -
   1.106 -/**
   1.107 - * Mark the number of bytes that have been read from the buffer.
   1.108 - *
   1.109 - * @param buf The PurpleCircBuffer to mark bytes read from
   1.110 - * @param len The number of bytes to mark as read
   1.111 - *
   1.112 - * @return TRUE if we successfully marked the bytes as having been read, FALSE
   1.113 - *         otherwise.
   1.114 - */
   1.115 -gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len);
   1.116 -
   1.117 -#ifdef __cplusplus
   1.118 -}
   1.119 -#endif
   1.120 -
   1.121 -#endif /* _CIRCBUFFER_H */