SUrl Class Reference
[Utility Classes and Functions]

#include <support/URL.h>

List of all members.

Public Member Functions

status_t AddQueryParameter (const char *name, const char *value, bool escape_all=false)
SString AsString () const
SValue AsValue () const
bool Equals (const SUrl &url) const
bool Equals (const char *) const
const char * GetAction () const
const char * GetExtension () const
const char * GetFragment () const
const char * GetHostName () const
const char * GetPassword () const
const char * GetPath () const
unsigned short GetPort () const
const char * GetQuery () const
status_t GetQueryParameter (const char *name, SString *out_value) const
const char * GetScheme () const
void GetUnescapedFileName (char *out, int size) const
void GetUnescapedPath (char *out, int size) const
void GetUnescapedQuery (char *out, int size) const
const char * GetUserName () const
bool IsValid () const
 operator SValue () const
bool operator!= (const SUrl &url) const
SUrl & operator= (const SUrl &url)
SUrl & operator= (const char *url_string)
 This assignment operator is equivalent to SUrl::SetTo(url_string, false).
bool operator== (const char *urlString) const
bool operator== (const SUrl &url) const
void Print (SString *dump=NULL) const
status_t RemoveQueryParameter (const char *name)
status_t ReplaceQueryParameter (const char *name, const char *value, bool addIfNotPresent=true, bool escape_all=false)
void Reset ()
status_t SetAction (const char *action)
status_t SetFragment (const char *fragment)
status_t SetHostName (const char *hostname)
status_t SetInternetStyleSchemeSupport (char queryBeginChar= '?', char queryAssignmentChar= '=', char querySeperatorChar= '&')
status_t SetPassword (const char *password)
status_t SetPath (const char *path, bool escape_all=false)
status_t SetPort (int port)
status_t SetQuery (const char *query, bool escape_all=false)
 Set this URL's query to query.
status_t SetTo (const SValue &value)
status_t SetTo (const SUrl &baseURL, const char *relativePath, bool escape_all=false)
status_t SetTo (const char *urlString, bool escape_all=false)
status_t SetTo (const SUrl &url)
status_t SetUserName (const char *user)
 SUrl (const SValue &value, status_t *status=NULL)
 SUrl (const SUrl &baseURL, const char *relativePath, bool escape_all=false)
 SUrl (const char *scheme, const char *hostname, int port, bool escape_all=false, bool hierarchal=false)
 SUrl (const char *urlString, bool escape_all=false)
 SUrl (const SUrl &)
 SUrl ()
 ~SUrl ()

Static Public Member Functions

static char * EscapePathString (bool escape_all, char *outString, const char *inString, size_t inLen=0x7fffffff)
static char * EscapeQueryString (bool escape_all, char *outString, const char *inString, size_t inLen=0x7fffffff)
static int GetEscapedLength (const char *unescaped_string, size_t inLen=0x7fffffff)
static bool IsSchemeSupported (const char *scheme)


Constructor & Destructor Documentation

SUrl (   ) 
 

~SUrl (   ) 
 

SUrl (  const SUrl &   ) 
 

Parameters:
escape_all Set to true if you want to escape any "%"s and "+"s in the path, query, and strings. Set to false if those strings might already contain -escapes that you don't want escaped a second time. Any other characters that are unsafe in BUrls are -escaped in either case.

SUrl (  const char *  urlString,
bool  escape_all = false
) 
 

SUrl (  const char *  scheme,
const char *  hostname,
int  port,
bool  escape_all = false,
bool  hierarchal = false
) 
 

SUrl (  const SUrl &  baseURL,
const char *  relativePath,
bool  escape_all = false
) 
 

SUrl (  const SValue &  value,
status_t *  status = NULL
) 
 


Member Function Documentation

status_t AddQueryParameter (  const char *  name,
const char *  value,
bool  escape_all = false
) 
 

SString AsString (   )  const
 

SValue AsValue (   )  const
 

bool Equals (  const SUrl &  url  )  const
 

bool Equals (  const char *   )  const
 

Note:
Equals() does *not* consider the fragment, username, password, or query method. The resource cache depends on this so it doesn't store multiple copies of the same resource.

char * EscapePathString (  bool  escape_all,
char *  outString,
const char *  inString,
size_t  inLen = 0x7fffffff
)  [static]
 

EscapePathString() and EscapeQueryString():

Convert inString to a legal URL string by -escaping any characters that need it, and put the null-terminated result in outString.

EscapePathString() will escape "&"s. EscapeQueryString() will not. The RFC implies that escaping "&"s in paths should be harmless, though of dubious utility, but {a certain engineer who used to work at a certain unmentionable OS company} thought that doing so was important enough to merit a checkin comment, so that's what we do. In query strings, however, "&"s must not be escaped, as they have a special reserved meaning there. (Ref. for all of this: RFC 1738, sec. 2.2.)

Parameters:
escape_all Set to true if you want to escape any "%"s and "+"s in inString. Set to false if that string might already contain -escapes that you don't want escaped a second time. Any other characters that are unsafe in URLs are -escaped in either case.
outString Pointer to a buffer where you want the resulting escaped string. You must have previously allocated this buffer to be at least GetEscapedLength() + 1 bytes long.
inString The string that needs escaping.
inLen The length of inString that you want to escape. Useful if you want to escape a substring of inString, rather than everything up to the null terminator.
Returns:
A pointer to one past the null terminator of the resulting escaped string in outString.

char * EscapeQueryString (  bool  escape_all,
char *  outString,
const char *  inString,
size_t  inLen = 0x7fffffff
)  [static]
 

const char * GetAction (   )  const
 

int GetEscapedLength (  const char *  unescaped_string,
size_t  inLen = 0x7fffffff
)  [static]
 

Tells how long the string in unescaped_string will be after it has been -escaped.

const char * GetExtension (   )  const
 

const char * GetFragment (   )  const
 

const char * GetHostName (   )  const
 

const char * GetPassword (   )  const
 

const char * GetPath (   )  const
 

unsigned short GetPort (   )  const
 

const char * GetQuery (   )  const
 

status_t GetQueryParameter (  const char *  name,
SString *  out_value
)  const
 

const char * GetScheme (   )  const
 

void GetUnescapedFileName (  char *  out,
int  size
)  const
 

GetUnescapedFileName(), GetUnescapedPath(), GetUnescapedQuery(): Extract the filename, path, or query, converting any -escapes and "+"s appropriately.

Parameters:
out A buffer that you have allocated for the null-terminated result.
size The size of the buffer that you allocated. Note that this is the full size of the buffer, including the room for the null terminator.

void GetUnescapedPath (  char *  out,
int  size
)  const
 

void GetUnescapedQuery (  char *  out,
int  size
)  const
 

const char * GetUserName (   )  const
 

bool IsSchemeSupported (  const char *  scheme  )  [static]
 

bool IsValid (   )  const
 

operator SValue (   )  const [inline]
 

bool operator!= (  const SUrl &  url  )  const
 

SUrl & operator= (  const SUrl &  url  ) 
 

SUrl & operator= (  const char *  url_string  ) 
 

This assignment operator is equivalent to SUrl::SetTo(url_string, false).

bool operator== (  const char *  urlString  )  const
 

bool operator== (  const SUrl &  url  )  const
 

void Print (  SString *  dump = NULL  )  const
 

status_t RemoveQueryParameter (  const char *  name  ) 
 

status_t ReplaceQueryParameter (  const char *  name,
const char *  value,
bool  addIfNotPresent = true,
bool  escape_all = false
) 
 

void Reset (   ) 
 

status_t SetAction (  const char *  action  ) 
 

status_t SetFragment (  const char *  fragment  ) 
 

status_t SetHostName (  const char *  hostname  ) 
 

status_t SetInternetStyleSchemeSupport (  char  queryBeginChar = '?',
char  queryAssignmentChar = '=',
char  querySeperatorChar = '&'
) 
 

status_t SetPassword (  const char *  password  ) 
 

status_t SetPath (  const char *  path,
bool  escape_all = false
) 
 

status_t SetPort (  int  port  ) 
 

status_t SetQuery (  const char *  query,
bool  escape_all = false
) 
 

Set this URL's query to query.

status_t SetTo (  const SValue &  value  ) 
 

status_t SetTo (  const SUrl &  baseURL,
const char *  relativePath,
bool  escape_all = false
) 
 

status_t SetTo (  const char *  urlString,
bool  escape_all = false
) 
 

status_t SetTo (  const SUrl &  url  ) 
 

status_t SetUserName (  const char *  user  ) 
 


The documentation for this class was generated from the following files: