Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
url_left_trim_filter.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_REWRITER_PUBLIC_URL_LEFT_TRIM_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_URL_LEFT_TRIM_FILTER_H_
21 
27 
28 namespace net_instaweb {
29 class GoogleUrl;
30 class MessageHandler;
31 class RewriteDriver;
32 class Statistics;
33 class Variable;
34 
48  public:
49  UrlLeftTrimFilter(RewriteDriver* rewrite_driver, Statistics* stats);
50  virtual ~UrlLeftTrimFilter();
51 
52  static void InitStats(Statistics* statistics);
53  virtual void StartDocumentImpl() {}
54  virtual void StartElementImpl(HtmlElement* element);
55  virtual void EndElementImpl(HtmlElement* element) {}
56 
57  virtual const char* Name() const { return "UrlLeftTrim"; }
58 
64  static bool Trim(const GoogleUrl& base_url, const StringPiece& url_to_trim,
65  GoogleString* trimmed_url, MessageHandler* handler);
66 
67  private:
68  void TrimAttribute(HtmlElement::Attribute* attr);
69  void ClearBaseUrl();
70 
71  friend class UrlLeftTrimFilterTest;
72 
74  Variable* trim_count_;
75  Variable* trim_saved_bytes_;
76 
77 
78 };
79 
80 }
81 
82 #endif
class GoogleUrl
Definition: google_url.h:58
Definition: common_filter.h:47
Definition: html_element.h:66
Definition: statistics.h:43
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
static bool Trim(const GoogleUrl &base_url, const StringPiece &url_to_trim, GoogleString *trimmed_url, MessageHandler *handler)
Definition: url_left_trim_filter.h:47
Definition: html_element.h:42
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: url_left_trim_filter.h:57
Definition: rewrite_driver.h:100
Definition: message_handler.h:39
const GoogleUrl & base_url() const
Getters.
virtual void StartDocumentImpl()
Definition: url_left_trim_filter.h:53