GnuCash 7574033+
Loading...
Searching...
No Matches
gnc-uri-utils.h File Reference

Utility functions for convert uri in separate components and back. More...

#include "platform.h"

Go to the source code of this file.

Macros

#define GNC_DATAFILE_EXT   ".gnucash"
#define GNC_LOGFILE_EXT   ".log"

Functions

gboolean gnc_uri_is_uri (const gchar *uri)
 Checks if the given uri is a valid uri.
void gnc_uri_get_components (const gchar *uri, gchar **scheme, gchar **hostname, gint32 *port, gchar **username, gchar **password, gchar **path)
 Converts a uri in separate components.
gchar * gnc_uri_get_scheme (const gchar *uri)
 Extracts the scheme from a uri.
gchar * gnc_uri_get_path (const gchar *uri)
 Extracts the path part from a uri.
gchar * gnc_uri_create_uri (const gchar *scheme, const gchar *hostname, gint32 port, const gchar *username, const gchar *password, const gchar *path)
 Composes a normalized uri starting from its separate components.
gchar * gnc_uri_normalize_uri (const gchar *uri, gboolean allow_password)
 Composes a normalized uri starting from any uri (filename, db spec,...).
gboolean gnc_uri_is_known_scheme (const gchar *scheme)
 Checks if there is a backend that explicitly stated to handle the given scheme.
gboolean gnc_uri_is_file_scheme (const gchar *scheme)
 Checks if the given scheme is used to refer to a file (as opposed to a network service like a database or web url).
gboolean gnc_uri_is_file_uri (const gchar *uri)
 Checks if the given uri defines a file (as opposed to a network service like a database or web url).
gboolean gnc_uri_targets_local_fs (const gchar *uri)
 Checks if the given uri is either a valid file uri or a local filesystem path.
gchar * gnc_uri_add_extension (const gchar *uri, const gchar *extension)
 Adds an extension to the uri if:

Detailed Description

Utility functions for convert uri in separate components and back.

Author
Copyright (C) 2010 Geert Janssens janss.nosp@m.ens-.nosp@m.geert.nosp@m.@tel.nosp@m.enet..nosp@m.be

These functions help you convert a uri into its separate components (being scheme, host name, port, user name, password and path) or to compose a uri from these separate components.

For GnuCash' purposes a full uri can be described as:

  • scheme://[[username[:password]@]hostname[:port]]/path (universal uri)
  • file://[localhost]/path (uri referring to a file on the local file system)

Anything in square brackets is optional.

While not strictly uris this function will also accept input in the form of a local file system path for convenience:

  • some/filesystem/path A simple relative file system path (unix style)
  • /some/filesystem/path A simple absolute file system path (unix style)
  • some\windows\path A simple relative file system path (Windows style)
  • c:\some\windows\path A simple file system path (Windows style)

The local path will then be considered as the path component of a uri where appropriate. In case of conversion from a file system path to a uri the relative paths will be converted to absolute paths as uris don't allow relative paths.

Definition in file gnc-uri-utils.h.