GnuCash  5.6-150-g038405b370+
gnc-uri-utils.h
Go to the documentation of this file.
1 /*
2  * gnc-uri-utils.h -- utility functions to convert uri in separate
3  * components and back.
4  *
5  * Copyright (C) 2010 Geert Janssens <janssens.geert@telenet.be>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, contact:
19  *
20  * Free Software Foundation Voice: +1-617-542-5942
21  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
22  * Boston, MA 02110-1301, USA gnu@gnu.org
23  */
24 
58 #ifndef GNCURIUTILS_H_
59 #define GNCURIUTILS_H_
60 
61 #define GNC_DATAFILE_EXT ".gnucash"
62 #define GNC_LOGFILE_EXT ".log"
63 
64 #include "platform.h"
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
80 gboolean gnc_uri_is_uri (const gchar *uri);
81 
102 void gnc_uri_get_components (const gchar *uri,
103  gchar **scheme,
104  gchar **hostname,
105  gint32 *port,
106  gchar **username,
107  gchar **password,
108  gchar **path);
109 
121 gchar *gnc_uri_get_scheme (const gchar *uri);
122 
133 gchar *gnc_uri_get_path (const gchar *uri);
134 
164 gchar *gnc_uri_create_uri (const gchar *scheme,
165  const gchar *hostname,
166  gint32 port,
167  const gchar *username,
168  const gchar *password,
169  const gchar *path);
170 
193 gchar *gnc_uri_normalize_uri (const gchar *uri, gboolean allow_password);
194 
195 
206 gboolean gnc_uri_is_uri (const gchar *uri);
207 
208 
215 gboolean gnc_uri_is_known_scheme (const gchar *scheme);
216 
217 
227 gboolean gnc_uri_is_file_scheme (const gchar *scheme);
228 
229 
238 gboolean gnc_uri_is_file_uri (const gchar *uri);
239 
240 
251 gboolean gnc_uri_targets_local_fs (const gchar *uri);
252 
253 
267 gchar *gnc_uri_add_extension ( const gchar *uri, const gchar *extension );
268 
269 #ifdef __cplusplus
270 }
271 #endif
272 
273 #endif /* GNCURIUTILS_H_ */
274 
gchar * gnc_uri_get_scheme(const gchar *uri)
Extracts the scheme from a uri.
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_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 databas...
Definition: gnc-uri-utils.c:90
gchar * gnc_uri_get_path(const gchar *uri)
Extracts the path part from a 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.
gboolean gnc_uri_is_uri(const gchar *uri)
Checks if the given uri is a valid uri.
Definition: gnc-uri-utils.c:32
gchar * gnc_uri_normalize_uri(const gchar *uri, gboolean allow_password)
Composes a normalized uri starting from any uri (filename, db spec,...).
gchar * gnc_uri_add_extension(const gchar *uri, const gchar *extension)
Adds an extension to the uri if:
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.
gboolean gnc_uri_is_known_scheme(const gchar *scheme)
Checks if there is a backend that explicitly stated to handle the given scheme.
Definition: gnc-uri-utils.c:61
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.