00001 #ifndef SCBSTREAM_H_ 00002 #define SCBSTREAM_H_ 00003 00004 /* 00005 * File Name : scbstream.h 00006 * 00007 * Description: Scribble library stream definition 00008 */ 00009 00010 /* 00011 * This file is part of liberscribble. 00012 * 00013 * liberscribble is free software: you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation, either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * liberscribble is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 */ 00026 00027 /** 00028 * Copyright (C) 2008 iRex Technologies B.V. 00029 * All rights reserved. 00030 */ 00031 00032 00033 //---------------------------------------------------------------------------- 00034 // Include Files 00035 //---------------------------------------------------------------------------- 00036 00037 // system include files, between < > 00038 #include <glib.h> 00039 00040 // ereader include files, between < > 00041 00042 // local include files, between " " 00043 00044 G_BEGIN_DECLS 00045 00046 00047 //---------------------------------------------------------------------------- 00048 // Definitions 00049 //---------------------------------------------------------------------------- 00050 00051 00052 //---------------------------------------------------------------------------- 00053 // Forward Declarations 00054 //---------------------------------------------------------------------------- 00055 00056 00057 //---------------------------------------------------------------------------- 00058 // Type Declarations 00059 //---------------------------------------------------------------------------- 00060 00061 // scribble stream, it acts like the stl stream 00062 typedef struct _ScbStream 00063 { 00064 int offset; // offset of the operation pointer 00065 int size; // size of the stream 00066 void *buffer; // pointer to the buffer 00067 } ScbStream; 00068 00069 typedef ScbStream * ScbStreamPtr; 00070 00071 00072 //---------------------------------------------------------------------------- 00073 // Global Constants 00074 //---------------------------------------------------------------------------- 00075 00076 00077 //============================================================================ 00078 // Public Functions 00079 //============================================================================ 00080 00081 // create a scb stream 00082 ScbStreamPtr erscribble_create_stream(const int size); 00083 00084 // release a scb stream 00085 void erscribble_free_stream(ScbStreamPtr stream, gboolean is_free_buffer); 00086 00087 // read from the stream 00088 gboolean erscribble_read_stream(ScbStreamPtr stream, void *data, const int length); 00089 00090 // write to the stream 00091 gboolean erscribble_write_stream(ScbStreamPtr stream, const void *data, const int length); 00092 00093 // reset the offset 00094 void erscribble_reset_offset(ScbStreamPtr stream); 00095 00096 00097 G_END_DECLS 00098 00099 #endif