net_instaweb::GoogleUrl Class Reference

List of all members.

Public Member Functions

 GoogleUrl (const GoogleString &spec)
 GoogleUrl (const StringPiece &sp)
 GoogleUrl (const char *str)
 GoogleUrl (const GoogleUrl &base, const GoogleString &relative)
 GoogleUrl (const GoogleUrl &base, const StringPiece &relative)
 GoogleUrl (const GoogleUrl &base, const char *relative)
void Swap (GoogleUrl *google_url)
bool Reset (const StringPiece &new_url)
bool Reset (const GoogleUrl &new_url)
bool Reset (const GoogleUrl &base, const GoogleString &relative)
bool Reset (const GoogleUrl &base, const StringPiece &relative)
bool Reset (const GoogleUrl &base, const char *relative)
void Clear ()
 Resets this URL to be invalid.
GoogleUrlCopyAndAddQueryParam (const StringPiece &name, const StringPiece &value)
StringPiece AllExceptQuery () const
StringPiece AllAfterQuery () const
StringPiece AllExceptLeaf () const
StringPiece LeafWithQuery () const
StringPiece LeafSansQuery () const
StringPiece PathAndLeaf () const
StringPiece PathSansLeaf () const
StringPiece PathSansQuery () const
GoogleString ExtractFileName () const
StringPiece Host () const
StringPiece HostAndPort () const
StringPiece Origin () const
StringPiece Query () const
StringPiece Scheme () const
 Returns scheme of stored url.
StringPiece Spec () const
 It is illegal to call this for invalid urls (i.e. check is_valid() first).
StringPiece UncheckedSpec () const
 Returns gurl_.spec_ without checking to see if it's valid or empty.
const char * spec_c_str () const
 This method is primarily for printf purposes.
int IntPort () const
int EffectiveIntPort () const
 Returns the effective port number, which is dependent on the scheme.
bool is_valid () const
 Returns validity of stored url.
bool is_standard () const
bool is_empty () const
bool has_scheme () const
bool has_path () const
bool has_query () const
bool SchemeIs (const char *lower_ascii_scheme) const
bool SchemeIs (const StringPiece &lower_ascii_scheme) const
bool operator== (const GoogleUrl &other) const
 Defiant equality operator!
bool operator!= (const GoogleUrl &other) const

Constructor & Destructor Documentation

net_instaweb::GoogleUrl::GoogleUrl ( const GoogleUrl base,
const GoogleString relative 
)

The following three constructors create a new GoogleUrl by resolving the String(Piece) against the base.


Member Function Documentation

StringPiece net_instaweb::GoogleUrl::AllAfterQuery (  )  const

For "http://a.com/b/c/d?e=f#r" returns "#r" For "http://a.com/b/c/d?e=f#r1#r2" returns "#r1#r2" AllExceptQuery() + Query() + AllAfterQuery() = Spec() when url is valid Different from Parsed.ref in the case of multiple "#"s after "?" Returns a StringPiece, only valid for the lifetime of this object.

StringPiece net_instaweb::GoogleUrl::AllExceptLeaf (  )  const

For "http://a.com/b/c/d?e=f/g" returns "http://a.com/b/c/", including trailing slash. Returns a StringPiece, only valid for the lifetime of this object.

StringPiece net_instaweb::GoogleUrl::AllExceptQuery (  )  const

For "http://a.com/b/c/d?e=f/g#r" returns "http://a.com/b/c/d" Returns a StringPiece, only valid for the lifetime of this object.

GoogleUrl* net_instaweb::GoogleUrl::CopyAndAddQueryParam ( const StringPiece &  name,
const StringPiece &  value 
)

Returns a new GoogleUrl that is identical to this one but with additional query param. Name and value should both be legal and already encoded. This is a factory method that returns a pointer, the caller is responsible for the management of the new object's memory (the caller owns the pointer).

GoogleString net_instaweb::GoogleUrl::ExtractFileName (  )  const

Extracts the filename portion of the path and returns it. The filename is everything after the last slash in the path. This may be empty.

StringPiece net_instaweb::GoogleUrl::HostAndPort (  )  const

For "http://a.com/b/c.html" returns "a.com". For "http://a.com:1234/b/c.html" returns "a.com:1234".

StringPiece net_instaweb::GoogleUrl::LeafSansQuery (  )  const

For "http://a.com/b/c/d?e=f/g" returns "d", omitting leading slash. Returns a StringPiece, only valid for the lifetime of this object.

StringPiece net_instaweb::GoogleUrl::LeafWithQuery (  )  const

For "http://a.com/b/c/d?e=f/g" returns "d?e=f/g", omitting leading slash. Returns a StringPiece, only valid for the lifetime of this object.

StringPiece net_instaweb::GoogleUrl::Origin (  )  const

For "http://a.com/b/c/d?e=f/g returns "http://a.com" without trailing slash Returns a StringPiece, only valid for the lifetime of this object.

StringPiece net_instaweb::GoogleUrl::PathAndLeaf (  )  const

For "http://a.com/b/c/d?E=f/g" returns "/b/c/d?e=f/g" including leading slash Returns a StringPiece, only valid for the lifetime of this object.

StringPiece net_instaweb::GoogleUrl::PathSansLeaf (  )  const

For "http://a.com/b/c/d/g.html" returns "/b/c/d/" including leading and trailing slashes. For queries, "http://a.com/b/c/d?E=f/g" returns "/b/c/". Returns a StringPiece, only valid for the lifetime of this object.

StringPiece net_instaweb::GoogleUrl::PathSansQuery (  )  const

For "http://a.com/b/c/d?E=f/g returns "/b/c/d" including leading slash, and excluding the query.

bool net_instaweb::GoogleUrl::SchemeIs ( const StringPiece &  lower_ascii_scheme  )  const [inline]
Todo:
TODO(nforman): get GURL to take a StringPiece so we don't have to do any copying.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:11 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3