Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / htmlparser / nsIDTD.h
bloba47938befa5ac7d2e03c2c4df53936d0b2c35c21
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsIDTD_h___
7 #define nsIDTD_h___
9 /**
10 * MODULE NOTES:
11 * @update gess 7/20/98
13 * This interface defines standard interface for DTD's. Note that this
14 * isn't HTML specific. DTD's have several functions within the parser
15 * system:
16 * 1) To coordinate the consumption of an input stream via the
17 * parser
18 * 2) To serve as proxy to represent the containment rules of the
19 * underlying document
20 * 3) To offer autodetection services to the parser (mainly for doc
21 * conversion)
22 * */
24 #include "nsISupports.h"
25 #include "nsString.h"
26 #include "nsITokenizer.h"
28 #define NS_IDTD_IID \
29 { \
30 0x3de05873, 0xefa7, 0x410d, { \
31 0xa4, 0x61, 0x80, 0x33, 0xaf, 0xd9, 0xe3, 0x26 \
32 } \
35 enum eAutoDetectResult {
36 eUnknownDetect,
37 eValidDetect,
38 ePrimaryDetect,
39 eInvalidDetect
42 enum nsDTDMode {
43 eDTDMode_unknown = 0,
44 eDTDMode_quirks, // pre 4.0 versions
45 eDTDMode_almost_standards,
46 eDTDMode_full_standards,
47 eDTDMode_autodetect,
48 eDTDMode_fragment
51 class nsIContentSink;
52 class CParserContext;
54 class nsIDTD : public nsISupports {
55 public:
56 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDTD_IID)
58 NS_IMETHOD WillBuildModel(const CParserContext& aParserContext,
59 nsITokenizer* aTokenizer,
60 nsIContentSink* aSink) = 0;
62 /**
63 * Called by the parser after the parsing process has concluded
64 * @update gess5/18/98
65 * @param anErrorCode - contains error code resulting from parse process
66 * @return
68 NS_IMETHOD DidBuildModel(nsresult anErrorCode) = 0;
70 /**
71 * Called (possibly repeatedly) by the parser to parse tokens and construct
72 * the document model via the sink provided to WillBuildModel.
74 * @param aTokenizer - tokenizer providing the token stream to be parsed
75 * @param aCountLines - informs the DTD whether to count newlines
76 * (not wanted, e.g., when handling document.write)
77 * @param aCharsetPtr - address of an nsCString containing the charset
78 * that the DTD should use (pointer in case the DTD
79 * opts to ignore this parameter)
81 NS_IMETHOD BuildModel(nsITokenizer* aTokenizer, nsIContentSink* aSink) = 0;
83 /**
84 * This method is called to determine whether or not a tag of one
85 * type can contain a tag of another type.
87 * @update gess 3/25/98
88 * @param aParent -- int tag of parent container
89 * @param aChild -- int tag of child container
90 * @return true if parent can contain child
92 NS_IMETHOD_(bool) CanContain(int32_t aParent, int32_t aChild) const = 0;
94 /**
95 * This method gets called to determine whether a given
96 * tag is itself a container
98 * @update gess 3/25/98
99 * @param aTag -- tag to test for containership
100 * @return true if given tag can contain other tags
102 NS_IMETHOD_(bool) IsContainer(int32_t aTag) const = 0;
105 * Use this id you want to stop the building content model
106 * --------------[ Sets DTD to STOP mode ]----------------
107 * It's recommended to use this method in accordance with
108 * the parser's terminate() method.
110 * @update harishd 07/22/99
111 * @param
112 * @return
114 NS_IMETHOD_(void) Terminate() = 0;
116 NS_IMETHOD_(int32_t) GetType() = 0;
119 * Call this method after calling WillBuildModel to determine what mode the
120 * DTD actually is using, as it may differ from aParserContext.mDTDMode.
122 NS_IMETHOD_(nsDTDMode) GetMode() const = 0;
125 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDTD, NS_IDTD_IID)
127 #define NS_DECL_NSIDTD \
128 NS_IMETHOD WillBuildModel(const CParserContext& aParserContext, \
129 nsITokenizer* aTokenizer, nsIContentSink* aSink) \
130 override; \
131 NS_IMETHOD DidBuildModel(nsresult anErrorCode) override; \
132 NS_IMETHOD BuildModel(nsITokenizer* aTokenizer, nsIContentSink* aSink) \
133 override; \
134 NS_IMETHOD_(bool) \
135 CanContain(int32_t aParent, int32_t aChild) const override; \
136 NS_IMETHOD_(bool) IsContainer(int32_t aTag) const override; \
137 NS_IMETHOD_(void) Terminate() override; \
138 NS_IMETHOD_(int32_t) GetType() override; \
139 NS_IMETHOD_(nsDTDMode) GetMode() const override;
140 #endif /* nsIDTD_h___ */