Page Speed Optimization Libraries  1.7.30.4
net/instaweb/htmlparse/public/file_driver.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_FILE_DRIVER_H_
00020 #define NET_INSTAWEB_HTMLPARSE_PUBLIC_FILE_DRIVER_H_
00021 
00022 #include "net/instaweb/htmlparse/public/html_writer_filter.h"
00023 #include "net/instaweb/htmlparse/public/logging_html_filter.h"
00024 #include "pagespeed/kernel/base/basictypes.h"
00025 #include "pagespeed/kernel/base/string.h"
00026 
00027 namespace net_instaweb {
00028 
00029 class FileSystem;
00030 class HtmlParse;
00031 class MessageHandler;
00032 class StatisticsLog;
00033 
00036 class FileDriver {
00037  public:
00038   FileDriver(HtmlParse* html_parse, FileSystem* file_system);
00039 
00041   HtmlParse* html_parse() { return html_parse_; }
00042 
00046   static bool GenerateOutputFilename(
00047       const char* infilename, GoogleString* outfilename);
00048 
00052   static bool GenerateStatsFilename(
00053       const char* infilename, GoogleString* statsfilename);
00054 
00057   bool ParseFile(const char* infilename,
00058                  const char* outfilename,
00059                  const char* statsfilename,
00060                  MessageHandler* handler);
00061 
00063   void set_flush_byte_count(int x) { flush_byte_count_ = x; }
00064 
00065  private:
00066   HtmlParse* html_parse_;
00067   LoggingFilter logging_filter_;
00068   StatisticsLog* stats_log_;
00069   HtmlWriterFilter html_write_filter_;
00070   bool filters_added_;
00071   FileSystem* file_system_;
00072   int flush_byte_count_;
00073 
00074   DISALLOW_COPY_AND_ASSIGN(FileDriver);
00075 };
00076 
00077 }  
00078 
00079 #endif  ///< NET_INSTAWEB_HTMLPARSE_PUBLIC_FILE_DRIVER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines