LCOV - app.info - objdir/dist/include/nsIDTD.h

LCOV - code coverage report
| Current view: | directory - objdir/dist/include - nsIDTD.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 1 | 1 | 100.0 %
| Date: | 2012-07-07 | Functions: | 1 | 1 | 100.0 %

           1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
           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.org 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                 :  * Alternatively, the contents of this file may be used under the terms of
          25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          28                 :  * of those above. If you wish to allow use of your version of this file only
          29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          30                 :  * use your version of this file under the terms of the MPL, indicate your
          31                 :  * decision by deleting the provisions above and replace them with the notice
          32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          33                 :  * the provisions above, a recipient may use your version of this file under
          34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          35                 :  *
          36                 :  * ***** END LICENSE BLOCK ***** */
          37                 :
          38                 : #ifndef nsIDTD_h___
          39                 : #define nsIDTD_h___
          40                 :
          41                 : /**
          42                 :  * MODULE NOTES:
          43                 :  * @update  gess 7/20/98
          44                 :  *
          45                 :  * This interface defines standard interface for DTD's. Note that this
          46                 :  * isn't HTML specific. DTD's have several functions within the parser
          47                 :  * system:
          48                 :  *      1) To coordinate the consumption of an input stream via the
          49                 :  *      parser
          50                 :  *      2) To serve as proxy to represent the containment rules of the
          51                 :  *      underlying document
          52                 :  *      3) To offer autodetection services to the parser (mainly for doc
          53                 :  *      conversion)
          54                 :  * */
          55                 :
          56                 : #include "nsISupports.h"
          57                 : #include "nsStringGlue.h"
          58                 : #include "prtypes.h"
          59                 : #include "nsITokenizer.h"
          60                 :
          61                 : #define NS_IDTD_IID \
          62                 : { 0x3de05873, 0xefa7, 0x410d, \
          63                 :   { 0xa4, 0x61, 0x80, 0x33, 0xaf, 0xd9, 0xe3, 0x26 } }
          64                 :
          65                 : enum eAutoDetectResult {
          66                 :     eUnknownDetect,
          67                 :     eValidDetect,
          68                 :     ePrimaryDetect,
          69                 :     eInvalidDetect
          70                 : };
          71                 :
          72                 : enum nsDTDMode {
          73                 :     eDTDMode_unknown = 0,
          74                 :     eDTDMode_quirks,        //pre 4.0 versions
          75                 :     eDTDMode_almost_standards,
          76                 :     eDTDMode_full_standards,
          77                 :     eDTDMode_autodetect,
          78                 :     eDTDMode_fragment
          79                 : };
          80                 :
          81                 :
          82                 : class nsIParser;
          83                 : class CToken;
          84                 : class nsIURI;
          85                 : class nsIContentSink;
          86                 : class CParserContext;
          87                 :
          88                 : class nsIDTD : public nsISupports
          89            3342 : {
          90                 : public:
          91                 :
          92                 :     NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDTD_IID)
          93                 :
          94                 :     NS_IMETHOD WillBuildModel(const CParserContext& aParserContext,
          95                 :                               nsITokenizer* aTokenizer,
          96                 :                               nsIContentSink* aSink) = 0;
          97                 :
          98                 :     /**
          99                 :      * Called by the parser after the parsing process has concluded
         100                 :      * @update  gess5/18/98
         101                 :      * @param   anErrorCode - contains error code resulting from parse process
         102                 :      * @return
         103                 :      */
         104                 :     NS_IMETHOD DidBuildModel(nsresult anErrorCode) = 0;
         105                 :
         106                 :     /**
         107                 :      * Called (possibly repeatedly) by the parser to parse tokens and construct
         108                 :      * the document model via the sink provided to WillBuildModel.
         109                 :      *
         110                 :      * @param   aTokenizer - tokenizer providing the token stream to be parsed
         111                 :      * @param   aCountLines - informs the DTD whether to count newlines
         112                 :      *                        (not wanted, e.g., when handling document.write)
         113                 :      * @param   aCharsetPtr - address of an nsCString containing the charset
         114                 :      *                        that the DTD should use (pointer in case the DTD
         115                 :      *                        opts to ignore this parameter)
         116                 :      */
         117                 :     NS_IMETHOD BuildModel(nsITokenizer* aTokenizer,
         118                 :                           bool aCountLines,
         119                 :                           const nsCString* aCharsetPtr) = 0;
         120                 :
         121                 :     /**
         122                 :      * This method is called to determine whether or not a tag of one
         123                 :      * type can contain a tag of another type.
         124                 :      *
         125                 :      * @update  gess 3/25/98
         126                 :      * @param   aParent -- int tag of parent container
         127                 :      * @param   aChild -- int tag of child container
         128                 :      * @return true if parent can contain child
         129                 :      */
         130                 :     NS_IMETHOD_(bool) CanContain(PRInt32 aParent,PRInt32 aChild) const = 0;
         131                 :
         132                 :     /**
         133                 :      * This method gets called to determine whether a given
         134                 :      * tag is itself a container
         135                 :      *
         136                 :      * @update  gess 3/25/98
         137                 :      * @param   aTag -- tag to test for containership
         138                 :      * @return  true if given tag can contain other tags
         139                 :      */
         140                 :     NS_IMETHOD_(bool) IsContainer(PRInt32 aTag) const = 0;
         141                 :
         142                 :     /**
         143                 :      * Use this id you want to stop the building content model
         144                 :      * --------------[ Sets DTD to STOP mode ]----------------
         145                 :      * It's recommended to use this method in accordance with
         146                 :      * the parser's terminate() method.
         147                 :      *
         148                 :      * @update  harishd 07/22/99
         149                 :      * @param
         150                 :      * @return
         151                 :      */
         152                 :     NS_IMETHOD_(void) Terminate() = 0;
         153                 :
         154                 :     NS_IMETHOD_(PRInt32) GetType() = 0;
         155                 :
         156                 :     /**
         157                 :      * Call this method after calling WillBuildModel to determine what mode the
         158                 :      * DTD actually is using, as it may differ from aParserContext.mDTDMode.
         159                 :      */
         160                 :     NS_IMETHOD_(nsDTDMode) GetMode() const = 0;
         161                 : };
         162                 :
         163                 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIDTD, NS_IDTD_IID)
         164                 :
         165                 : #define NS_DECL_NSIDTD \
         166                 :     NS_IMETHOD WillBuildModel(  const CParserContext& aParserContext, nsITokenizer* aTokenizer, nsIContentSink* aSink);\
         167                 :     NS_IMETHOD DidBuildModel(nsresult anErrorCode);\
         168                 :     NS_IMETHOD BuildModel(nsITokenizer* aTokenizer, bool aCountLines, const nsCString* aCharsetPtr);\
         169                 :     NS_IMETHOD_(bool) CanContain(PRInt32 aParent,PRInt32 aChild) const;\
         170                 :     NS_IMETHOD_(bool) IsContainer(PRInt32 aTag) const;\
         171                 :     NS_IMETHOD_(void)  Terminate();\
         172                 :     NS_IMETHOD_(PRInt32) GetType();\
         173                 :     NS_IMETHOD_(nsDTDMode) GetMode() const;
         174                 : #endif /* nsIDTD_h___ */

Generated by: LCOV version 1.7