Logo Search packages:      
Sourcecode: djvulibre version File versions

GURL Class Reference

#include <GURL.h>

List of all members.

Detailed Description

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.

Definition at line 119 of file GURL.h.

Public Member Functions

void add_djvu_cgi_argument (const GUTF8String &name, const char *value=0)
GURL base (void) const
int cgi_arguments (void) const
GUTF8String cgi_name (int num) const
DArray< GUTF8Stringcgi_names (void) const
GUTF8String cgi_value (int num) const
DArray< GUTF8Stringcgi_values (void) const
void clear_all_arguments (void)
 Erases everything after the first '#' or '?'.
void clear_cgi_arguments (void)
 Erases all CGI arguments (following the first '?').
void clear_djvu_cgi_arguments (void)
 Erases DjVu CGI arguments (following "#DJVUOPTS#").
void clear_hash_argument (void)
 Erases everything after the first '#'.
int cleardir (const int timeout=0) const
int deletefile (void) const
int djvu_cgi_arguments (void) const
GUTF8String djvu_cgi_name (int num) const
DArray< GUTF8Stringdjvu_cgi_names (void) const
GUTF8String djvu_cgi_value (int num) const
DArray< GUTF8Stringdjvu_cgi_values (void) const
GUTF8String extension (void) const
 Returns the extention part of name of document in this URL.
 Filename (const GNativeString &filename)
 Filename (const GUTF8String &filename)
GUTF8String fname (void) const
GURL follow_symlinks (void) const
 Follows symbolic links.
GUTF8String get_string (const bool nothrow=false) const
GUTF8String get_string (const GUTF8String &useragent) const
 GURL (const GURL &gurl)
 Copy constructor.
 GURL (const GNativeString &xurl, const GURL &codebase)
 GURL (const GUTF8String &xurl, const GURL &codebase)
 GURL (const GNativeString &url_string)
 GURL (const GUTF8String &url_string)
GUTF8String hash_argument (void) const
bool is_dir (void) const
 Test if this url is an existing directory.
bool is_file (void) const
 Test if this url is an existing file.
bool is_local_file_url (void) const
 Checks if the URL is local (starts from file:/#) or not.
bool is_local_path (void) const
 Test if this url is an existing file, directory, or device.
GList< GURLlistdir (void) const
 List the contents of a directory.
int mkdir (void) const
 Creates the specified directory.
GUTF8String name (void) const
 Native (const GNativeString &filename)
 Native (const GNativeString &xurl, const GURL &codebase)
 Native (const GNativeString &xurl)
GNativeString NativeFilename (void) const
 Same but returns a native string.
 operator const char * (void) const
 Returns Internal URL representation.
GURLoperator= (const GURL &url)
 Assignment operator.
bool operator== (const GURL &gurl2) const
 Returns TRUE if gurl1# and gurl2# are the same.
GUTF8String pathname (void) const
 Returns the aboslute URL without the host part.
int renameto (const GURL &newurl) const
 Rename a file or directory.
void set_hash_argument (const GUTF8String &arg)
 UTF8 (const GUTF8String &filename)
 UTF8 (const GUTF8String &xurl, const GURL &codebase)
 UTF8 (const GUTF8String &xurl)
GUTF8String UTF8Filename (void) const
virtual ~GURL (void)
 The destructor.
Files #"GURL.h"# and #"GURL.cpp"# contain the implementation of the {GURL} class used to store URLs in a system independent format. System independent URL representation.
Andrei Erofeev <eaf@geocities.com>
From: Leon Bottou, 1/31/2002 This has been heavily changed by Lizardtech. They decided to use URLs for everyting, including the most basic file access. The URL class now is a unholy mixture of code for syntactically parsing the urls (which is was) and file status code (only for local file: urls).

GURL.h,v 1.13 2008/01/27 11:36:27 leonb Exp

bool is_empty (void) const
 Checks if this is an empty URL.
bool is_valid (void) const
 Test if the URL is valid. If invalid, reinitialize.
bool operator!= (const GURL &gurl2) const
 Returns TRUE if gurl1# and gurl2# are different.
GUTF8String protocol (void) const
 Extracts the {protocol} part from the URL and returns it.

Static Public Member Functions

static GUTF8String decode_reserved (const GUTF8String &url)
static GUTF8String encode_reserved (const GUTF8String &gs)
 Escape special characters.
static GUTF8String expand_name (const GUTF8String &filename, const char *fromdirname=0)

Protected Member Functions

void beautify_path (void)
void convert_slashes (void)
void init (const bool nothrow=false)
void parse_cgi_args (void)
void store_cgi_args (void)
Accept the string URL, check that it starts from file:/# or http:/# and convert to internal system independent representation.

 GURL (const char *url_string)

Static Protected Member Functions

static GUTF8String beautify_path (GUTF8String url)
static GUTF8String protocol (const GUTF8String &url)

Protected Attributes

DArray< GUTF8Stringcgi_name_arr
DArray< GUTF8Stringcgi_value_arr
GUTF8String url
bool validurl

Private Attributes

GCriticalSection class_lock


unsigned int hash (const GURL &gurl)

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

Generated by  Doxygen 1.6.0   Back to index