class GURL

System independent URL representation.

Public Methods

[more]GString protocol(void) const
Extracts the protocol part from the URL and returns it
[more]GString hash_argument(void) const
Returns string after the first '#' with decoded escape sequences.
[more]void set_hash_argument(const char * arg)
Inserts the arg after a separating hash into the URL.
[more]int cgi_arguments(void) const
Returns the total number of CGI arguments in the URL.
[more]int djvu_cgi_arguments(void) const
Returns the total number of DjVu-related CGI arguments (arguments following DJVUOPTS in the URL).
[more]GString cgi_name(int num) const
Returns that part of CGI argument number num, which is before the equal sign.
[more]GString djvu_cgi_name(int num) const
Returns that part of DjVu-related CGI argument number num, which is before the equal sign.
[more]GString cgi_value(int num) const
Returns that part of CGI argument number num, which is after the equal sign.
[more]GString djvu_cgi_value(int num) const
Returns that part of DjVu-related CGI argument number num, which is after the equal sign.
[more]DArray<GString> cgi_names(void) const
Returns array of all known CGI names (part of CGI argument before the equal sign)
[more]DArray<GString> djvu_cgi_names(void) const
Returns array of names of DjVu-related CGI arguments (arguments following DJVUOPTS option.
[more]DArray<GString> cgi_values(void) const
Returns array of all known CGI names (part of CGI argument before the equal sign)
[more]DArray<GString> djvu_cgi_values(void) const
Returns array of values of DjVu-related CGI arguments (arguments following DJVUOPTS option.
[more]void clear_all_arguments(void)
Erases everything after the first '#' or '?'
[more]void clear_hash_argument(void)
Erases everything after the first '#'
[more]void clear_djvu_cgi_arguments(void)
Erases DjVu CGI arguments (following "DJVUOPTS")
[more]void clear_cgi_arguments(void)
Erases all CGI arguments (following the first '?')
[more]void add_djvu_cgi_argument(const char * name, const char * value=0)
Appends the specified CGI argument.
[more]GURL base(void) const
Returns the URL corresponding to the directory containing the document with this URL.
[more]GString name(void) const
Returns the name part of this URL.
[more]GString fname(void) const
Returns the name part of this URL with escape sequences expanded.
[more]GString extension(void) const
Returns the extention part of name of document in this URL.
[more]bool is_empty(void) const
Checks if this is an empty URL
[more]bool is_local_file_url(void) const
Checks if the URL is local (starts from file:/) or not
[more]friend int operator==(const GURL & gurl1, const GURL & gurl2)
Returns TRUE if gurl1 and gurl2 are the same
[more]friend int operator!=(const GURL & gurl1, const GURL & gurl2)
Returns TRUE if gurl1 and gurl2 are different
[more]GURL& operator=(const GURL & url)
Assignment operator
[more] operator const char*(void) const
Returns Internal URL representation
[more] GURL(const GURL & gurl)
Copy constructor
[more]virtual ~GURL(void)
The descructor
[more]friend unsigned int hash(const GURL & gurl)
Hashing function.

Public

[more] Concatenation operators

[more]GURL operator+(const char * name) const
[more]GURL operator+(const GString & name) const

[more] Constructors

[more] GURL(const GString & url_string)
[more] GURL(const char * url_string=0)


Documentation

System independent URL representation.

This class is used in the library to store URLs in a system independent format. The idea to use a general class to hold URL arose after we realized, that DjVu had to be able to access files both from the WEB and from the local disk. While it is strange to talk about system independence of HTTP URLs, file names formats obviously differ from platform to platform. They may contain forward slashes, backward slashes, colons as separators, etc. There maybe more than one URL corresponding to the same file name. Compare file:/dir/file.djvu and file://localhost/dir/file.djvu.

To simplify a developer's life we have created this class, which contains inside a canonical representation of URLs.

File URLs are converted to internal format with the help of GOS class.

All other URLs are modified to contain only forward slashes.

oGString protocol(void) const
Extracts the protocol part from the URL and returns it

oGString hash_argument(void) const
Returns string after the first '#' with decoded escape sequences.

ovoid set_hash_argument(const char * arg)
Inserts the arg after a separating hash into the URL. The function encodes any illegal character in arg using encode_reserved().

oint cgi_arguments(void) const
Returns the total number of CGI arguments in the URL. CGI arguments follow '?' sign and are separated by '&' signs

oint djvu_cgi_arguments(void) const
Returns the total number of DjVu-related CGI arguments (arguments following DJVUOPTS in the URL).

oGString cgi_name(int num) const
Returns that part of CGI argument number num, which is before the equal sign.

oGString djvu_cgi_name(int num) const
Returns that part of DjVu-related CGI argument number num, which is before the equal sign.

oGString cgi_value(int num) const
Returns that part of CGI argument number num, which is after the equal sign.

oGString djvu_cgi_value(int num) const
Returns that part of DjVu-related CGI argument number num, which is after the equal sign.

oDArray<GString> cgi_names(void) const
Returns array of all known CGI names (part of CGI argument before the equal sign)

oDArray<GString> djvu_cgi_names(void) const
Returns array of names of DjVu-related CGI arguments (arguments following DJVUOPTS option.

oDArray<GString> cgi_values(void) const
Returns array of all known CGI names (part of CGI argument before the equal sign)

oDArray<GString> djvu_cgi_values(void) const
Returns array of values of DjVu-related CGI arguments (arguments following DJVUOPTS option.

ovoid clear_all_arguments(void)
Erases everything after the first '#' or '?'

ovoid clear_hash_argument(void)
Erases everything after the first '#'

ovoid clear_djvu_cgi_arguments(void)
Erases DjVu CGI arguments (following "DJVUOPTS")

ovoid clear_cgi_arguments(void)
Erases all CGI arguments (following the first '?')

ovoid add_djvu_cgi_argument(const char * name, const char * value=0)
Appends the specified CGI argument. Will insert "DJVUOPTS" if necessary

oGURL base(void) const
Returns the URL corresponding to the directory containing the document with this URL. The function basically takes the URL and clears everything after the last slash.

oGString name(void) const
Returns the name part of this URL. For example, if the URL is http: this function will return file%201.djvu. \Ref{fname}() willreturn file 1.djvu at the same time.

oGString fname(void) const
Returns the name part of this URL with escape sequences expanded. For example, if the URL is http: this function will return file 1.djvu. \Ref{name}() willreturn file%201.djvu at the same time.

oGString extension(void) const
Returns the extention part of name of document in this URL.

obool is_empty(void) const
Checks if this is an empty URL

obool is_local_file_url(void) const
Checks if the URL is local (starts from file:/) or not

o Concatenation operators
Concatenate the GURL with the passed name. If the name is absolute (has non empty protocol prefix), we just return GURL(name). Otherwise the name is appended to the GURL after a separating slash.

oGURL operator+(const char * name) const

oGURL operator+(const GString & name) const

ofriend int operator==(const GURL & gurl1, const GURL & gurl2)
Returns TRUE if gurl1 and gurl2 are the same

ofriend int operator!=(const GURL & gurl1, const GURL & gurl2)
Returns TRUE if gurl1 and gurl2 are different

oGURL& operator=(const GURL & url)
Assignment operator

o operator const char*(void) const
Returns Internal URL representation

o Constructors
Accept the string URL, check that it starts from file:/ or http:/ and convert to internal system independent representation.

o GURL(const GString & url_string)

o GURL(const char * url_string=0)

o GURL(const GURL & gurl)
Copy constructor

ovirtual ~GURL(void)
The descructor

ofriend unsigned int hash(const GURL & gurl)
Hashing function.
Returns:
hash suitable for usage in GMap


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.