1 /*
2  * $LynxId: HTStream.h,v 1.16 2011/06/11 12:08:40 tom Exp $
3  *
4  *                                                      The Stream class definition -- libwww
5                                  STREAM OBJECT DEFINITION
6 
7    A Stream object is something which accepts a stream of text.
8 
9    The creation methods will vary on the type of Stream Object.  All creation
10    methods return a pointer to the stream type below.
11 
12    As you can see, but the methods used to write to the stream and close it are
13    pointed to be the object itself.
14 
15  */
16 #ifndef HTSTREAM_H
17 #define HTSTREAM_H
18 
19 #ifndef HTUTILS_H
20 #include <HTUtils.h>
21 #endif
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26     typedef struct _HTStream HTStream;
27 
28 /*
29 
30    These are the common methods of all streams.  They should be
31    self-explanatory.
32 
33  */
34     typedef struct _HTStreamClass {
35 
36 	const char *name;	/* Just for diagnostics */
37 
38 	void (*_free) (HTStream *me);
39 
40 	void (*_abort) (HTStream *me, HTError e);
41 
42 	void (*put_character) (HTStream *me, int ch);
43 
44 	void (*put_string) (HTStream *me, const char *str);
45 
46 	void (*put_block) (HTStream *me, const char *str, int len);
47 
48     } HTStreamClass;
49 
50 #ifndef HTSTREAM_INTERNAL
51     struct _HTStream {
52 	HTStreamClass *isa;
53     };
54 #endif
55 /*
56 
57   Generic Error Stream
58 
59    The Error stream simply signals an error on all output methods.
60    This can be used to stop a stream as soon as data arrives, for
61    example from the network.
62 
63  */
64     extern HTStream *HTErrorStream(void);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 #endif				/* HTSTREAM_H */
70