Page Speed Optimization Libraries
1.6.29.3
|
Helper class for converting a URL into a filename. More...
#include "url_to_filename_encoder.h"
Static Public Member Functions | |
static void | EncodeSegment (const StringPiece &filename_prefix, const StringPiece &escaped_ending, char dir_separator, GoogleString *encoded_filename) |
static bool | Decode (const StringPiece &encoded_filename, char dir_separator, GoogleString *decoded_url) |
static GoogleString | Unescape (const StringPiece &escaped_url) |
Static Public Attributes | |
static const char | kEscapeChar |
static const char | kTruncationChar |
static const size_t | kMaximumSubdirectoryLength |
Friends | |
class | UrlToFilenameEncoderTest |
Helper class for converting a URL into a filename.
static bool net_instaweb::UrlToFilenameEncoder::Decode | ( | const StringPiece & | encoded_filename, |
char | dir_separator, | ||
GoogleString * | decoded_url | ||
) | [static] |
Decodes a filename that was encoded with EncodeSegment, yielding back the original URL.
static void net_instaweb::UrlToFilenameEncoder::EncodeSegment | ( | const StringPiece & | filename_prefix, |
const StringPiece & | escaped_ending, | ||
char | dir_separator, | ||
GoogleString * | encoded_filename | ||
) | [static] |
Encode a portion of URL to a form suitable for filenames. |filename_prefix| is prepended without escaping. |escaped_ending| is the URL to be encoded into a filename. It may have URL escaped characters (like %21 for !). |dir_separator| is "/" on Unix, "\" on Windows. |encoded_filename| is the resultant filename.
static GoogleString net_instaweb::UrlToFilenameEncoder::Unescape | ( | const StringPiece & | escaped_url | ) | [static] |
Unescape a url, converting all XX to the the actual char 0xXX. For example, this will convert "foo%21bar" to "foo!bar".
This will work with strings that have embedded NULLs.