Annotation of libwww/Library/src/HTStruct.html, revision 2.2
2.1 frystyk 1: <HTML>
2: <HEAD>
3: <TITLE>Structured Stream Definition</TITLE>
4: </HEAD>
5: <BODY>
6:
7: <H1>Structured Stream Definition</H1>
8:
9: <PRE>
10: /*
2.2 ! frystyk 11: ** (c) COPYRIGHT MIT 1995.
2.1 frystyk 12: ** Please first read the full copyright statement in the file COPYRIGH.
13: */
14: </PRE>
15:
16: This module is a part of the <A
17: HREF="http://www.w3.org/hypertext/WWW/Library/User/Guide/Guide.html">
18: Library of Common Code</A>.
19:
20: <PRE>
21: #ifndef HTSTRUCT_H
22: #define HTSTRUCT_H
23:
24: #include "HTStream.h"
25: </PRE>
26:
27: A structured object is something which can reasonably be represented
28: in for eaxmple SGML. I'll rephrase that. A structured object is am
29: ordered tree-structured arrangement of data which is representable as
30: text. An example is the SGML parser which outputs to a
31: <CODE>Structured Object</CODE>. A Structured object can output its
32: contents to another <CODE>Structured Object</CODE>. It's a kind of
33: typed stream. The architecure is largely Dan Conolly's. Elements and
34: entities are passed to the sob by number, implying a knowledge of the
35: DTD.<P>
36:
37: The <CODE>Streuctured Stream</CODE> is a subclass of a <A
38: HREF="HTStream.html">Generic Stream Object</A>. As always, we don't
39: have classes in basic C so we have to do this by hand! <P>
40:
41: <B>NOTE:</B> The <CODE>put_block</CODE> method was <CODE>write</CODE>,
42: but this upset systems which had macros for <CODE>write()</CODE>. See
43: the <A HREF="HTStream.html">Generic Stream Definition</A> for valid
44: return codes.<P>
45:
46: <PRE>
47: typedef struct _HTStructured HTStructured;
48:
49: typedef struct _HTStructuredClass {
50:
51: char * name;
52:
53: int (*flush) PARAMS((HTStructured * me));
54:
55: int (*_free) PARAMS((HTStructured * me));
56:
57: int (*abort) PARAMS((HTStructured * me, HTError e));
58:
59: int (*put_character) PARAMS((HTStructured * me,
60: char ch));
61:
62: int (*put_string) PARAMS((HTStructured * me,
63: CONST char * str));
64:
65: int (*put_block) PARAMS((HTStructured * me,
66: CONST char * str,
67: int len));
68: </PRE>
69:
70: See the <A HREF="HTStream.html">Generic Stream Definition</A> for an
71: explanation of these methods. Note that they all have a
72: <CODE>HTStructured</CODE> object a the parameter, not a generic
73: stream. This is to avoid <EM>incompatible pointer</EM> warnings
74:
75: <PRE>
76: void (*start_element) PARAMS((HTStructured * me,
77: int element_number,
78: CONST BOOL * attribute_present,
79: CONST char ** attribute_value));
80:
81: void (*end_element) PARAMS((HTStructured * me,
82: int element_number));
83:
84: void (*put_entity) PARAMS((HTStructured * me,
85: int entity_number));
86:
87: } HTStructuredClass;
88:
89: #endif
90: </PRE>
91: End of Structured Stream definition
92: </BODY>
93: </HTML>
Webmaster