netwerk/base/public/nsIURLParser.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsIURLParser.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,98 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +/**
    1.12 + * nsIURLParser specifies the interface to an URL parser that attempts to
    1.13 + * follow the definitions of RFC 2396.
    1.14 + */
    1.15 +[scriptable, uuid(78c5d19f-f5d2-4732-8d3d-d5a7d7133bc0)]
    1.16 +interface nsIURLParser : nsISupports
    1.17 +{
    1.18 +    /**
    1.19 +     * The string to parse in the following methods may be given as a null
    1.20 +     * terminated string, in which case the length argument should be -1.
    1.21 +     *
    1.22 +     * Out parameters of the following methods are all optional (ie. the caller
    1.23 +     * may pass-in a NULL value if the corresponding results are not needed).
    1.24 +     * Signed out parameters may hold a value of -1 if the corresponding result
    1.25 +     * is not part of the string being parsed.
    1.26 +     *
    1.27 +     * The parsing routines attempt to be as forgiving as possible.
    1.28 +     */
    1.29 +
    1.30 +    /**
    1.31 +     * ParseSpec breaks the URL string up into its 3 major components: a scheme,
    1.32 +     * an authority section (hostname, etc.), and a path.
    1.33 +     *
    1.34 +     * spec = <scheme>://<authority><path>
    1.35 +     */
    1.36 +    void parseURL        (in string spec,                  in long specLen,
    1.37 +                          out unsigned long schemePos,    out long schemeLen,
    1.38 +                          out unsigned long authorityPos, out long authorityLen,
    1.39 +                          out unsigned long pathPos,      out long pathLen);
    1.40 +
    1.41 +    /**
    1.42 +     * ParseAuthority breaks the authority string up into its 4 components:
    1.43 +     * username, password, hostname, and hostport.
    1.44 +     *
    1.45 +     * auth = <username>:<password>@<hostname>:<port>
    1.46 +     */
    1.47 +    void parseAuthority  (in string authority,             in long authorityLen,
    1.48 +                          out unsigned long usernamePos,  out long usernameLen,
    1.49 +                          out unsigned long passwordPos,  out long passwordLen,
    1.50 +                          out unsigned long hostnamePos,  out long hostnameLen,
    1.51 +                          out long port);
    1.52 +
    1.53 +    /**
    1.54 +     * userinfo = <username>:<password>
    1.55 +     */
    1.56 +    void parseUserInfo   (in string userinfo,              in long userinfoLen,
    1.57 +                          out unsigned long usernamePos,  out long usernameLen,
    1.58 +                          out unsigned long passwordPos,  out long passwordLen);
    1.59 +
    1.60 +    /**
    1.61 +     * serverinfo = <hostname>:<port>
    1.62 +     */
    1.63 +    void parseServerInfo (in string serverinfo,            in long serverinfoLen,
    1.64 +                          out unsigned long hostnamePos,  out long hostnameLen,
    1.65 +                          out long port);
    1.66 +
    1.67 +    /**
    1.68 +     * ParsePath breaks the path string up into its 3 major components: a file path,
    1.69 +     * a query string, and a reference string.
    1.70 +     *
    1.71 +     * path = <filepath>?<query>#<ref>
    1.72 +     */
    1.73 +    void parsePath       (in string path,                  in long pathLen,
    1.74 +                          out unsigned long filepathPos,  out long filepathLen,
    1.75 +                          out unsigned long queryPos,     out long queryLen,
    1.76 +                          out unsigned long refPos,       out long refLen);
    1.77 +
    1.78 +    /**
    1.79 +     * ParseFilePath breaks the file path string up into: the directory portion,
    1.80 +     * file base name, and file extension.
    1.81 +     *
    1.82 +     * filepath = <directory><basename>.<extension>
    1.83 +     */
    1.84 +    void parseFilePath   (in string filepath,              in long filepathLen,
    1.85 +                          out unsigned long directoryPos, out long directoryLen,
    1.86 +                          out unsigned long basenamePos,  out long basenameLen,
    1.87 +                          out unsigned long extensionPos, out long extensionLen);
    1.88 +
    1.89 +    /**
    1.90 +     * filename = <basename>.<extension>
    1.91 +     */
    1.92 +    void parseFileName   (in string filename,              in long filenameLen,
    1.93 +                          out unsigned long basenamePos,  out long basenameLen,
    1.94 +                          out unsigned long extensionPos, out long extensionLen);
    1.95 +};
    1.96 +
    1.97 +%{C++
    1.98 +// url parser key for use with the category manager
    1.99 +// mapping from scheme to url parser.
   1.100 +#define NS_IURLPARSER_KEY "@mozilla.org/urlparser;1"
   1.101 +%}

mercurial