Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / parser / htmlparser / public / nsIContentSink.h
blob55bed1f5c7ab28688ef01ce50c8e6b7c5c6b3ecb
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
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.
15 * The Original Code is Mozilla Communicator client code.
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.
22 * Contributor(s):
23 * Henri Sivonen <hsivonen@iki.fi>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or 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 MPL, 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 MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsIContentSink_h___
39 #define nsIContentSink_h___
41 /**
42 * MODULE NOTES:
43 * @update gess 4/1/98
45 * This pure virtual interface is used as the "glue" that connects the parsing
46 * process to the content model construction process.
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).
52 #include "nsISupports.h"
53 #include "nsStringGlue.h"
54 #include "mozFlushType.h"
56 class nsIParser;
58 #define NS_ICONTENT_SINK_IID \
59 { 0x94ec4df1, 0x6885, 0x4b1f, \
60 { 0x85, 0x10, 0xe3, 0x5f, 0x4f, 0x36, 0xea, 0xaa } }
62 class nsIContentSink : public nsISupports {
63 public:
65 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_SINK_IID)
67 /**
68 * This method is called by the parser when it is entered from
69 * the event loop. The content sink wants to know how long the
70 * parser has been active since we last processed events on the
71 * main event loop and this call calibrates that measurement.
73 NS_IMETHOD WillParse(void)=0;
75 /**
76 * This method gets called when the parser begins the process
77 * of building the content model via the content sink.
79 * @update 5/7/98 gess
81 NS_IMETHOD WillBuildModel(void)=0;
83 /**
84 * This method gets called when the parser concludes the process
85 * of building the content model via the content sink.
87 * @update 5/7/98 gess
89 NS_IMETHOD DidBuildModel()=0;
91 /**
92 * This method gets called when the parser gets i/o blocked,
93 * and wants to notify the sink that it may be a while before
94 * more data is available.
96 * @update 5/7/98 gess
98 NS_IMETHOD WillInterrupt(void)=0;
101 * This method gets called when the parser i/o gets unblocked,
102 * and we're about to start dumping content again to the sink.
104 * @update 5/7/98 gess
106 NS_IMETHOD WillResume(void)=0;
109 * This method gets called by the parser so that the content
110 * sink can retain a reference to the parser. The expectation
111 * is that the content sink will drop the reference when it
112 * gets the DidBuildModel notification i.e. when parsing is done.
114 NS_IMETHOD SetParser(nsIParser* aParser)=0;
117 * Flush content so that the content model is in sync with the state
118 * of the sink.
120 * @param aType the type of flush to perform
122 virtual void FlushPendingNotifications(mozFlushType aType)=0;
125 * Set the document character set. This should be passed on to the
126 * document itself.
128 NS_IMETHOD SetDocumentCharset(nsACString& aCharset)=0;
131 * Returns the target object (often a document object) into which
132 * the content built by this content sink is being added, if any
133 * (IOW, may return null).
135 virtual nsISupports *GetTarget()=0;
138 NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSink, NS_ICONTENT_SINK_IID)
140 #endif /* nsIContentSink_h___ */