Page Speed Optimization Libraries  1.9.32.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>
24 #include "net/instaweb/util/public/gtest_prod.h"
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(const StringPiece& url_prefix,
59  const StringPiece& filename_prefix);
60 
75  virtual bool AssociateRegexp(const StringPiece& url_regexp,
76  const StringPiece& filename_prefix,
77  GoogleString* error);
78 
109  virtual bool AddRule(const GoogleString& rule, bool is_regexp, bool allowed,
110  GoogleString* error);
111 
113  virtual void Merge(const FileLoadPolicy& other);
114 
115  protected:
116  virtual bool ShouldLoadFromFileHelper(const GoogleUrl& url,
117  GoogleString* filename) const;
118 
119  private:
120  typedef std::list<FileLoadMapping*> FileLoadMappings;
121  FileLoadMappings file_load_mappings_;
122  typedef std::list<FileLoadRule*> FileLoadRules;
123  FileLoadRules file_load_rules_;
124 
125  DISALLOW_COPY_AND_ASSIGN(FileLoadPolicy);
126 };
127 
128 }
129 
130 #endif
virtual void Merge(const FileLoadPolicy &other)
Merge in other policies (needed for rewrite_options).
virtual bool ShouldLoadFromFile(const GoogleUrl &url, GoogleString *filename) const
virtual void Associate(const StringPiece &url_prefix, const StringPiece &filename_prefix)
Definition: file_load_policy.h:41
virtual bool AssociateRegexp(const StringPiece &url_regexp, const StringPiece &filename_prefix, GoogleString *error)
virtual bool AddRule(const GoogleString &rule, bool is_regexp, bool allowed, GoogleString *error)