1 : /*
2 : * Copyright (c) 2007 Henri Sivonen
3 : * Copyright (c) 2008-2010 Mozilla Foundation
4 : *
5 : * Permission is hereby granted, free of charge, to any person obtaining a
6 : * copy of this software and associated documentation files (the "Software"),
7 : * to deal in the Software without restriction, including without limitation
8 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 : * and/or sell copies of the Software, and to permit persons to whom the
10 : * Software is furnished to do so, subject to the following conditions:
11 : *
12 : * The above copyright notice and this permission notice shall be included in
13 : * all copies or substantial portions of the Software.
14 : *
15 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 : * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 : * DEALINGS IN THE SOFTWARE.
22 : */
23 :
24 : /*
25 : * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
26 : * Please edit MetaScanner.java instead and regenerate.
27 : */
28 :
29 : #ifndef nsHtml5MetaScanner_h__
30 : #define nsHtml5MetaScanner_h__
31 :
32 : #include "prtypes.h"
33 : #include "nsIAtom.h"
34 : #include "nsHtml5AtomTable.h"
35 : #include "nsString.h"
36 : #include "nsINameSpaceManager.h"
37 : #include "nsIContent.h"
38 : #include "nsTraceRefcnt.h"
39 : #include "jArray.h"
40 : #include "nsHtml5ArrayCopy.h"
41 : #include "nsAHtml5TreeBuilderState.h"
42 : #include "nsHtml5Atoms.h"
43 : #include "nsHtml5ByteReadable.h"
44 : #include "nsIUnicodeDecoder.h"
45 : #include "nsHtml5Macros.h"
46 :
47 : class nsHtml5StreamParser;
48 :
49 : class nsHtml5Tokenizer;
50 : class nsHtml5TreeBuilder;
51 : class nsHtml5AttributeName;
52 : class nsHtml5ElementName;
53 : class nsHtml5HtmlAttributes;
54 : class nsHtml5UTF16Buffer;
55 : class nsHtml5StateSnapshot;
56 : class nsHtml5Portability;
57 :
58 :
59 : class nsHtml5MetaScanner
60 : {
61 : private:
62 : static staticJArray<PRUnichar,PRInt32> CHARSET;
63 : static staticJArray<PRUnichar,PRInt32> CONTENT;
64 : static staticJArray<PRUnichar,PRInt32> HTTP_EQUIV;
65 : static staticJArray<PRUnichar,PRInt32> CONTENT_TYPE;
66 : protected:
67 : nsHtml5ByteReadable* readable;
68 : private:
69 : PRInt32 metaState;
70 : PRInt32 contentIndex;
71 : PRInt32 charsetIndex;
72 : PRInt32 httpEquivIndex;
73 : PRInt32 contentTypeIndex;
74 : protected:
75 : PRInt32 stateSave;
76 : private:
77 : PRInt32 strBufLen;
78 : autoJArray<PRUnichar,PRInt32> strBuf;
79 : nsString* content;
80 : nsString* charset;
81 : PRInt32 httpEquivState;
82 : public:
83 : nsHtml5MetaScanner();
84 : ~nsHtml5MetaScanner();
85 : protected:
86 : void stateLoop(PRInt32 state);
87 : private:
88 : void handleCharInAttributeValue(PRInt32 c);
89 0 : inline PRInt32 toAsciiLowerCase(PRInt32 c)
90 : {
91 0 : if (c >= 'A' && c <= 'Z') {
92 0 : return c + 0x20;
93 : }
94 0 : return c;
95 : }
96 :
97 : void addToBuffer(PRInt32 c);
98 : void handleAttributeValue();
99 : bool handleTag();
100 : bool handleTagInner();
101 : protected:
102 : bool tryCharset(nsString* encoding);
103 : public:
104 : static void initializeStatics();
105 : static void releaseStatics();
106 :
107 : #include "nsHtml5MetaScannerHSupplement.h"
108 : };
109 :
110 : #define NS_HTML5META_SCANNER_NO 0
111 : #define NS_HTML5META_SCANNER_M 1
112 : #define NS_HTML5META_SCANNER_E 2
113 : #define NS_HTML5META_SCANNER_T 3
114 : #define NS_HTML5META_SCANNER_A 4
115 : #define NS_HTML5META_SCANNER_DATA 0
116 : #define NS_HTML5META_SCANNER_TAG_OPEN 1
117 : #define NS_HTML5META_SCANNER_SCAN_UNTIL_GT 2
118 : #define NS_HTML5META_SCANNER_TAG_NAME 3
119 : #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME 4
120 : #define NS_HTML5META_SCANNER_ATTRIBUTE_NAME 5
121 : #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME 6
122 : #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE 7
123 : #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED 8
124 : #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED 9
125 : #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED 10
126 : #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED 11
127 : #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN 13
128 : #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN 14
129 : #define NS_HTML5META_SCANNER_COMMENT_START 15
130 : #define NS_HTML5META_SCANNER_COMMENT_START_DASH 16
131 : #define NS_HTML5META_SCANNER_COMMENT 17
132 : #define NS_HTML5META_SCANNER_COMMENT_END_DASH 18
133 : #define NS_HTML5META_SCANNER_COMMENT_END 19
134 : #define NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG 20
135 : #define NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN 0
136 : #define NS_HTML5META_SCANNER_HTTP_EQUIV_CONTENT_TYPE 1
137 : #define NS_HTML5META_SCANNER_HTTP_EQUIV_OTHER 2
138 :
139 :
140 : #endif
141 :
|