Page Speed Optimization Libraries  1.4.26.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     kNoframes,
00149     kNohref,
00150     kNoresize,
00151     kNoscript,
00152     kNovalidate,
00153     kObject,
00154     kOl,
00155     kOnclick,
00156     kOnload,
00157     kOpen,
00158     kOptgroup,
00159     kOption,
00160     kOther,
00161     kP,
00162     kPagespeedBlankSrc,
00163     kPagespeedHighResSrc,
00164     kPagespeedIframe,
00165     kPagespeedInlineSrc,
00166     kPagespeedLazySrc,
00167     kPagespeedLowResSrc,
00168     kPagespeedLscExpiry,
00169     kPagespeedLscHash,
00170     kPagespeedLscUrl,
00171     kPagespeedNoDefer,
00172     kPagespeedNoTransform,
00173     kPagespeedOrigSrc,
00174     kPagespeedOrigType,
00175     kPagespeedSize,
00176     kPagespeedUrlHash,
00177     kParam,
00178     kPre,
00179     kProfile,
00180     kQ,
00181     kReadonly,
00182     kRel,
00183     kRequired,
00184     kReversed,
00185     kRowspan,
00186     kRp,
00187     kRt,
00188     kRuby,
00189     kS,
00190     kSamp,
00191     kScoped,
00192     kScript,
00193     kScrolling,
00194     kSeamless,
00195     kSection,
00196     kSelect,
00197     kSelected,
00198     kShape,
00199     kSmall,
00200     kSource,
00201     kSpan,
00202     kSrc,
00203     kStrong,
00204     kStyle,
00205     kSub,
00206     kTable,
00207     kTag,
00208     kTbody,
00209     kTd,
00210     kTest,
00211     kTextarea,
00212     kTfoot,
00213     kTh,
00214     kThead,
00215     kTime,
00216     kTitle,
00217     kTr,
00218     kTrack,
00219     kType,
00220     kU,
00221     kUl,
00222     kValuetype,
00223     kVar,
00224     kVideo,
00225     kWbr,
00226     kWidth,
00227     kWrap,
00228     kXmp,
00229     kNotAKeyword
00230   };
00231 
00237   HtmlName(Keyword keyword, const char* str)
00238       : keyword_(keyword), c_str_(str) {
00239   }
00240 
00243   Keyword keyword() const { return keyword_; }
00244 
00246   const char* c_str() const { return c_str_; }
00247 
00252   class Iterator {
00253    public:
00254     Iterator() : index_(-1) { Next(); }
00255     bool AtEnd() const;
00256     void Next();
00257     Keyword keyword() const;
00258     const char* name() const;
00259 
00260    private:
00261     int index_;
00262 
00264   };
00265 
00266   static int num_keywords();
00267   static Keyword Lookup(const StringPiece& name);
00268 
00269  private:
00270   friend class HtmlNameTest;
00271 
00272   Keyword keyword_;
00273   const char* c_str_;
00274 
00276 };
00277 
00278 }  
00279 
00280 #endif  ///< NET_INSTAWEB_HTMLPARSE_PUBLIC_HTML_NAME_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines