/* -*- 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(3f1ae084-607e-45b2-8f1e-8d450b0f9c65)]
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 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);

    void getXptConstant(in uint16_t 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 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);
};

