分类: 系统运维
2006-01-25 16:10:11
另外,有个名为nsIInterfaceInfo的接口也使获取接口信息成为可能,而且可能更方便,它的原型为:
[uuid(215DBE04-94A7-11d2-BA58-00805F8A5DD7)]
interface nsIInterfaceInfo : nsISupports
{
readonly attribute string name;
readonly attribute nsIIDPtr InterfaceIID;
PRBool isScriptable();
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 getLengthIsArgNumberForParam(in PRUint16 methodIndex,
[const] in nsXPTParamInfoPtr param,
in PRUint16 dimension);
PRUint8 getInterfaceIsArgNumberForParam(in PRUint16 methodIndex,
[const] in nsXPTParamInfoPtr param);
PRBool isIID(in nsIIDPtr IID);
void getNameShared([shared,retval] out string name);
void getIIDShared([shared,retval] out nsIIDPtrShared iid);
PRBool isFunction();
PRBool hasAncestor(in nsIIDPtr iid);
[notxpcom] nsresult getIIDForParamNoAlloc(in PRUint16 methodIndex,
[const] in nsXPTParamInfoPtr param,
out nsIID iid);
};
其实,也就是前面一直说的那个getMethodInfoForName方法的idl接口。
readonly attribute PRUint16 methodCount;
就提供了methodCount