Page Speed Optimization Libraries  1.3.25.1
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     kDataPagespeedHref,
00076     kDataPagespeedPrioritize,
00077     kDataSrc,
00078     kDd,
00079     kDeclare,
00080     kDefaultchecked,
00081     kDefaultselected,
00082     kDefer,
00083     kDel,
00084     kDetails,
00085     kDfn,
00086     kDir,
00087     kDisabled,
00088     kDisplay,
00089     kDiv,
00090     kDl,
00091     kDt,
00092     kEm,
00093     kEmbed,
00094     kEnctype,
00095     kEvent,
00096     kFieldset,
00097     kFont,
00098     kFooter,
00099     kFor,
00100     kForm,
00101     kFormaction,
00102     kFormnovalidate,
00103     kFrame,
00104     kFrameborder,
00105     kH1,
00106     kH2,
00107     kH3,
00108     kH4,
00109     kH5,
00110     kH6,
00111     kHead,
00112     kHeader,
00113     kHeight,
00114     kHgroup,
00115     kHr,
00116     kHref,
00117     kHtml,
00118     kHttpEquiv,
00119     kI,
00120     kIcon,
00121     kId,
00122     kIframe,
00123     kImg,
00124     kIndeterminate,
00125     kIns,
00126     kInput,
00127     kIsmap,
00128     kKbd,
00129     kKeygen,
00130     kKeytype,
00131     kLang,
00132     kLanguage,
00133     kLi,
00134     kLink,
00135     kLoop,
00136     kManifest,
00137     kMark,
00138     kMarquee,
00139     kMedia,
00140     kMenu,
00141     kMeta,
00142     kMethod,
00143     kMultiple,
00144     kMuted,
00145     kName,
00146     kNav,
00147     kNoembed,
00148     kNohref,
00149     kNoresize,
00150     kNoscript,
00151     kNovalidate,
00152     kObject,
00153     kOl,
00154     kOnclick,
00155     kOnload,
00156     kOpen,
00157     kOptgroup,
00158     kOption,
00159     kOther,
00160     kP,
00161     kPagespeedBlankSrc,
00162     kPagespeedHighResSrc,
00163     kPagespeedIframe,
00164     kPagespeedInlineSrc,
00165     kPagespeedLazySrc,
00166     kPagespeedLowResSrc,
00167     kPagespeedLscExpiry,
00168     kPagespeedLscHash,
00169     kPagespeedLscUrl,
00170     kPagespeedNoDefer,
00171     kPagespeedNoTransform,
00172     kPagespeedOrigSrc,
00173     kPagespeedOrigType,
00174     kPagespeedSize,
00175     kPagespeedUrlHash,
00176     kParam,
00177     kPre,
00178     kProfile,
00179     kQ,
00180     kReadonly,
00181     kRel,
00182     kRequired,
00183     kReversed,
00184     kRowspan,
00185     kRp,
00186     kRt,
00187     kRuby,
00188     kS,
00189     kSamp,
00190     kScoped,
00191     kScript,
00192     kScrolling,
00193     kSeamless,
00194     kSection,
00195     kSelect,
00196     kSelected,
00197     kShape,
00198     kSmall,
00199     kSource,
00200     kSpan,
00201     kSrc,
00202     kStrong,
00203     kStyle,
00204     kSub,
00205     kTable,
00206     kTag,
00207     kTbody,
00208     kTd,
00209     kTest,
00210     kTextarea,
00211     kTfoot,
00212     kTh,
00213     kThead,
00214     kTime,
00215     kTitle,
00216     kTr,
00217     kTrack,
00218     kType,
00219     kU,
00220     kUl,
00221     kValuetype,
00222     kVar,
00223     kVideo,
00224     kWbr,
00225     kWidth,
00226     kWrap,
00227     kXmp,
00228     kNotAKeyword
00229   };
00230 
00236   HtmlName(Keyword keyword, const char* str)
00237       : keyword_(keyword), c_str_(str) {
00238   }
00239 
00242   Keyword keyword() const { return keyword_; }
00243 
00245   const char* c_str() const { return c_str_; }
00246 
00251   class Iterator {
00252    public:
00253     Iterator() : index_(-1) { Next(); }
00254     bool AtEnd() const;
00255     void Next();
00256     Keyword keyword() const;
00257     const char* name() const;
00258 
00259    private:
00260     int index_;
00261 
00263   };
00264 
00265   static int num_keywords();
00266   static Keyword Lookup(const StringPiece& name);
00267 
00268  private:
00269   friend class HtmlNameTest;
00270 
00271   Keyword keyword_;
00272   const char* c_str_;
00273 
00275 };
00276 
00277 }  
00278 
00279 #endif  ///< NET_INSTAWEB_HTMLPARSE_PUBLIC_HTML_NAME_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines