circbuffer.h

00001 /*
00002  * @file circbuffer.h Buffer Utility Functions
00003  * @ingroup core
00004  *
00005  * Purple is the legal property of its developers, whose names are too numerous
00006  * to list here.  Please refer to the COPYRIGHT file distributed with this
00007  * source distribution.
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  */
00023 #ifndef _CIRCBUFFER_H
00024 #define _CIRCBUFFER_H
00025 
00026 #include <glib.h>
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 typedef struct _PurpleCircBuffer {
00033 
00035     gchar *buffer;
00036 
00039     gsize growsize;
00040 
00042     gsize buflen;
00043 
00045     gsize bufused;
00046 
00049     gchar *inptr;
00050 
00053     gchar *outptr;
00054 
00055 } PurpleCircBuffer;
00056 
00068 PurpleCircBuffer *purple_circ_buffer_new(gsize growsize);
00069 
00076 void purple_circ_buffer_destroy(PurpleCircBuffer *buf);
00077 
00086 void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize len);
00087 
00100 gsize purple_circ_buffer_get_max_read(const PurpleCircBuffer *buf);
00101 
00111 gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len);
00112 
00113 #ifdef __cplusplus
00114 }
00115 #endif
00116 
00117 #endif /* _CIRCBUFFER_H */