Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
file_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 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_HTMLPARSE_PUBLIC_FILE_DRIVER_H_
20 #define NET_INSTAWEB_HTMLPARSE_PUBLIC_FILE_DRIVER_H_
21 
26 
27 namespace net_instaweb {
28 
29 class FileSystem;
30 class HtmlParse;
31 class MessageHandler;
32 class StatisticsLog;
33 
36 class FileDriver {
37  public:
38  FileDriver(HtmlParse* html_parse, FileSystem* file_system);
39 
41  HtmlParse* html_parse() { return html_parse_; }
42 
46  static bool GenerateOutputFilename(
47  const char* infilename, GoogleString* outfilename);
48 
52  static bool GenerateStatsFilename(
53  const char* infilename, GoogleString* statsfilename);
54 
57  bool ParseFile(const char* infilename,
58  const char* outfilename,
59  const char* statsfilename,
60  MessageHandler* handler);
61 
63  void set_flush_byte_count(int x) { flush_byte_count_ = x; }
64 
65  private:
66  HtmlParse* html_parse_;
67  LoggingFilter logging_filter_;
68  StatisticsLog* stats_log_;
69  HtmlWriterFilter html_write_filter_;
70  bool filters_added_;
71  FileSystem* file_system_;
72  int flush_byte_count_;
73 
74 
75 };
76 
77 }
78 
79 #endif
bool ParseFile(const char *infilename, const char *outfilename, const char *statsfilename, MessageHandler *handler)
void set_flush_byte_count(int x)
Indicates that we should Flush the parser every x bytes. Disabled if x<=0.
Definition: file_driver.h:63
Definition: html_parse.h:88
Definition: file_driver.h:36
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: statistics_log.h:26
static bool GenerateStatsFilename(const char *infilename, GoogleString *statsfilename)
Definition: file_system.h:76
Definition: message_handler.h:39
Filter that serializes HTML to a Writer stream.
Definition: html_writer_filter.h:36
Counts some basic statistics observed as HTML is parsed.
Definition: logging_html_filter.h:57
static bool GenerateOutputFilename(const char *infilename, GoogleString *outfilename)
HtmlParse * html_parse()
Return the parser. This can be used to add filters.
Definition: file_driver.h:41