LCOV - code coverage report
Current view: directory - objdir/dist/include - nsIContentSink.h (source / functions) Found Hit Coverage
Test: app.info Lines: 8 7 87.5 %
Date: 2012-06-02 Functions: 5 4 80.0 %

       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
       4                 :  *
       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/
       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                 :  *   Henri Sivonen <hsivonen@iki.fi>
      24                 :  *
      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.
      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 "nsStringGlue.h"
      54                 : #include "mozFlushType.h"
      55                 : #include "nsIDTD.h"
      56                 : 
      57                 : class nsParserBase;
      58                 : 
      59                 : #define NS_ICONTENT_SINK_IID \
      60                 : { 0xcf9a7cbb, 0xfcbc, 0x4e13, \
      61                 :   { 0x8e, 0xf5, 0x18, 0xef, 0x2d, 0x3d, 0x58, 0x29 } }
      62                 : 
      63            3356 : class nsIContentSink : public nsISupports {
      64                 : public:
      65                 : 
      66                 :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_SINK_IID)
      67                 : 
      68                 :   /**
      69                 :    * This method is called by the parser when it is entered from
      70                 :    * the event loop. The content sink wants to know how long the
      71                 :    * parser has been active since we last processed events on the
      72                 :    * main event loop and this call calibrates that measurement.
      73                 :    */
      74                 :   NS_IMETHOD WillParse(void)=0;
      75                 : 
      76                 :   /**
      77                 :    * This method gets called when the parser begins the process
      78                 :    * of building the content model via the content sink.
      79                 :    *
      80                 :    * Default implementation provided since the sink should have the option of
      81                 :    * doing nothing in response to this call.
      82                 :    *
      83                 :    * @update 5/7/98 gess
      84                 :    */
      85              28 :   NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) {
      86              28 :     return NS_OK;
      87                 :   }
      88                 : 
      89                 :   /**
      90                 :    * This method gets called when the parser concludes the process
      91                 :    * of building the content model via the content sink.
      92                 :    *
      93                 :    * Default implementation provided since the sink should have the option of
      94                 :    * doing nothing in response to this call.
      95                 :    *
      96                 :    * @update 5/7/98 gess
      97                 :    */
      98              28 :   NS_IMETHOD DidBuildModel(bool aTerminated) {
      99              28 :     return NS_OK;
     100                 :   }
     101                 : 
     102                 :   /**
     103                 :    * This method gets called when the parser gets i/o blocked,
     104                 :    * and wants to notify the sink that it may be a while before
     105                 :    * more data is available.
     106                 :    *
     107                 :    * @update 5/7/98 gess
     108                 :    */
     109                 :   NS_IMETHOD WillInterrupt(void)=0;
     110                 : 
     111                 :   /**
     112                 :    * This method gets called when the parser i/o gets unblocked,
     113                 :    * and we're about to start dumping content again to the sink.
     114                 :    *
     115                 :    * @update 5/7/98 gess
     116                 :    */
     117                 :   NS_IMETHOD WillResume(void)=0;
     118                 : 
     119                 :   /**
     120                 :    * This method gets called by the parser so that the content
     121                 :    * sink can retain a reference to the parser. The expectation
     122                 :    * is that the content sink will drop the reference when it
     123                 :    * gets the DidBuildModel notification i.e. when parsing is done.
     124                 :    */
     125                 :   NS_IMETHOD SetParser(nsParserBase* aParser)=0;
     126                 : 
     127                 :   /**
     128                 :    * Flush content so that the content model is in sync with the state
     129                 :    * of the sink.
     130                 :    *
     131                 :    * @param aType the type of flush to perform
     132                 :    */
     133                 :   virtual void FlushPendingNotifications(mozFlushType aType)=0;
     134                 : 
     135                 :   /**
     136                 :    * Set the document character set. This should be passed on to the
     137                 :    * document itself.
     138                 :    */
     139                 :   NS_IMETHOD SetDocumentCharset(nsACString& aCharset)=0;
     140                 : 
     141                 :   /**
     142                 :    * Returns the target object (often a document object) into which
     143                 :    * the content built by this content sink is being added, if any
     144                 :    * (IOW, may return null).
     145                 :    */
     146                 :   virtual nsISupports *GetTarget()=0;
     147                 :   
     148                 :   /**
     149                 :    * Returns true if there's currently script executing that we need to hold
     150                 :    * parsing for.
     151                 :    */
     152            4601 :   virtual bool IsScriptExecuting()
     153                 :   {
     154            4601 :     return false;
     155                 :   }
     156                 :   
     157                 :   /**
     158                 :    * Posts a runnable that continues parsing.
     159                 :    */
     160               0 :   virtual void ContinueInterruptedParsingAsync() {};
     161                 : };
     162                 : 
     163                 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSink, NS_ICONTENT_SINK_IID)
     164                 : 
     165                 : #endif /* nsIContentSink_h___ */

Generated by: LCOV version 1.7