1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
---|
2 | /* ***** BEGIN LICENSE BLOCK ***** |
---|
3 | * Version: NPL 1.1/GPL 2.0/LGPL 2.1 |
---|
4 | * |
---|
5 | * The contents of this file are subject to the Netscape Public License |
---|
6 | * Version 1.1 (the "License"); you may not use this file except in |
---|
7 | * compliance with the License. You may obtain a copy of the License at |
---|
8 | * http://www.mozilla.org/NPL/ |
---|
9 | * |
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis, |
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
---|
12 | * for the specific language governing rights and limitations under the |
---|
13 | * License. |
---|
14 | * |
---|
15 | * The Original Code is Mozilla Communicator client code. |
---|
16 | * |
---|
17 | * The Initial Developer of the Original Code is |
---|
18 | * Netscape Communications Corporation. |
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998 |
---|
20 | * the Initial Developer. All Rights Reserved. |
---|
21 | * |
---|
22 | * Contributor(s): |
---|
23 | * |
---|
24 | * |
---|
25 | * Alternatively, the contents of this file may be used under the terms of |
---|
26 | * either the GNU General Public License Version 2 or later (the "GPL"), or |
---|
27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
---|
28 | * in which case the provisions of the GPL or the LGPL are applicable instead |
---|
29 | * of those above. If you wish to allow use of your version of this file only |
---|
30 | * under the terms of either the GPL or the LGPL, and not to allow others to |
---|
31 | * use your version of this file under the terms of the NPL, indicate your |
---|
32 | * decision by deleting the provisions above and replace them with the notice |
---|
33 | * and other provisions required by the GPL or the LGPL. If you do not delete |
---|
34 | * the provisions above, a recipient may use your version of this file under |
---|
35 | * the terms of any one of the NPL, the GPL or the LGPL. |
---|
36 | * |
---|
37 | * ***** END LICENSE BLOCK ***** */ |
---|
38 | #ifndef nsIContentSink_h___ |
---|
39 | #define nsIContentSink_h___ |
---|
40 | |
---|
41 | /** |
---|
42 | * MODULE NOTES: |
---|
43 | * @update gess 4/1/98 |
---|
44 | * |
---|
45 | * This pure virtual interface is used as the "glue" that connects the parsing |
---|
46 | * process to the content model construction process. |
---|
47 | * |
---|
48 | * The icontentsink interface is a very lightweight wrapper that represents the |
---|
49 | * content-sink model building process. There is another one that you may care |
---|
50 | * about more, which is the IHTMLContentSink interface. (See that file for details). |
---|
51 | */ |
---|
52 | #include "nsISupports.h" |
---|
53 | #include "nsString.h" |
---|
54 | |
---|
55 | class nsIParser; |
---|
56 | |
---|
57 | #define NS_ICONTENT_SINK_IID \ |
---|
58 | {0x7f459e15, 0xd559, 0x4c50, {0x91, 0x30, 0x3a, 0xe7, 0x31, 0x46, 0x67, 0xa9}} |
---|
59 | // The base value for the content ID counter. |
---|
60 | // Values greater than or equal to this base value are used |
---|
61 | // by each of the content sinks to assign unique values |
---|
62 | // to the content objects created by them. |
---|
63 | #define NS_CONTENT_ID_COUNTER_BASE 10000 |
---|
64 | |
---|
65 | class nsIContentSink : public nsISupports { |
---|
66 | public: |
---|
67 | |
---|
68 | NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTENT_SINK_IID) |
---|
69 | |
---|
70 | /** |
---|
71 | * This method gets called when the parser begins the process |
---|
72 | * of building the content model via the content sink. |
---|
73 | * |
---|
74 | * @update 5/7/98 gess |
---|
75 | */ |
---|
76 | NS_IMETHOD WillBuildModel(void)=0; |
---|
77 | |
---|
78 | /** |
---|
79 | * This method gets called when the parser concludes the process |
---|
80 | * of building the content model via the content sink. |
---|
81 | * |
---|
82 | * @update 5/7/98 gess |
---|
83 | */ |
---|
84 | NS_IMETHOD DidBuildModel()=0; |
---|
85 | |
---|
86 | /** |
---|
87 | * This method gets called when the parser gets i/o blocked, |
---|
88 | * and wants to notify the sink that it may be a while before |
---|
89 | * more data is available. |
---|
90 | * |
---|
91 | * @update 5/7/98 gess |
---|
92 | */ |
---|
93 | NS_IMETHOD WillInterrupt(void)=0; |
---|
94 | |
---|
95 | /** |
---|
96 | * This method gets called when the parser i/o gets unblocked, |
---|
97 | * and we're about to start dumping content again to the sink. |
---|
98 | * |
---|
99 | * @update 5/7/98 gess |
---|
100 | */ |
---|
101 | NS_IMETHOD WillResume(void)=0; |
---|
102 | |
---|
103 | /** |
---|
104 | * This method gets called by the parser so that the content |
---|
105 | * sink can retain a reference to the parser. The expectation |
---|
106 | * is that the content sink will drop the reference when it |
---|
107 | * gets the DidBuildModel notification i.e. when parsing is done. |
---|
108 | */ |
---|
109 | NS_IMETHOD SetParser(nsIParser* aParser)=0; |
---|
110 | |
---|
111 | /** |
---|
112 | * Flush all pending notifications so that the content model |
---|
113 | * is in sync with the state of the sink. |
---|
114 | */ |
---|
115 | NS_IMETHOD FlushPendingNotifications()=0; |
---|
116 | |
---|
117 | /** |
---|
118 | * Set the document character set. This should be passed on to the |
---|
119 | * document itself. |
---|
120 | */ |
---|
121 | NS_IMETHOD SetDocumentCharset(nsACString& aCharset)=0; |
---|
122 | |
---|
123 | /** |
---|
124 | * Returns the target object (often a document object) into which |
---|
125 | * the content built by this content sink is being added, if any |
---|
126 | * (IOW, may return null). |
---|
127 | */ |
---|
128 | virtual nsISupports *GetTarget()=0; |
---|
129 | }; |
---|
130 | |
---|
131 | #endif /* nsIContentSink_h___ */ |
---|