Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | /** |
michael@0 | 9 | * nsIURLParser specifies the interface to an URL parser that attempts to |
michael@0 | 10 | * follow the definitions of RFC 2396. |
michael@0 | 11 | */ |
michael@0 | 12 | [scriptable, uuid(78c5d19f-f5d2-4732-8d3d-d5a7d7133bc0)] |
michael@0 | 13 | interface nsIURLParser : nsISupports |
michael@0 | 14 | { |
michael@0 | 15 | /** |
michael@0 | 16 | * The string to parse in the following methods may be given as a null |
michael@0 | 17 | * terminated string, in which case the length argument should be -1. |
michael@0 | 18 | * |
michael@0 | 19 | * Out parameters of the following methods are all optional (ie. the caller |
michael@0 | 20 | * may pass-in a NULL value if the corresponding results are not needed). |
michael@0 | 21 | * Signed out parameters may hold a value of -1 if the corresponding result |
michael@0 | 22 | * is not part of the string being parsed. |
michael@0 | 23 | * |
michael@0 | 24 | * The parsing routines attempt to be as forgiving as possible. |
michael@0 | 25 | */ |
michael@0 | 26 | |
michael@0 | 27 | /** |
michael@0 | 28 | * ParseSpec breaks the URL string up into its 3 major components: a scheme, |
michael@0 | 29 | * an authority section (hostname, etc.), and a path. |
michael@0 | 30 | * |
michael@0 | 31 | * spec = <scheme>://<authority><path> |
michael@0 | 32 | */ |
michael@0 | 33 | void parseURL (in string spec, in long specLen, |
michael@0 | 34 | out unsigned long schemePos, out long schemeLen, |
michael@0 | 35 | out unsigned long authorityPos, out long authorityLen, |
michael@0 | 36 | out unsigned long pathPos, out long pathLen); |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * ParseAuthority breaks the authority string up into its 4 components: |
michael@0 | 40 | * username, password, hostname, and hostport. |
michael@0 | 41 | * |
michael@0 | 42 | * auth = <username>:<password>@<hostname>:<port> |
michael@0 | 43 | */ |
michael@0 | 44 | void parseAuthority (in string authority, in long authorityLen, |
michael@0 | 45 | out unsigned long usernamePos, out long usernameLen, |
michael@0 | 46 | out unsigned long passwordPos, out long passwordLen, |
michael@0 | 47 | out unsigned long hostnamePos, out long hostnameLen, |
michael@0 | 48 | out long port); |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * userinfo = <username>:<password> |
michael@0 | 52 | */ |
michael@0 | 53 | void parseUserInfo (in string userinfo, in long userinfoLen, |
michael@0 | 54 | out unsigned long usernamePos, out long usernameLen, |
michael@0 | 55 | out unsigned long passwordPos, out long passwordLen); |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * serverinfo = <hostname>:<port> |
michael@0 | 59 | */ |
michael@0 | 60 | void parseServerInfo (in string serverinfo, in long serverinfoLen, |
michael@0 | 61 | out unsigned long hostnamePos, out long hostnameLen, |
michael@0 | 62 | out long port); |
michael@0 | 63 | |
michael@0 | 64 | /** |
michael@0 | 65 | * ParsePath breaks the path string up into its 3 major components: a file path, |
michael@0 | 66 | * a query string, and a reference string. |
michael@0 | 67 | * |
michael@0 | 68 | * path = <filepath>?<query>#<ref> |
michael@0 | 69 | */ |
michael@0 | 70 | void parsePath (in string path, in long pathLen, |
michael@0 | 71 | out unsigned long filepathPos, out long filepathLen, |
michael@0 | 72 | out unsigned long queryPos, out long queryLen, |
michael@0 | 73 | out unsigned long refPos, out long refLen); |
michael@0 | 74 | |
michael@0 | 75 | /** |
michael@0 | 76 | * ParseFilePath breaks the file path string up into: the directory portion, |
michael@0 | 77 | * file base name, and file extension. |
michael@0 | 78 | * |
michael@0 | 79 | * filepath = <directory><basename>.<extension> |
michael@0 | 80 | */ |
michael@0 | 81 | void parseFilePath (in string filepath, in long filepathLen, |
michael@0 | 82 | out unsigned long directoryPos, out long directoryLen, |
michael@0 | 83 | out unsigned long basenamePos, out long basenameLen, |
michael@0 | 84 | out unsigned long extensionPos, out long extensionLen); |
michael@0 | 85 | |
michael@0 | 86 | /** |
michael@0 | 87 | * filename = <basename>.<extension> |
michael@0 | 88 | */ |
michael@0 | 89 | void parseFileName (in string filename, in long filenameLen, |
michael@0 | 90 | out unsigned long basenamePos, out long basenameLen, |
michael@0 | 91 | out unsigned long extensionPos, out long extensionLen); |
michael@0 | 92 | }; |
michael@0 | 93 | |
michael@0 | 94 | %{C++ |
michael@0 | 95 | // url parser key for use with the category manager |
michael@0 | 96 | // mapping from scheme to url parser. |
michael@0 | 97 | #define NS_IURLPARSER_KEY "@mozilla.org/urlparser;1" |
michael@0 | 98 | %} |