Bug 436663. Work around ATSUI crasher caused by long Hebrew sequence. r=roc, sr=vlad
[wine-gecko.git] / parser / htmlparser / public / nsIParserNode.h
blob2b0d127abb586f9064495f138288317d6144aaac
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.org 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):
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.
36 * ***** END LICENSE BLOCK ***** */
39 /**
40 * MODULE NOTES:
41 * @update gess 4/1/98
43 * This class is defines the basic interface between the
44 * parser and the content sink. The parser will iterate
45 * over the collection of tokens that it sees from the
46 * tokenizer, coverting each related "group" into one of
47 * these. This object gets passed to the sink, and is
48 * then immediately reused.
50 * If you want to hang onto one of these, you should
51 * make your own copy.
55 #ifndef NS_IPARSERNODE__
56 #define NS_IPARSERNODE__
58 #include "nsISupports.h"
59 #include "prtypes.h"
60 #include "nsStringGlue.h"
61 #include "nsDebug.h"
63 //#define HEAP_ALLOCATED_NODES
64 //#define DEBUG_TRACK_NODES
66 class nsIAtom;
67 class CToken;
69 // 6e59f160-2717-11d2-9246-00805f8a7ab6
70 #define NS_IPARSER_NODE_IID \
71 {0x6e59f160, 0x2717, 0x11d1, \
72 {0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6}}
74 /**
75 * Parser nodes are the unit of exchange between the
76 * parser and the content sink. Nodes offer access to
77 * the current token, its attributes, and its skipped-
78 * content if applicable.
80 * @update gess 3/25/98
82 class nsIParserNode { // XXX Should be nsAParserNode
84 public:
87 /**
88 * Retrieve the name of the node
89 * @update gess5/11/98
90 * @return string containing node name
92 virtual const nsAString& GetTagName() const = 0; //to get name of tag
94 /**
95 * Retrieve the text from the given node
96 * @update gess5/11/98
97 * @return string containing node text
99 virtual const nsAString& GetText() const = 0; //get plain text if available
102 * Retrieve the type of the parser node.
103 * @update gess5/11/98
104 * @return node type.
106 virtual PRInt32 GetNodeType() const =0;
109 * Retrieve token type of parser node
110 * @update gess5/11/98
111 * @return token type
113 virtual PRInt32 GetTokenType() const =0;
116 * Retrieve the number of attributes in this node.
117 * @update gess5/11/98
118 * @return count of attributes (may be 0)
120 virtual PRInt32 GetAttributeCount(PRBool askToken=PR_FALSE) const =0;
123 * Retrieve the key (of key/value pair) at given index
124 * @update gess5/11/98
125 * @param anIndex is the index of the key you want
126 * @return string containing key.
128 virtual const nsAString& GetKeyAt(PRUint32 anIndex) const = 0;
131 * Retrieve the value (of key/value pair) at given index
132 * @update gess5/11/98
133 * @param anIndex is the index of the value you want
134 * @return string containing value.
136 virtual const nsAString& GetValueAt(PRUint32 anIndex) const = 0;
139 * NOTE: When the node is an entity, this will translate the entity
140 * to it's unicode value, and store it in aString.
141 * @update gess5/11/98
142 * @param aString will contain the resulting unicode string value
143 * @return int (unicode char or unicode index from table)
145 virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
148 virtual void AddAttribute(CToken* aToken)=0;
151 * This getter retrieves the line number from the input source where
152 * the token occured. Lines are interpreted as occuring between \n characters.
153 * @update gess7/24/98
154 * @return int containing the line number the token was found on
156 virtual PRInt32 GetSourceLineNumber(void) const =0;
159 * This pair of methods allows us to set a generic bit (for arbitrary use)
160 * on each node stored in the context.
161 * @update gess 11May2000
163 virtual PRBool GetGenericState(void) const =0;
164 virtual void SetGenericState(PRBool aState) =0;
166 /** Retrieve a string containing the tag and its attributes in "source" form
167 * @update rickg 06June2000
168 * @return void
170 virtual void GetSource(nsString& aString) const = 0;
172 /** Release all the objects you're holding
173 * @update harishd 08/02/00
174 * @return void
176 virtual nsresult ReleaseAll()=0;
179 #endif