Page Speed Optimization Libraries  1.5.27.2
net/instaweb/htmlparse/public/html_name.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Google Inc.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http:///www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00018 
00019 #ifndef NET_INSTAWEB_HTMLPARSE_PUBLIC_HTML_NAME_H_
00020 #define NET_INSTAWEB_HTMLPARSE_PUBLIC_HTML_NAME_H_
00021 
00022 #include "net/instaweb/util/public/string_util.h"
00023 
00024 namespace net_instaweb {
00025 
00031 class HtmlName {
00032  public:
00039   enum Keyword {
00040     kXml,  
00041     kA,
00042     kAbbr,
00043     kAction,
00044     kAddress,
00045     kAlt,
00046     kArea,
00047     kArticle,
00048     kAside,
00049     kAsync,
00050     kAudio,
00051     kAutocomplete,
00052     kAutofocus,
00053     kAutoplay,
00054     kB,
00055     kBackground,
00056     kBase,
00057     kBdi,
00058     kBdo,
00059     kBlockquote,
00060     kBody,
00061     kBr,
00062     kButton,
00063     kCharset,
00064     kChecked,
00065     kCite,
00066     kClass,
00067     kCode,
00068     kCol,
00069     kColgroup,
00070     kColspan,
00071     kCommand,
00072     kContent,
00073     kControls,
00074     kData,
00075     kDataPagespeedFlushStyle,
00076     kDataPagespeedHref,
00077     kDataPagespeedPrioritize,
00078     kDataSrc,
00079     kDd,
00080     kDeclare,
00081     kDefaultchecked,
00082     kDefaultselected,
00083     kDefer,
00084     kDel,
00085     kDetails,
00086     kDfn,
00087     kDir,
00088     kDisabled,
00089     kDisplay,
00090     kDiv,
00091     kDl,
00092     kDt,
00093     kEm,
00094     kEmbed,
00095     kEnctype,
00096     kEvent,
00097     kFieldset,
00098     kFont,
00099     kFooter,
00100     kFor,
00101     kForm,
00102     kFormaction,
00103     kFormnovalidate,
00104     kFrame,
00105     kFrameborder,
00106     kH1,
00107     kH2,
00108     kH3,
00109     kH4,
00110     kH5,
00111     kH6,
00112     kHead,
00113     kHeader,
00114     kHeight,
00115     kHgroup,
00116     kHr,
00117     kHref,
00118     kHtml,
00119     kHttpEquiv,
00120     kI,
00121     kIcon,
00122     kId,
00123     kIframe,
00124     kImg,
00125     kIndeterminate,
00126     kIns,
00127     kInput,
00128     kIsmap,
00129     kKbd,
00130     kKeygen,
00131     kKeytype,
00132     kLang,
00133     kLanguage,
00134     kLi,
00135     kLink,
00136     kLoop,
00137     kManifest,
00138     kMark,
00139     kMarquee,
00140     kMedia,
00141     kMenu,
00142     kMeta,
00143     kMethod,
00144     kMultiple,
00145     kMuted,
00146     kName,
00147     kNav,
00148     kNoembed,
00149     kNoframes,
00150     kNohref,
00151     kNoresize,
00152     kNoscript,
00153     kNovalidate,
00154     kObject,
00155     kOl,
00156     kOnclick,
00157     kOnload,
00158     kOpen,
00159     kOptgroup,
00160     kOption,
00161     kOther,
00162     kP,
00163     kPagespeedBlankSrc,
00164     kPagespeedHighResSrc,
00165     kPagespeedIframe,
00166     kPagespeedInlineSrc,
00167     kPagespeedLazySrc,
00168     kPagespeedLowResSrc,
00169     kPagespeedLscExpiry,
00170     kPagespeedLscHash,
00171     kPagespeedLscUrl,
00172     kPagespeedNoDefer,
00173     kPagespeedNoTransform,
00174     kPagespeedOrigSrc,
00175     kPagespeedOrigType,
00176     kPagespeedSize,
00177     kPagespeedUrlHash,
00178     kParam,
00179     kPre,
00180     kProfile,
00181     kQ,
00182     kReadonly,
00183     kRel,
00184     kRequired,
00185     kReversed,
00186     kRowspan,
00187     kRp,
00188     kRt,
00189     kRuby,
00190     kS,
00191     kSamp,
00192     kScoped,
00193     kScript,
00194     kScrolling,
00195     kSeamless,
00196     kSection,
00197     kSelect,
00198     kSelected,
00199     kShape,
00200     kSmall,
00201     kSource,
00202     kSpan,
00203     kSrc,
00204     kStrong,
00205     kStyle,
00206     kSub,
00207     kTable,
00208     kTag,
00209     kTbody,
00210     kTd,
00211     kTest,
00212     kTextarea,
00213     kTfoot,
00214     kTh,
00215     kThead,
00216     kTime,
00217     kTitle,
00218     kTr,
00219     kTrack,
00220     kType,
00221     kU,
00222     kUl,
00223     kValuetype,
00224     kVar,
00225     kVideo,
00226     kWbr,
00227     kWidth,
00228     kWrap,
00229     kXmp,
00230     kNotAKeyword
00231   };
00232 
00238   HtmlName(Keyword keyword, const char* str)
00239       : keyword_(keyword), c_str_(str) {
00240   }
00241 
00244   Keyword keyword() const { return keyword_; }
00245 
00247   const char* c_str() const { return c_str_; }
00248 
00253   class Iterator {
00254    public:
00255     Iterator() : index_(-1) { Next(); }
00256     bool AtEnd() const;
00257     void Next();
00258     Keyword keyword() const;
00259     const char* name() const;
00260 
00261    private:
00262     int index_;
00263 
00265   };
00266 
00267   static int num_keywords();
00268   static Keyword Lookup(const StringPiece& name);
00269 
00270  private:
00271   friend class HtmlNameTest;
00272 
00273   Keyword keyword_;
00274   const char* c_str_;
00275 
00277 };
00278 
00279 }  
00280 
00281 #endif  ///< NET_INSTAWEB_HTMLPARSE_PUBLIC_HTML_NAME_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines