/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* The nsIInterfaceInfo public declaration. */


#include "nsISupports.idl"

// forward declaration of non-XPCOM types

[ptr] native nsXPTMethodInfoPtr(nsXPTMethodInfo);
[ptr] native nsXPTParamInfoPtr(nsXPTParamInfo);
      native nsXPTType(nsXPTType);

// We bend the rules to do a [shared] nsIID (but this is never scriptable)  
[ptr] native nsIIDPtrShared(nsIID);

%{C++
class nsXPTMethodInfo;
class nsXPTParamInfo;
class nsXPTType;
%}

/* this is NOT intended to be scriptable */
[uuid(4e698ffe-e9b5-42f3-9129-78a6c5fe0e9e)]
interface nsIInterfaceInfo : nsISupports
{
    readonly attribute string   name;
    readonly attribute nsIIDPtr InterfaceIID;

    boolean isScriptable();
    boolean isBuiltinClass();
    boolean isMainProcessScriptableOnly();

    readonly attribute nsIInterfaceInfo parent;

    /**
    * These include counts for parent (and all ancestors).
    */
    readonly attribute uint16_t methodCount;
    readonly attribute uint16_t constantCount;

    /**
    * These include methods and constants for parent (and all ancestors).
    * 
    * These do *not* make copies ***explicit bending of XPCOM rules***.
    */
    
    void getMethodInfo(in uint16_t index, 
                       [shared, retval] out nsXPTMethodInfoPtr info);

    void getMethodInfoForName(in string methodName, out uint16_t index, 
                       [shared, retval] out nsXPTMethodInfoPtr info);

    void getConstant(in uint16_t index,
                     out jsval constant,
                     out string name);


    /**
    * Get the interface information or iid associated with a param of some
    * method in this interface.
    */

    nsIInterfaceInfo getInfoForParam(in uint16_t methodIndex, 
                                     [const] in nsXPTParamInfoPtr param);

    nsIIDPtr getIIDForParam(in uint16_t methodIndex, 
                            [const] in nsXPTParamInfoPtr param);


    /**
    * These do *not* make copies ***explicit bending of XPCOM rules***.
    */

    nsXPTType getTypeForParam(in uint16_t methodIndex, 
                              [const] in nsXPTParamInfoPtr param,
                              in uint16_t dimension);

    uint8_t getSizeIsArgNumberForParam(in uint16_t methodIndex, 
                                       [const] in nsXPTParamInfoPtr param,
                                       in uint16_t dimension);

    uint8_t getInterfaceIsArgNumberForParam(in uint16_t methodIndex, 
                                            [const] in nsXPTParamInfoPtr param);

    boolean isIID(in nsIIDPtr IID);

    void   getNameShared([shared,retval] out string name);
    void   getIIDShared([shared,retval] out nsIIDPtrShared iid);

    boolean isFunction();

    boolean hasAncestor(in nsIIDPtr iid);

    [notxpcom] nsresult getIIDForParamNoAlloc(in uint16_t methodIndex, 
                                              [const] in nsXPTParamInfoPtr param,
                                              out nsIID iid);
};

