Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
html_name.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef PAGESPEED_KERNEL_HTML_HTML_NAME_H_
20 #define PAGESPEED_KERNEL_HTML_HTML_NAME_H_
21 
23 
24 namespace net_instaweb {
25 
31 class HtmlName {
32  public:
39  enum Keyword {
40  kXml,
41  kA,
42  kAbbr,
43  kAction,
44  kAddress,
45  kAlt,
46  kAmp,
47  kArea,
48  kArticle,
49  kAs,
50  kAside,
51  kAsync,
52  kAudio,
53  kAutocomplete,
54  kAutofocus,
55  kAutoplay,
56  kB,
57  kBackground,
58  kBase,
59  kBdi,
60  kBdo,
61  kBlockquote,
62  kBody,
63  kBr,
64  kButton,
65  kCaption,
66  kCharset,
67  kChecked,
68  kCite,
69  kClass,
70  kCode,
71  kCol,
72  kColgroup,
73  kColspan,
74  kCommand,
75  kContent,
76  kControls,
77  kData,
78  kDatalist,
79  kDataActualHeight,
80  kDataActualWidth,
81  kDataMobileRole,
82  kDataPagespeedFlushStyle,
83  kDataPagespeedHighResSrc,
84  kDataPagespeedHighResSrcset,
85  kDataPagespeedHref,
86  kDataPagespeedInlineSrc,
87  kDataPagespeedLazySrc,
88  kDataPagespeedLazySrcset,
89  kDataPagespeedLowResSrc,
90  kDataPagespeedLscExpiry,
91  kDataPagespeedLscHash,
92  kDataPagespeedLscUrl,
93  kDataPagespeedNoDefer,
94  kDataPagespeedNoTransform,
95  kDataPagespeedOrigIndex,
96  kDataPagespeedOrigSrc,
97  kDataPagespeedOrigType,
98  kDataPagespeedPrioritize,
99  kDataPagespeedResponsiveTemp,
100  kDataPagespeedSize,
101  kDataPagespeedUrlHash,
102  kDataSrc,
103  kDd,
104  kDeclare,
105  kDefaultchecked,
106  kDefaultselected,
107  kDefer,
108  kDel,
109  kDetails,
110  kDfn,
111  kDir,
112  kDisabled,
113  kDisplay,
114  kDiv,
115  kDl,
116  kDt,
117  kEm,
118  kEmbed,
119  kEnctype,
120  kEvent,
121  kFieldset,
122  kFont,
123  kFooter,
124  kFor,
125  kForm,
126  kFormaction,
127  kFormnovalidate,
128  kFrame,
129  kFrameborder,
130  kH1,
131  kH2,
132  kH3,
133  kH4,
134  kH5,
135  kH6,
136  kHead,
137  kHeader,
138  kHeight,
139  kHgroup,
140  kHr,
141  kHref,
142  kHtml,
143  kHttpEquiv,
144  kI,
145  kIcon,
146  kId,
147  kIframe,
148  kImg,
149  kIndeterminate,
150  kIns,
151  kInput,
152  kIsmap,
153  kItemProp,
154  kKbd,
155  kKeygen,
156  kKeytype,
157  kLang,
158  kLanguage,
159  kLegend,
160  kLi,
161  kLink,
162  kLongdesc,
163  kLoop,
164  kMain,
165  kManifest,
166  kMap,
167  kMark,
168  kMarquee,
169  kMedia,
170  kMenu,
171  kMeta,
172  kMethod,
173  kMultiple,
174  kMuted,
175  kName,
176  kNav,
177  kNoembed,
178  kNoframes,
179  kNohref,
180  kNoresize,
181  kNoscript,
182  kNovalidate,
183  kObject,
184  kOl,
185  kOnclick,
186  kOnerror,
187  kOnload,
188  kOpen,
189  kOptgroup,
190  kOption,
191  kOther,
192  kP,
193  kPagespeedIframe,
194  kPagespeedNoDefer,
195  kPagespeedNoTransform,
196  kParam,
197  kPoster,
198  kPre,
199  kProfile,
200  kQ,
201  kReadonly,
202  kRel,
203  kRequired,
204  kReversed,
205  kRole,
206  kRowspan,
207  kRp,
208  kRt,
209  kRuby,
210  kS,
211  kSamp,
212  kScoped,
213  kScript,
214  kScrolling,
215  kSeamless,
216  kSection,
217  kSelect,
218  kSelected,
219  kShape,
220  kSmall,
221  kSource,
222  kSpan,
223  kSrc,
224  kSrcset,
225  kStrong,
226  kStyle,
227  kSub,
228  kTable,
229  kTag,
230  kTbody,
231  kTd,
232  kTest,
233  kTextarea,
234  kTfoot,
235  kTh,
236  kThead,
237  kTime,
238  kTitle,
239  kTr,
240  kTrack,
241  kType,
242  kU,
243  kUl,
244  kValue,
245  kValuetype,
246  kVar,
247  kVideo,
248  kWbr,
249  kWidth,
250  kWrap,
251  kXmp,
252  kNotAKeyword
253  };
254 
255 
257 
260  Keyword keyword() const { return keyword_; }
261 
263  StringPiece value() const { return *str_; }
264 
269  class Iterator {
270  public:
271  Iterator() : index_(-1) { Next(); }
272  bool AtEnd() const;
273  void Next();
274  Keyword keyword() const;
275  const char* name() const;
276 
277  private:
278  int index_;
279 
281  };
282 
283  static int num_keywords();
284  static Keyword Lookup(const StringPiece& name);
285 
286  private:
292  HtmlName(Keyword keyword, const StringPiece* str)
293  : keyword_(keyword), str_(str) {
294  }
295 
296  friend class HtmlNameTest;
297  friend class HtmlParse;
298 
299  Keyword keyword_;
300  const StringPiece* str_;
301 
303 };
304 
305 }
306 
307 #endif
Definition: html_name.h:269
Definition: html_parse.h:88
Keyword keyword() const
HtmlName's should be normally constructed using HtmlParse::MakeName.
Definition: html_name.h:260
StringPiece value() const
Return the atom string, which may not be case folded.
Definition: html_name.h:263
Definition: html_name.h:31
Keyword
Definition: html_name.h:39
?Xml
Definition: html_name.h:40