Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
file_load_policy.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_FILE_LOAD_POLICY_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_FILE_LOAD_POLICY_H_
21 
22 #include <list>
27 
28 namespace net_instaweb {
29 
30 class GoogleUrl;
31 class FileLoadMapping;
32 class FileLoadRule;
33 
42  public:
43  FileLoadPolicy() {}
44  virtual ~FileLoadPolicy();
45 
48  virtual bool ShouldLoadFromFile(const GoogleUrl& url,
49  GoogleString* filename) const;
50 
58  virtual void Associate(StringPiece url_prefix, StringPiece filename_prefix);
59 
74  virtual bool AssociateRegexp(StringPiece url_regexp,
75  StringPiece filename_prefix,
76  GoogleString* error);
77 
108  virtual bool AddRule(const GoogleString& rule, bool is_regexp, bool allowed,
109  GoogleString* error);
110 
112  virtual void Merge(const FileLoadPolicy& other);
113 
114  protected:
115  virtual bool ShouldLoadFromFileHelper(const GoogleUrl& url,
116  GoogleString* filename) const;
117 
118  private:
119  typedef std::list<FileLoadMapping*> FileLoadMappings;
120  FileLoadMappings file_load_mappings_;
121  typedef std::list<FileLoadRule*> FileLoadRules;
122  FileLoadRules file_load_rules_;
123 
124 
125 };
126 
127 }
128 
129 #endif
130 
class GoogleUrl
Definition: google_url.h:58
virtual void Merge(const FileLoadPolicy &other)
Merge in other policies (needed for rewrite_options).
virtual bool ShouldLoadFromFile(const GoogleUrl &url, GoogleString *filename) const
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: file_load_policy.h:41
virtual void Associate(StringPiece url_prefix, StringPiece filename_prefix)
virtual bool AssociateRegexp(StringPiece url_regexp, StringPiece filename_prefix, GoogleString *error)
virtual bool AddRule(const GoogleString &rule, bool is_regexp, bool allowed, GoogleString *error)