1 /* -*- Mode: C; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- */
2 
3 /*
4  * GImageView
5  * Copyright (C) 2001 Takuro Ashie
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  * $Id: gimv_io_mem.h,v 1.1 2003/06/18 09:26:56 makeinu Exp $
22  */
23 
24 #ifndef __GIMV_IO_MEM_H__
25 #define __GIMV_IO_MEM_H__
26 
27 #ifdef HAVE_CONFIG_H
28 #  include "config.h"
29 #endif
30 
31 #include <gimv_io.h>
32 
33 
34 #ifndef GIMV_IO_MEM_BUF_SIZE
35 #  define GIMV_IO_MEM_BUF_SIZE  4096
36 #endif
37 
38 #define GIMV_IO_MEM_BLOCK_SIZE  65536   /* 64kB/1block */
39 #define GIMV_IO_MEM_BLOCKS_STEP 64
40 
41 
42 typedef struct GimvIOMem_Tag GimvIOMem;
43 
44 typedef enum {
45    GimvIOMemModeStack,
46    GimvIOMemModeWrap
47 } GimvIOMemMode;
48 
49 
50 struct GimvIOMem_Tag
51 {
52    GimvIO          parent;
53 
54    GimvIOMemMode   memio_mode;
55    gboolean        free_buf;
56    gpointer        buf;
57    glong           bufsize;
58    glong           pos;
59 };
60 
61 
62 extern GimvIOFuncs gimv_io_mem_funcs;
63 
64 
65 void       gimv_io_mem_init  (GimvIOMem     *memio,
66                               const gchar   *url,
67                               const gchar   *mode,
68                               GimvIOMemMode  memio_mode);
69 GimvIO    *gimv_io_mem_new   (const gchar   *url,
70                               const gchar   *mode,
71                               GimvIOMemMode  memio_mode);
72 void       gimv_io_mem_stack (GimvIOMem     *memio,
73                               const gchar   *buf,
74                               guint          buf_size);
75 void       gimv_io_mem_wrap  (GimvIOMem     *memio,
76                               const gchar   *buf,
77                               guint          bufsize,
78                               gboolean       free);
79 
80 #endif /* __GIMV_IO_MEM_H__ */
81