SwfdecURL

SwfdecURL — URL handling in Swfdec

Synopsis




                    SwfdecURL;
SwfdecURL*          swfdec_url_copy                     (const SwfdecURL *url);
void                swfdec_url_free                     (SwfdecURL *url);
const char*         swfdec_url_get_host                 (const SwfdecURL *url);
const char*         swfdec_url_get_path                 (const SwfdecURL *url);
const char*         swfdec_url_get_protocol             (const SwfdecURL *url);
gboolean            swfdec_url_has_protocol             (const SwfdecURL *url,
                                                         const char *protocol);
const char*         swfdec_url_get_query                (const SwfdecURL *url);
const char*         swfdec_url_get_url                  (const SwfdecURL *url);
gboolean            swfdec_url_is_local                 (const SwfdecURL *url);
SwfdecURL*          swfdec_url_new                      (const char *string);
SwfdecURL*          swfdec_url_new_relative             (const SwfdecURL *url,
                                                         const char *string);

Description

SwfdecURL is Swfdec's way of handling URLs. You probably don't need to mess with this type unless you want to write a SwfdecLoader. In that case you will want to use swfdec_loader_get_url() to get its url and then use the functions in this section to access it.

see_also: SwfdecLoader

Details

SwfdecURL

typedef struct _SwfdecURL SwfdecURL;

this is the structure used for URLs. It is a boxed type to glib's type system and it is not reference counted. It is also a static struct in that it cannot be modified after creation.


swfdec_url_copy ()

SwfdecURL*          swfdec_url_copy                     (const SwfdecURL *url);

copies the given url.

url : a SwfdecURL
Returns : a new SwfdecURL

swfdec_url_free ()

void                swfdec_url_free                     (SwfdecURL *url);

Frees the URL and its associated ressources.

url : a SwfdecURL

swfdec_url_get_host ()

const char*         swfdec_url_get_host                 (const SwfdecURL *url);

Gets the host for url. If the host includes a portnumber, it will be present in the returned string.

url : a SwfdecURL
Returns : the host or NULL if none (typically for file URLs).

swfdec_url_get_path ()

const char*         swfdec_url_get_path                 (const SwfdecURL *url);

Gets the path associated with url. If it contains no path, NULL is returned.

Note

The returned path does not start with a slash. So in particular for files, you want to prepend the slash yourself.

url : a SwfdecURL
Returns : the path or NULL if none

swfdec_url_get_protocol ()

const char*         swfdec_url_get_protocol             (const SwfdecURL *url);

Gets the protocol used by this URL, such as "http" or "file".

url : a SwfdecURL
Returns : the protocol used or "error" if the URL is broken

swfdec_url_has_protocol ()

gboolean            swfdec_url_has_protocol             (const SwfdecURL *url,
                                                         const char *protocol);

Checks if the given url references the given protocol

url : a url
protocol : protocol name to check for
Returns : TRUE if both protocols match, FALSE otherwise

swfdec_url_get_query ()

const char*         swfdec_url_get_query                (const SwfdecURL *url);

Gets the query string associated with url. If the URL does not have a query string, NULL is returned.

url : a SwfdecURL
Returns : Query string or NULL

swfdec_url_get_url ()

const char*         swfdec_url_get_url                  (const SwfdecURL *url);

Gets the whole URL.

url : a SwfdecURL
Returns : the complete URL as string

swfdec_url_is_local ()

gboolean            swfdec_url_is_local                 (const SwfdecURL *url);

Checks if the given url references a local resource. Local resources are treated differently by Flash, since they get a higher degree of trust.

url : the url to check
Returns : TRUE if the given url is local.

swfdec_url_new ()

SwfdecURL*          swfdec_url_new                      (const char *string);

Parses the given string into a URL for use in swfdec.

string : a full-qualified URL encoded in UTF-8
Returns : a new SwfdecURL

swfdec_url_new_relative ()

SwfdecURL*          swfdec_url_new_relative             (const SwfdecURL *url,
                                                         const char *string);

Parses string into a new URL. If the given string is a relative URL, it uses url to resolve it to an absolute url.

url : a SwfdecURL
string : a relative or absolute URL path
Returns : a new SwfdecURL or NULL if an error was detected.