/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is Andreas Otte
 *
 * Contributor(s): 
 */

#include "nsISupports.idl"

/**
 * nsIURLParser is the abstract base class for parsing URLs
 */

[scriptable, uuid(4b4975f9-f128-47fd-b11e-88402233cbdf)]
interface nsIURLParser : nsISupports
{

    /**
     * Parses a URL and thinks it is parsing the scheme
     */
    void ParseAtScheme(in  string i_Spec, 
                       out string o_Scheme, 
                       out string o_Username,
                       out string o_Password,
                       out string o_Host, 
                       out long o_Port, 
                       out string o_Path);

    /**
     * Parses a URL and thinks it is parsing the prehost
     */
    void ParseAtPreHost(in  string i_Spec, 
                        out string o_Username,
                        out string o_Password,
                        out string o_Host,
                        out long o_Port, 
                        out string o_Path);

    /**
     * Parses a URL and thinks it is parsing the host
     */
    void ParseAtHost(in  string i_Spec, 
                     out string o_Host,
                     out long o_Port, 
                     out string o_Path);

    /**
     * Parses a URL and thinks it is parsing the port
     */
    void ParseAtPort(in  string i_Spec, 
                     out long o_Port, 
                     out string o_Path);

    /**
     * Parses a URL and thinks it is parsing the path
     */
    void ParseAtPath(in  string i_Spec, 
                     out string o_Path);

    /**
     * Parses a URL-path and thinks it is parsing the directory
     */
    void ParseAtDirectory(in  string i_Path, 
                          out string o_Directory, 
                          out string o_FileBaseName,
                          out string o_FileExtension,
                          out string o_Param, 
                          out string o_Query, 
                          out string o_Ref);

    /**
     * Parses the URL-PreHost into its components
     */
    void ParsePreHost(in  string i_PreHost, 
                      out string o_Username, 
                      out string o_Password);

    /**
     * Parses the URL-Filename into its components
     */
    void ParseFileName(in  string i_FileName, 
                       out string o_FileBaseName, 
                       out string o_FileExtension);

};

%{C++

#define NS_STANDARDURLPARSER_CID                     \
{ /* dbf72351-4fd8-46f0-9dbc-fa5ba60a30c5 */         \
    0xdbf72351,                                      \
    0x4fd8,                                          \
    0x46f0,                                          \
    {0x9d, 0xbc, 0xfa, 0x5b, 0xa6, 0x0a, 0x30, 0x5c} \
}

#define NS_AUTHORITYURLPARSER_CID                    \
{ /* 90012125-1616-4fa1-ae14-4e7fa5766eb6 */         \
    0x90012125,                                      \
    0x1616,                                          \
    0x4fa1,                                          \
    {0xae, 0x14, 0x4e, 0x7f, 0xa5, 0x76, 0x6e, 0xb6} \
}

#define NS_NOAUTHORITYURLPARSER_CID                  \
{ /* 9eeb1b89-c87e-4404-9de6-dbd41aeaf3d7 */         \
    0x9eeb1b89,                                      \
    0xc87e,                                          \
    0x4404,                                          \
    {0x9d, 0xe6, 0xdb, 0xd4, 0x1a, 0xea, 0xf3, 0xd7} \
}

%}
