Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
url_to_filename_encoder.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  */
70 
71 #ifndef PAGESPEED_KERNEL_UTIL_URL_TO_FILENAME_ENCODER_H_
72 #define PAGESPEED_KERNEL_UTIL_URL_TO_FILENAME_ENCODER_H_
73 
74 #include <cstddef>
75 
78 
79 namespace net_instaweb {
80 
83  public:
90  static void EncodeSegment(
91  const StringPiece& filename_prefix,
92  const StringPiece& escaped_ending,
93  char dir_separator,
94  GoogleString* encoded_filename);
95 
102  static bool Decode(const StringPiece& encoded_filename,
103  GoogleString* decoded_url);
104 
105 
106  static const char kEscapeChar;
107  static const char kTruncationChar;
108  static const size_t kMaximumSubdirectoryLength;
109 
110  friend class UrlToFilenameEncoderTest;
111 
112  private:
120  static void AppendSegment(
121  GoogleString* segment,
122  GoogleString* dest);
123 };
124 
125 }
126 
127 #endif
static void EncodeSegment(const StringPiece &filename_prefix, const StringPiece &escaped_ending, char dir_separator, GoogleString *encoded_filename)
Helper class for converting a URL into a filename.
Definition: url_to_filename_encoder.h:82
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
static bool Decode(const StringPiece &encoded_filename, GoogleString *decoded_url)