Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compute_visible_text_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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_COMPUTE_VISIBLE_TEXT_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_COMPUTE_VISIBLE_TEXT_FILTER_H_
21 
23 #include "net/instaweb/htmlparse/public/html_writer_filter.h"
26 
27 namespace net_instaweb {
28 
29 class HtmlCdataNode;
30 class HtmlCharactersNode;
31 class HtmlCommentNode;
32 class HtmlDirectiveNode;
33 class HtmlElement;
34 class HtmlIEDirectiveNode;
35 class RewriteDriver;
36 
46 class ComputeVisibleTextFilter : public HtmlWriterFilter {
47  public:
48  explicit ComputeVisibleTextFilter(RewriteDriver* rewrite_driver);
49  virtual ~ComputeVisibleTextFilter();
50 
51  virtual void StartDocument();
52  virtual void StartElement(HtmlElement* element);
53  virtual void EndElement(HtmlElement* element);
54  virtual void Cdata(HtmlCdataNode* cdata);
55  virtual void Characters(HtmlCharactersNode* characters);
56  virtual void Comment(HtmlCommentNode* comment);
57  virtual void IEDirective(HtmlIEDirectiveNode* directive);
58  virtual void Directive(HtmlDirectiveNode* directive);
59  virtual void EndDocument();
60  virtual const char* Name() const { return "ComputeVisibleTextFilter"; }
61 
62  private:
63  RewriteDriver* rewrite_driver_;
64  StringWriter writer_;
65  GoogleString buffer_;
66 
67  DISALLOW_COPY_AND_ASSIGN(ComputeVisibleTextFilter);
68 };
69 
70 }
71 
72 #endif
Definition: rewrite_driver.h:98
Definition: compute_visible_text_filter.h:46