michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * nsIURLParser specifies the interface to an URL parser that attempts to michael@0: * follow the definitions of RFC 2396. michael@0: */ michael@0: [scriptable, uuid(78c5d19f-f5d2-4732-8d3d-d5a7d7133bc0)] michael@0: interface nsIURLParser : nsISupports michael@0: { michael@0: /** michael@0: * The string to parse in the following methods may be given as a null michael@0: * terminated string, in which case the length argument should be -1. michael@0: * michael@0: * Out parameters of the following methods are all optional (ie. the caller michael@0: * may pass-in a NULL value if the corresponding results are not needed). michael@0: * Signed out parameters may hold a value of -1 if the corresponding result michael@0: * is not part of the string being parsed. michael@0: * michael@0: * The parsing routines attempt to be as forgiving as possible. michael@0: */ michael@0: michael@0: /** michael@0: * ParseSpec breaks the URL string up into its 3 major components: a scheme, michael@0: * an authority section (hostname, etc.), and a path. michael@0: * michael@0: * spec = :// michael@0: */ michael@0: void parseURL (in string spec, in long specLen, michael@0: out unsigned long schemePos, out long schemeLen, michael@0: out unsigned long authorityPos, out long authorityLen, michael@0: out unsigned long pathPos, out long pathLen); michael@0: michael@0: /** michael@0: * ParseAuthority breaks the authority string up into its 4 components: michael@0: * username, password, hostname, and hostport. michael@0: * michael@0: * auth = :@: michael@0: */ michael@0: void parseAuthority (in string authority, in long authorityLen, michael@0: out unsigned long usernamePos, out long usernameLen, michael@0: out unsigned long passwordPos, out long passwordLen, michael@0: out unsigned long hostnamePos, out long hostnameLen, michael@0: out long port); michael@0: michael@0: /** michael@0: * userinfo = : michael@0: */ michael@0: void parseUserInfo (in string userinfo, in long userinfoLen, michael@0: out unsigned long usernamePos, out long usernameLen, michael@0: out unsigned long passwordPos, out long passwordLen); michael@0: michael@0: /** michael@0: * serverinfo = : michael@0: */ michael@0: void parseServerInfo (in string serverinfo, in long serverinfoLen, michael@0: out unsigned long hostnamePos, out long hostnameLen, michael@0: out long port); michael@0: michael@0: /** michael@0: * ParsePath breaks the path string up into its 3 major components: a file path, michael@0: * a query string, and a reference string. michael@0: * michael@0: * path = ?# michael@0: */ michael@0: void parsePath (in string path, in long pathLen, michael@0: out unsigned long filepathPos, out long filepathLen, michael@0: out unsigned long queryPos, out long queryLen, michael@0: out unsigned long refPos, out long refLen); michael@0: michael@0: /** michael@0: * ParseFilePath breaks the file path string up into: the directory portion, michael@0: * file base name, and file extension. michael@0: * michael@0: * filepath = . michael@0: */ michael@0: void parseFilePath (in string filepath, in long filepathLen, michael@0: out unsigned long directoryPos, out long directoryLen, michael@0: out unsigned long basenamePos, out long basenameLen, michael@0: out unsigned long extensionPos, out long extensionLen); michael@0: michael@0: /** michael@0: * filename = . michael@0: */ michael@0: void parseFileName (in string filename, in long filenameLen, michael@0: out unsigned long basenamePos, out long basenameLen, michael@0: out unsigned long extensionPos, out long extensionLen); michael@0: }; michael@0: michael@0: %{C++ michael@0: // url parser key for use with the category manager michael@0: // mapping from scheme to url parser. michael@0: #define NS_IURLPARSER_KEY "@mozilla.org/urlparser;1" michael@0: %}