Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scan_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 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 NET_INSTAWEB_REWRITER_PUBLIC_SCAN_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_SCAN_FILTER_H_
21 
23 
24 namespace net_instaweb {
25 
26 class HtmlCdataNode;
27 class HtmlCharactersNode;
28 class HtmlCommentNode;
29 class HtmlDirectiveNode;
30 class HtmlElement;
31 class HtmlIEDirectiveNode;
32 class RewriteDriver;
33 
40 class ScanFilter : public EmptyHtmlFilter {
41  public:
42  explicit ScanFilter(RewriteDriver* driver);
43  virtual ~ScanFilter();
44 
45  virtual void StartDocument();
46  virtual void StartElement(HtmlElement* element);
47  virtual void EndElement(HtmlElement* element);
48  virtual void Cdata(HtmlCdataNode* cdata);
49  virtual void Comment(HtmlCommentNode* comment);
50  virtual void IEDirective(HtmlIEDirectiveNode* directive);
51  virtual void Characters(HtmlCharactersNode* characters);
52  virtual void Directive(HtmlDirectiveNode* directive);
53  virtual void Flush();
54 
55  virtual const char* Name() const { return "Scan"; }
56 
57  private:
58  RewriteDriver* driver_;
59  bool seen_any_nodes_;
60  bool seen_refs_;
61  bool seen_base_;
62  bool seen_meta_tag_charset_;
63 };
64 
65 }
66 
67 #endif
virtual void Directive(HtmlDirectiveNode *directive)
Called for HTML directives (e.g. <!doctype foobar>).
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: scan_filter.h:55
Leaf node representing raw characters in HTML.
Definition: html_node.h:167
Definition: empty_html_filter.h:37
virtual void Characters(HtmlCharactersNode *characters)
Called for raw characters between tags.
Definition: html_element.h:42
virtual void IEDirective(HtmlIEDirectiveNode *directive)
Leaf node representing an HTML comment.
Definition: html_node.h:193
Definition: scan_filter.h:40
virtual void Cdata(HtmlCdataNode *cdata)
Called for CDATA blocks (e.g. <![CDATA[foobar]]>)
virtual void StartElement(HtmlElement *element)
Definition: rewrite_driver.h:100
virtual void StartDocument()
Leaf node representing an HTML directive.
Definition: html_node.h:233
virtual void Comment(HtmlCommentNode *comment)
Called for HTML comments that aren't IE directives (e.g. ).
Leaf node representing a CDATA section.
Definition: html_node.h:147
Leaf node representing an HTML IE directive.
Definition: html_node.h:213