#include "resource_namer.h"
Public Member Functions | |
bool | Decode (const StringPiece &encoded_string) |
Encoding and decoding in various formats. | |
GoogleString | Encode () const |
GoogleString | EncodeIdName () const |
int | EventualSize (const Hasher &hasher) const |
Note: there is no need at this time to decode the name key. | |
StringPiece | id () const |
Simple getters. | |
StringPiece | name () const |
StringPiece | hash () const |
StringPiece | ext () const |
void | set_id (const StringPiece &p) |
Simple setters. | |
void | set_name (const StringPiece &n) |
void | set_hash (const StringPiece &h) |
void | set_ext (const StringPiece &e) |
void | ClearHash () |
Other setter-like operations. | |
void | CopyFrom (const ResourceNamer &other) |
GoogleString | PrettyName () const |
Utility functions. | |
const ContentType * | ContentTypeFromExt () const |
Compute a content-type based on ext(). NULL if unrecognized. | |
Static Public Attributes | |
static const int | kOverhead |
Encapsulates the naming of resource URL leafs. The class holds the context of a single resource, and is not intended for re-use. We could, of course, add a Clear(), but it is a stateful class.
bool net_instaweb::ResourceNamer::Decode | ( | const StringPiece & | encoded_string | ) |
Encoding and decoding in various formats.
Decodes an entire resource name (NAME.pagespeed.ID.HASH.EXT), placing the result in the fields in this encoder.
GoogleString net_instaweb::ResourceNamer::Encode | ( | ) | const |
Encodes the fields in this encoder into an absolute url, with the trailing portion "NAME.pagespeed.ID.HASH.EXT".
GoogleString net_instaweb::ResourceNamer::EncodeIdName | ( | ) | const |
Encode a key that can used to do a lookup based on an id and the name. This key can be used to find the hash-code for a resource within the origin TTL.
The 'id' is a short code indicating which Instaweb rewriter was used to generate the resource.
int net_instaweb::ResourceNamer::EventualSize | ( | const Hasher & | hasher | ) | const |
Note: there is no need at this time to decode the name key.
Eventual length of name. Gets eventual hash length from passed in hasher. Needed by ResourceManager to check that filenames aren't too long.
GoogleString net_instaweb::ResourceNamer::PrettyName | ( | ) | const [inline] |
Utility functions.
Name suitable for debugging and logging
void net_instaweb::ResourceNamer::set_ext | ( | const StringPiece & | e | ) | [inline] |
const int net_instaweb::ResourceNamer::kOverhead [static] |
This determines the overhead imposed on each URL by the ResourceNamer syntax, such as separators.