1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = glib-URI-Functions.html 27 * outPack = glib 28 * outFile = URI 29 * strct = 30 * realStrct= 31 * ctorStrct= 32 * clss = URI 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_uri_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ErrorG 48 * - glib.GException 49 * structWrap: 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module glib.URI; 56 57 public import gtkc.glibtypes; 58 59 private import gtkc.glib; 60 private import glib.ConstructionException; 61 62 63 private import glib.Str; 64 private import glib.ErrorG; 65 private import glib.GException; 66 67 68 69 70 /** 71 * Description 72 * Functions for manipulating Universal Resource Identifiers (URIs) as 73 * defined by 74 * RFC 3986. It is highly recommended that you have read and 75 * understand RFC 3986 for understanding this API. 76 */ 77 public class URI 78 { 79 80 /** 81 */ 82 83 /** 84 * Since 2.16 85 * Params: 86 * uri = a valid URI. 87 * Returns: The "Scheme" component of the URI, or NULL on error. The returned string should be freed when no longer needed. 88 */ 89 public static string parseScheme(string uri) 90 { 91 // char * g_uri_parse_scheme (const char *uri); 92 return Str.toString(g_uri_parse_scheme(Str.toStringz(uri))); 93 } 94 95 /** 96 * Escapes a string for use in a URI. 97 * Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical 98 * characters plus dash, dot, underscore and tilde) are escaped. 99 * But if you specify characters in reserved_chars_allowed they are not 100 * escaped. This is useful for the "reserved" characters in the URI 101 * specification, since those are allowed unescaped in some portions of 102 * a URI. 103 * Since 2.16 104 * Params: 105 * unescaped = the unescaped input string. 106 * reservedCharsAllowed = a string of reserved characters that are 107 * allowed to be used, or NULL. 108 * allowUtf8 = TRUE if the result can include UTF-8 characters. 109 * Returns: an escaped version of unescaped. The returned string should be freed when no longer needed. 110 */ 111 public static string escapeString(string unescaped, string reservedCharsAllowed, int allowUtf8) 112 { 113 // char * g_uri_escape_string (const char *unescaped, const char *reserved_chars_allowed, gboolean allow_utf8); 114 return Str.toString(g_uri_escape_string(Str.toStringz(unescaped), Str.toStringz(reservedCharsAllowed), allowUtf8)); 115 } 116 117 /** 118 * Unescapes a whole escaped string. 119 * If any of the characters in illegal_characters or the character zero appears 120 * as an escaped character in escaped_string then that is an error and NULL 121 * will be returned. This is useful it you want to avoid for instance having a 122 * slash being expanded in an escaped path element, which might confuse pathname 123 * handling. 124 * Since 2.16 125 * Params: 126 * escapedString = an escaped string to be unescaped. 127 * illegalCharacters = an optional string of illegal characters not to be allowed. 128 * Returns: an unescaped version of escaped_string. The returned string should be freed when no longer needed. 129 */ 130 public static string unescapeString(string escapedString, string illegalCharacters) 131 { 132 // char * g_uri_unescape_string (const char *escaped_string, const char *illegal_characters); 133 return Str.toString(g_uri_unescape_string(Str.toStringz(escapedString), Str.toStringz(illegalCharacters))); 134 } 135 136 /** 137 * Unescapes a segment of an escaped string. 138 * If any of the characters in illegal_characters or the character zero appears 139 * as an escaped character in escaped_string then that is an error and NULL 140 * will be returned. This is useful it you want to avoid for instance having a 141 * slash being expanded in an escaped path element, which might confuse pathname 142 * handling. 143 * Since 2.16 144 * Params: 145 * escapedString = a string. 146 * escapedStringEnd = a string. 147 * illegalCharacters = an optional string of illegal characters not to be allowed. 148 * Returns: an unescaped version of escaped_string or NULL on error. The returned string should be freed when no longer needed. 149 */ 150 public static string unescapeSegment(string escapedString, string escapedStringEnd, string illegalCharacters) 151 { 152 // char * g_uri_unescape_segment (const char *escaped_string, const char *escaped_string_end, const char *illegal_characters); 153 return Str.toString(g_uri_unescape_segment(Str.toStringz(escapedString), Str.toStringz(escapedStringEnd), Str.toStringz(illegalCharacters))); 154 } 155 156 /** 157 * Splits an URI list conforming to the text/uri-list 158 * mime type defined in RFC 2483 into individual URIs, 159 * discarding any comments. The URIs are not validated. 160 * Since 2.6 161 * Params: 162 * uriList = an URI list 163 * Returns: a newly allocated NULL-terminated list of strings holding the individual URIs. The array should be freed with g_strfreev(). 164 */ 165 public static string[] listExtractUris(string uriList) 166 { 167 // gchar ** g_uri_list_extract_uris (const gchar *uri_list); 168 return Str.toStringArray(g_uri_list_extract_uris(Str.toStringz(uriList))); 169 } 170 }