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
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.
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___
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"
58 #define NS_ICONTENT_SINK_IID \
59 { 0x94ec4df1, 0x6885, 0x4b1f, \
60 { 0x85, 0x10, 0xe3, 0x5f, 0x4f, 0x36, 0xea, 0xaa } }
62 class nsIContentSink
: public nsISupports
{
65 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_SINK_IID
)
68 * This method gets called before the nsParser calls tokenize.
69 * This is needed because the XML side actually builds
70 * the content model as part of the tokenization and
71 * not on BuildModel(). The XML side can use this call
72 * to do stuff that the HTML side does in WillProcessTokens().
74 * @update 2006-10-17 hsivonen
76 NS_IMETHOD
WillTokenize(void)=0;
79 * This method gets called when the parser begins the process
80 * of building the content model via the content sink.
84 NS_IMETHOD
WillBuildModel(void)=0;
87 * This method gets called when the parser concludes the process
88 * of building the content model via the content sink.
92 NS_IMETHOD
DidBuildModel()=0;
95 * This method gets called when the parser gets i/o blocked,
96 * and wants to notify the sink that it may be a while before
97 * more data is available.
101 NS_IMETHOD
WillInterrupt(void)=0;
104 * This method gets called when the parser i/o gets unblocked,
105 * and we're about to start dumping content again to the sink.
107 * @update 5/7/98 gess
109 NS_IMETHOD
WillResume(void)=0;
112 * This method gets called by the parser so that the content
113 * sink can retain a reference to the parser. The expectation
114 * is that the content sink will drop the reference when it
115 * gets the DidBuildModel notification i.e. when parsing is done.
117 NS_IMETHOD
SetParser(nsIParser
* aParser
)=0;
120 * Flush content so that the content model is in sync with the state
123 * @param aType the type of flush to perform
125 virtual void FlushPendingNotifications(mozFlushType aType
)=0;
128 * Set the document character set. This should be passed on to the
131 NS_IMETHOD
SetDocumentCharset(nsACString
& aCharset
)=0;
134 * Returns the target object (often a document object) into which
135 * the content built by this content sink is being added, if any
136 * (IOW, may return null).
138 virtual nsISupports
*GetTarget()=0;
141 NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSink
, NS_ICONTENT_SINK_IID
)
143 #endif /* nsIContentSink_h___ */