camel-url

camel-url

Synopsis

struct              CamelURL;
enum                CamelURLFlags;
#define             CAMEL_URL_HIDE_ALL
CamelURL *          camel_url_new_with_base             (CamelURL *base,
                                                         const gchar *url_string);
CamelURL *          camel_url_new                       (const gchar *url_string,
                                                         GError **error);
gchar *             camel_url_to_string                 (CamelURL *url,
                                                         CamelURLFlags flags);
void                camel_url_free                      (CamelURL *url);
gchar *             camel_url_encode                    (const gchar *part,
                                                         const gchar *escape_extra);
void                camel_url_decode                    (gchar *part);
gchar *             camel_url_decode_path               (const gchar *path);
void                camel_url_set_protocol              (CamelURL *url,
                                                         const gchar *protocol);
void                camel_url_set_user                  (CamelURL *url,
                                                         const gchar *user);
void                camel_url_set_authmech              (CamelURL *url,
                                                         const gchar *authmech);
void                camel_url_set_host                  (CamelURL *url,
                                                         const gchar *host);
void                camel_url_set_port                  (CamelURL *url,
                                                         gint port);
void                camel_url_set_path                  (CamelURL *url,
                                                         const gchar *path);
void                camel_url_set_param                 (CamelURL *url,
                                                         const gchar *name,
                                                         const gchar *value);
void                camel_url_set_query                 (CamelURL *url,
                                                         const gchar *query);
void                camel_url_set_fragment              (CamelURL *url,
                                                         const gchar *fragment);
const gchar *       camel_url_get_param                 (CamelURL *url,
                                                         const gchar *name);
guint               camel_url_hash                      (gconstpointer v);
gint                camel_url_equal                     (gconstpointer v,
                                                         gconstpointer v2);
CamelURL *          camel_url_copy                      (CamelURL *in);

Description

Details

struct CamelURL

struct CamelURL {
	gchar  *protocol;
	gchar  *user;
	gchar  *authmech;
	gchar  *host;
	gint    port;
	gchar  *path;
	GData *params;
	gchar  *query;
	gchar  *fragment;
};

enum CamelURLFlags

typedef enum {
	CAMEL_URL_HIDE_PARAMS = 1 << 0,
	CAMEL_URL_HIDE_AUTH = 1 << 1
} CamelURLFlags;

CAMEL_URL_HIDE_PARAMS

CAMEL_URL_HIDE_AUTH


CAMEL_URL_HIDE_ALL

#define             CAMEL_URL_HIDE_ALL

camel_url_new_with_base ()

CamelURL *          camel_url_new_with_base             (CamelURL *base,
                                                         const gchar *url_string);

Parses url_string relative to base.

base :

a base URL

url_string :

the URL

Returns :

a parsed CamelURL

camel_url_new ()

CamelURL *          camel_url_new                       (const gchar *url_string,
                                                         GError **error);

Parses an absolute URL.

url_string :

a URL string

error :

return location for a GError, or NULL

Returns :

a CamelURL if it can be parsed, or NULL otherwise

camel_url_to_string ()

gchar *             camel_url_to_string                 (CamelURL *url,
                                                         CamelURLFlags flags);

Flatten a CamelURL into a string.

url :

a CamelURL

flags :

additional translation options

Returns :

a string representing url, which the caller must free

camel_url_free ()

void                camel_url_free                      (CamelURL *url);

Frees url.

url :

a CamelURL

camel_url_encode ()

gchar *             camel_url_encode                    (const gchar *part,
                                                         const gchar *escape_extra);

This -encodes the given URL part and returns the escaped version in allocated memory, which the caller must free when it is done.

part :

a URL part

escape_extra :

additional characters beyond " \"%#<>{}|\^[]`" to escape (or NULL)

Returns :

the encoded string

camel_url_decode ()

void                camel_url_decode                    (gchar *part);

-decodes the passed-in URL *in place*. The decoded version is never longer than the encoded version, so there does not need to be any additional space at the end of the string.

part :

a URL part

camel_url_decode_path ()

gchar *             camel_url_decode_path               (const gchar *path);

camel_url_set_protocol ()

void                camel_url_set_protocol              (CamelURL *url,
                                                         const gchar *protocol);

Set the protocol of a CamelURL.

url :

a CamelURL

protocol :

protocol schema

camel_url_set_user ()

void                camel_url_set_user                  (CamelURL *url,
                                                         const gchar *user);

Set the user of a CamelURL.

url :

a CamelURL

user :

username

camel_url_set_authmech ()

void                camel_url_set_authmech              (CamelURL *url,
                                                         const gchar *authmech);

Set the authmech of a CamelURL.

url :

a CamelURL

authmech :

authentication mechanism

camel_url_set_host ()

void                camel_url_set_host                  (CamelURL *url,
                                                         const gchar *host);

Set the hostname of a CamelURL.

url :

a CamelURL

host :

hostname

camel_url_set_port ()

void                camel_url_set_port                  (CamelURL *url,
                                                         gint port);

Set the port on a CamelURL.

url :

a CamelURL

port :

port

camel_url_set_path ()

void                camel_url_set_path                  (CamelURL *url,
                                                         const gchar *path);

Set the path component of a CamelURL.

url :

a CamelURL

path :

path

camel_url_set_param ()

void                camel_url_set_param                 (CamelURL *url,
                                                         const gchar *name,
                                                         const gchar *value);

Set a param on the CamelURL.

url :

a CamelURL

name :

name of the param to set

value :

value of the param to set

camel_url_set_query ()

void                camel_url_set_query                 (CamelURL *url,
                                                         const gchar *query);

Set the query of a CamelURL.

url :

a CamelURL

query :

url query

camel_url_set_fragment ()

void                camel_url_set_fragment              (CamelURL *url,
                                                         const gchar *fragment);

Set the fragment of a CamelURL.

url :

a CamelURL

fragment :

url fragment

camel_url_get_param ()

const gchar *       camel_url_get_param                 (CamelURL *url,
                                                         const gchar *name);

Get the value of the specified param on the URL.

url :

a CamelURL

name :

name of the param

Returns :

the value of a param if found or NULL otherwise

camel_url_hash ()

guint               camel_url_hash                      (gconstpointer v);

camel_url_equal ()

gint                camel_url_equal                     (gconstpointer v,
                                                         gconstpointer v2);

camel_url_copy ()

CamelURL *          camel_url_copy                      (CamelURL *in);

Copy a CamelURL.

in :

a CamelURL to copy

Returns :

a duplicate copy of in