circbuffer.h

Go to the documentation of this file.
00001 
00006 /* Purple is the legal property of its developers, whose names are too numerous
00007  * to list here.  Please refer to the COPYRIGHT file distributed with this
00008  * source distribution.
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00023  */
00024 #ifndef _CIRCBUFFER_H
00025 #define _CIRCBUFFER_H
00026 
00027 #include <glib.h>
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 typedef struct _PurpleCircBuffer {
00034 
00036     gchar *buffer;
00037 
00040     gsize growsize;
00041 
00043     gsize buflen;
00044 
00046     gsize bufused;
00047 
00050     gchar *inptr;
00051 
00054     gchar *outptr;
00055 
00056 } PurpleCircBuffer;
00057 
00069 PurpleCircBuffer *purple_circ_buffer_new(gsize growsize);
00070 
00077 void purple_circ_buffer_destroy(PurpleCircBuffer *buf);
00078 
00087 void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize len);
00088 
00101 gsize purple_circ_buffer_get_max_read(const PurpleCircBuffer *buf);
00102 
00112 gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len);
00113 
00114 #ifdef __cplusplus
00115 }
00116 #endif
00117 
00118 #endif /* _CIRCBUFFER_H */