/usr/include/d/gtkd-3/glib/URI.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module glib.URI;
private import glib.ErrorG;
private import glib.GException;
private import glib.Str;
private import glib.c.functions;
public import glib.c.types;
public import gtkc.glibtypes;
/** */
public struct URI
{
/**
* Converts an escaped ASCII-encoded URI to a local filename in the
* encoding used for filenames.
*
* Params:
* uri = a uri describing a filename (escaped, encoded in ASCII).
* hostname = Location to store hostname for the URI.
* If there is no hostname in the URI, %NULL will be
* stored in this location.
*
* Returns: a newly-allocated string holding
* the resulting filename, or %NULL on an error.
*
* Throws: GException on failure.
*/
public static string filenameFromUri(string uri, out string hostname)
{
char* outhostname = null;
GError* err = null;
auto retStr = g_filename_from_uri(Str.toStringz(uri), &outhostname, &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
hostname = Str.toString(outhostname);
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Converts an absolute filename to an escaped ASCII-encoded URI, with the path
* component following Section 3.3. of RFC 2396.
*
* Params:
* filename = an absolute filename specified in the GLib file
* name encoding, which is the on-disk file name bytes on Unix, and UTF-8
* on Windows
* hostname = A UTF-8 encoded hostname, or %NULL for none.
*
* Returns: a newly-allocated string holding the resulting
* URI, or %NULL on an error.
*
* Throws: GException on failure.
*/
public static string filenameToUri(string filename, string hostname)
{
GError* err = null;
auto retStr = g_filename_to_uri(Str.toStringz(filename), Str.toStringz(hostname), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Escapes a string for use in a URI.
*
* Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
* characters plus dash, dot, underscore and tilde) are escaped.
* But if you specify characters in @reserved_chars_allowed they are not
* escaped. This is useful for the "reserved" characters in the URI
* specification, since those are allowed unescaped in some portions of
* a URI.
*
* Params:
* unescaped = the unescaped input string.
* reservedCharsAllowed = a string of reserved characters that
* are allowed to be used, or %NULL.
* allowUtf8 = %TRUE if the result can include UTF-8 characters.
*
* Returns: an escaped version of @unescaped. The returned string should be
* freed when no longer needed.
*
* Since: 2.16
*/
public static string uriEscapeString(string unescaped, string reservedCharsAllowed, bool allowUtf8)
{
auto retStr = g_uri_escape_string(Str.toStringz(unescaped), Str.toStringz(reservedCharsAllowed), allowUtf8);
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Splits an URI list conforming to the text/uri-list
* mime type defined in RFC 2483 into individual URIs,
* discarding any comments. The URIs are not validated.
*
* Params:
* uriList = an URI list
*
* Returns: a newly allocated %NULL-terminated list
* of strings holding the individual URIs. The array should be freed
* with g_strfreev().
*
* Since: 2.6
*/
public static string[] uriListExtractUris(string uriList)
{
auto retStr = g_uri_list_extract_uris(Str.toStringz(uriList));
scope(exit) Str.freeStringArray(retStr);
return Str.toStringArray(retStr);
}
/**
* Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
* |[
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
* ]|
* Common schemes include "file", "http", "svn+ssh", etc.
*
* Params:
* uri = a valid URI.
*
* Returns: The "Scheme" component of the URI, or %NULL on error.
* The returned string should be freed when no longer needed.
*
* Since: 2.16
*/
public static string uriParseScheme(string uri)
{
auto retStr = g_uri_parse_scheme(Str.toStringz(uri));
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Unescapes a segment of an escaped string.
*
* If any of the characters in @illegal_characters or the character zero appears
* as an escaped character in @escaped_string then that is an error and %NULL
* will be returned. This is useful it you want to avoid for instance having a
* slash being expanded in an escaped path element, which might confuse pathname
* handling.
*
* Params:
* escapedString = A string, may be %NULL
* escapedStringEnd = Pointer to end of @escaped_string, may be %NULL
* illegalCharacters = An optional string of illegal characters not to be allowed, may be %NULL
*
* Returns: an unescaped version of @escaped_string or %NULL on error.
* The returned string should be freed when no longer needed. As a
* special case if %NULL is given for @escaped_string, this function
* will return %NULL.
*
* Since: 2.16
*/
public static string uriUnescapeSegment(string escapedString, string escapedStringEnd, string illegalCharacters)
{
auto retStr = g_uri_unescape_segment(Str.toStringz(escapedString), Str.toStringz(escapedStringEnd), Str.toStringz(illegalCharacters));
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Unescapes a whole escaped string.
*
* If any of the characters in @illegal_characters or the character zero appears
* as an escaped character in @escaped_string then that is an error and %NULL
* will be returned. This is useful it you want to avoid for instance having a
* slash being expanded in an escaped path element, which might confuse pathname
* handling.
*
* Params:
* escapedString = an escaped string to be unescaped.
* illegalCharacters = a string of illegal characters not to be
* allowed, or %NULL.
*
* Returns: an unescaped version of @escaped_string. The returned string
* should be freed when no longer needed.
*
* Since: 2.16
*/
public static string uriUnescapeString(string escapedString, string illegalCharacters)
{
auto retStr = g_uri_unescape_string(Str.toStringz(escapedString), Str.toStringz(illegalCharacters));
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
}
|