/* -*- 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 nsXPTConstantPtr(nsXPTConstant);
[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 nsXPTConstant;
class nsXPTParamInfo;
class nsXPTType;
%}

/* this is NOT intended to be scriptable */
[uuid(1affa260-8965-4612-869a-78af4ccfb287)]
interface nsIInterfaceInfo : nsISupports
{
    readonly attribute string   name;
    readonly attribute nsIIDPtr InterfaceIID;

    boolean isScriptable();
    boolean isBuiltinClass();

    readonly attribute nsIInterfaceInfo parent;

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

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

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

    void getConstant(in PRUint16 index, 
                     [shared, retval] out nsXPTConstantPtr constant);


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

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

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


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

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

    PRUint8 getSizeIsArgNumberForParam(in PRUint16 methodIndex, 
                                       [const] in nsXPTParamInfoPtr param,
                                       in PRUint16 dimension);

    PRUint8 getInterfaceIsArgNumberForParam(in PRUint16 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 PRUint16 methodIndex, 
                                              [const] in nsXPTParamInfoPtr param,
                                              out nsIID iid);
};

