2 * << Haru Free PDF Library >> -- hpdf_streams.h
4 * URL: http://libharu.org
6 * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
7 * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org>
9 * Permission to use, copy, modify, distribute and sell this software
10 * and its documentation for any purpose is hereby granted without fee,
11 * provided that the above copyright notice appear in all copies and
12 * that both that copyright notice and this permission notice appear
13 * in supporting documentation.
14 * It is provided "as is" without express or implied warranty.
20 #ifndef _HPDF_STREAMS_H
21 #define _HPDF_STREAMS_H
23 #include "hpdf_list.h"
24 #include "hpdf_encrypt.h"
31 #define HPDF_STREAM_SIG_BYTES 0x5354524DL
33 typedef enum _HPDF_StreamType {
34 HPDF_STREAM_UNKNOWN = 0,
40 #define HPDF_STREAM_FILTER_NONE 0x0000
41 #define HPDF_STREAM_FILTER_ASCIIHEX 0x0100
42 #define HPDF_STREAM_FILTER_ASCII85 0x0200
43 #define HPDF_STREAM_FILTER_FLATE_DECODE 0x0400
44 #define HPDF_STREAM_FILTER_DCT_DECODE 0x0800
45 #define HPDF_STREAM_FILTER_CCITT_DECODE 0x1000
47 typedef enum _HPDF_WhenceMode {
53 typedef struct _HPDF_Stream_Rec *HPDF_Stream;
56 (*HPDF_Stream_Write_Func) (HPDF_Stream stream,
62 (*HPDF_Stream_Read_Func) (HPDF_Stream stream,
68 (*HPDF_Stream_Seek_Func) (HPDF_Stream stream,
70 HPDF_WhenceMode mode);
74 (*HPDF_Stream_Tell_Func) (HPDF_Stream stream);
78 (*HPDF_Stream_Free_Func) (HPDF_Stream stream);
82 (*HPDF_Stream_Size_Func) (HPDF_Stream stream);
85 typedef struct _HPDF_MemStreamAttr_Rec *HPDF_MemStreamAttr;
88 typedef struct _HPDF_MemStreamAttr_Rec {
96 } HPDF_MemStreamAttr_Rec;
99 typedef struct _HPDF_Stream_Rec {
100 HPDF_UINT32 sig_bytes;
101 HPDF_StreamType type;
105 HPDF_Stream_Write_Func write_fn;
106 HPDF_Stream_Read_Func read_fn;
107 HPDF_Stream_Seek_Func seek_fn;
108 HPDF_Stream_Free_Func free_fn;
109 HPDF_Stream_Tell_Func tell_fn;
110 HPDF_Stream_Size_Func size_fn;
117 HPDF_MemStream_New (HPDF_MMgr mmgr,
122 HPDF_MemStream_GetBufPtr (HPDF_Stream stream,
128 HPDF_MemStream_GetBufSize (HPDF_Stream stream);
132 HPDF_MemStream_GetBufCount (HPDF_Stream stream);
136 HPDF_MemStream_Rewrite (HPDF_Stream stream,
142 HPDF_MemStream_FreeData (HPDF_Stream stream);
146 HPDF_Stream_WriteToStream (HPDF_Stream src,
153 HPDF_FileReader_New (HPDF_MMgr mmgr,
158 HPDF_FileWriter_New (HPDF_MMgr mmgr,
163 HPDF_CallbackReader_New (HPDF_MMgr mmgr,
164 HPDF_Stream_Read_Func read_fn,
165 HPDF_Stream_Seek_Func seek_fn,
166 HPDF_Stream_Tell_Func tell_fn,
167 HPDF_Stream_Size_Func size_fn,
172 HPDF_CallbackWriter_New (HPDF_MMgr mmgr,
173 HPDF_Stream_Write_Func write_fn,
178 HPDF_Stream_Free (HPDF_Stream stream);
182 HPDF_Stream_WriteChar (HPDF_Stream stream,
187 HPDF_Stream_WriteStr (HPDF_Stream stream,
192 HPDF_Stream_WriteUChar (HPDF_Stream stream,
197 HPDF_Stream_WriteInt (HPDF_Stream stream,
202 HPDF_Stream_WriteUInt (HPDF_Stream stream,
207 HPDF_Stream_WriteReal (HPDF_Stream stream,
212 HPDF_Stream_Write (HPDF_Stream stream,
213 const HPDF_BYTE *ptr,
218 HPDF_Stream_Read (HPDF_Stream stream,
223 HPDF_Stream_ReadLn (HPDF_Stream stream,
229 HPDF_Stream_Tell (HPDF_Stream stream);
233 HPDF_Stream_Seek (HPDF_Stream stream,
235 HPDF_WhenceMode mode);
239 HPDF_Stream_EOF (HPDF_Stream stream);
243 HPDF_Stream_Size (HPDF_Stream stream);
246 HPDF_Stream_Flush (HPDF_Stream stream);
250 HPDF_Stream_WriteEscapeName (HPDF_Stream stream,
255 HPDF_Stream_WriteEscapeText2 (HPDF_Stream stream,
261 HPDF_Stream_WriteEscapeText (HPDF_Stream stream,
266 HPDF_Stream_WriteBinary (HPDF_Stream stream,
267 const HPDF_BYTE *data,
273 HPDF_Stream_Validate (HPDF_Stream stream);
278 #endif /* __cplusplus */
280 #endif /* _HPDF_STREAMS_H */