GnuCash  4.8a-80-g9825132ea+
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 
76 gboolean gnc_uri_is_uri (const gchar *uri);
77 
98 void gnc_uri_get_components (const gchar *uri,
99  gchar **scheme,
100  gchar **hostname,
101  gint32 *port,
102  gchar **username,
103  gchar **password,
104  gchar **path);
105 
117 gchar *gnc_uri_get_scheme (const gchar *uri);
118 
129 gchar *gnc_uri_get_path (const gchar *uri);
130 
160 gchar *gnc_uri_create_uri (const gchar *scheme,
161  const gchar *hostname,
162  gint32 port,
163  const gchar *username,
164  const gchar *password,
165  const gchar *path);
166 
189 gchar *gnc_uri_normalize_uri (const gchar *uri, gboolean allow_password);
190 
191 
202 gboolean gnc_uri_is_uri (const gchar *uri);
203 
204 
211 gboolean gnc_uri_is_known_scheme (const gchar *scheme);
212 
213 
223 gboolean gnc_uri_is_file_scheme (const gchar *scheme);
224 
225 
234 gboolean gnc_uri_is_file_uri (const gchar *uri);
235 
236 
247 gboolean gnc_uri_targets_local_fs (const gchar *uri);
248 
249 
263 gchar *gnc_uri_add_extension ( const gchar *uri, const gchar *extension );
264 
265 
283 gchar *gnc_uri_get_protocol (const gchar *uri)
284  GNC_DEPRECATED("Please use gnc_uri_get_scheme instead (since 3.4)");
285 
294 gboolean gnc_uri_is_known_protocol (const gchar *protocol)
295  GNC_DEPRECATED("Please use gnc_uri_known_scheme instead (since 3.4)");
296 
297 
308 gboolean gnc_uri_is_file_protocol (const gchar *protocol)
309  GNC_DEPRECATED("Please use gnc_uri_is_file_scheme instead (since 3.4)");
310 
313 #endif /* GNCURIUTILS_H_ */
314 
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
gboolean gnc_uri_is_file_protocol(const gchar *protocol) GNC_DEPRECATED("Please use gnc_uri_is_file_scheme instead (since 3.4)")
Checks if the given protocol is used to refer to a file (as opposed to a network service like a datab...
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_get_protocol(const gchar *uri) GNC_DEPRECATED("Please use gnc_uri_get_scheme instead (since 3.4)")
Extracts the protocol from a uri.
gboolean gnc_uri_is_known_protocol(const gchar *protocol) GNC_DEPRECATED("Please use gnc_uri_known_scheme instead (since 3.4)")
Checks if there is a backend that explicitly stated to handle the given protocol. ...
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.