VirtualBox

source: vbox/trunk/include/iprt/uri.h@ 56533

Last change on this file since 56533 was 53615, checked in by vboxsync, 10 years ago

doxygen fixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/** @file
2 * IPRT - Uniform Resource Identifier handling.
3 */
4
5/*
6 * Copyright (C) 2011-2015 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_uri_h
27#define ___iprt_uri_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31
32RT_C_DECLS_BEGIN
33
34/** @defgroup grp_rt_uri RTUri - Uri parsing and creation
35 * URI parsing and creation based on RFC 3986.
36 * See http://datatracker.ietf.org/doc/rfc3986/ for the full specification.
37 * @note Currently it isn't the full specification implemented.
38 * @note Currently only some generic URI support and a minimum File(file:) URI
39 * support is implemented. Other specific scheme support, like html:, ldap:,
40 * data:, ..., is missing.
41 * @see grp_rt_uri_file
42 * @ingroup grp_rt
43 * @{
44 */
45
46/**
47 * Creates a generic URI. The returned pointer must be freed
48 * using RTStrFree().
49 *
50 * @returns the new URI on success, NULL otherwise.
51 * @param pszScheme The URI scheme.
52 * @param pszAuthority The authority part of the URI (optional).
53 * @param pszPath The path part of the URI (optional).
54 * @param pszQuery The query part of the URI (optional).
55 * @param pszFragment The fragment part of the URI (optional).
56 */
57RTR3DECL(char *) RTUriCreate(const char *pszScheme, const char *pszAuthority, const char *pszPath, const char *pszQuery, const char *pszFragment);
58
59/**
60 * Check an string for a specific URI scheme.
61 *
62 * @returns true if the scheme match, false if not.
63 * @param pszUri The URI to check.
64 * @param pszScheme The scheme to compare with.
65 */
66RTR3DECL(bool) RTUriHasScheme(const char *pszUri, const char *pszScheme);
67
68/**
69 * Extract the scheme out of an URI.
70 *
71 * @returns the scheme if the URI is valid, NULL otherwise.
72 * @param pszUri The URI to extract from.
73 */
74RTR3DECL(char *) RTUriScheme(const char *pszUri);
75
76/**
77 * Extract the authority out of an URI.
78 *
79 * @returns the authority if the URI contains one, NULL otherwise.
80 * @param pszUri The URI to extract from.
81 */
82RTR3DECL(char *) RTUriAuthority(const char *pszUri);
83
84/**
85 * Extract the path out of an URI.
86 *
87 * @returns the path if the URI contains one, NULL otherwise.
88 * @param pszUri The URI to extract from.
89 */
90RTR3DECL(char *) RTUriPath(const char *pszUri);
91
92/**
93 * Extract the query out of an URI.
94 *
95 * @returns the query if the URI contains one, NULL otherwise.
96 * @param pszUri The URI to extract from.
97 */
98RTR3DECL(char *) RTUriQuery(const char *pszUri);
99
100/**
101 * Extract the fragment out of an URI.
102 *
103 * @returns the fragment if the URI contains one, NULL otherwise.
104 * @param pszUri The URI to extract from.
105 */
106RTR3DECL(char *) RTUriFragment(const char *pszUri);
107
108/** @defgroup grp_rt_uri_file RTUriFile - Uri file parsing and creation
109 * Adds file: scheme support to the generic RTUri interface. This is partly
110 * documented in http://datatracker.ietf.org/doc/rfc1738/.
111 * @{
112 */
113
114/** Auto detect in which format a path is returned. */
115#define URI_FILE_FORMAT_AUTO UINT32_C(0)
116/** Return a path in UNIX format style. */
117#define URI_FILE_FORMAT_UNIX UINT32_C(1)
118/** Return a path in Windows format style. */
119#define URI_FILE_FORMAT_WIN UINT32_C(2)
120
121/**
122 * Creates a file URI. The returned pointer must be freed
123 * using RTStrFree().
124 *
125 * @see RTUriCreate
126 *
127 * @returns the new URI on success, NULL otherwise.
128 * @param pszPath The path of the URI.
129 */
130RTR3DECL(char *) RTUriFileCreate(const char *pszPath);
131
132/**
133 * Returns the file path encoded in the URI.
134 *
135 * @returns the path if the URI contains one, NULL otherwise.
136 * @param pszUri The URI to extract from.
137 * @param uFormat In which format should the path returned.
138 */
139RTR3DECL(char *) RTUriFilePath(const char *pszUri, uint32_t uFormat);
140
141/**
142 * Returns the file path encoded in the URI, given a max string length.
143 *
144 * @returns the path if the URI contains one, NULL otherwise.
145 * @param pszUri The URI to extract from.
146 * @param uFormat In which format should the path returned.
147 * @param cbMax The max string length to inspect.
148 */
149RTR3DECL(char *) RTUriFileNPath(const char *pszUri, uint32_t uFormat, size_t cchMax);
150
151/** @} */
152
153/** @} */
154
155RT_C_DECLS_END
156
157#endif
158
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette