зеркало из https://github.com/mozilla/gecko-dev.git
Added GetMethodInfoForName
This commit is contained in:
Родитель
1d640288fd
Коммит
9ed31cf894
|
@ -50,6 +50,8 @@ public:
|
|||
// These include methods and constants of parents.
|
||||
// There do *not* make copies ***explicit bending of XPCOM rules***
|
||||
NS_IMETHOD GetMethodInfo(uint16 index, const nsXPTMethodInfo** info) = 0;
|
||||
NS_IMETHOD GetMethodInfoForName(const char* methodName, uint16 *index,
|
||||
const nsXPTMethodInfo** info) = 0;
|
||||
NS_IMETHOD GetConstant(uint16 index, const nsXPTConstant** constant) = 0;
|
||||
|
||||
// Get the interface information or iid associated with a param of some
|
||||
|
|
|
@ -127,6 +127,36 @@ nsInterfaceInfo::GetMethodInfo(uint16 index, const nsXPTMethodInfo** info)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInterfaceInfo::GetMethodInfoForName(const char* methodName, uint16 *index,
|
||||
const nsXPTMethodInfo** result)
|
||||
{
|
||||
// XXX probably want to speed this up with a hashtable, or by at least interning
|
||||
// the names to avoid the strcmp
|
||||
nsresult rv;
|
||||
for (uint16 i = mMethodBaseIndex; i < mMethodCount; i++) {
|
||||
const nsXPTMethodInfo* info;
|
||||
info = NS_REINTERPRET_CAST(nsXPTMethodInfo*,
|
||||
&mInterfaceRecord->interfaceDescriptor->
|
||||
method_descriptors[i - mMethodBaseIndex]);
|
||||
if (PL_strcmp(methodName, info->name) == 0) {
|
||||
#ifdef NS_DEBUG
|
||||
// make sure there aren't duplicate names
|
||||
for (; i < mMethodCount; i++) {
|
||||
const nsXPTMethodInfo* info2;
|
||||
info2 = NS_REINTERPRET_CAST(nsXPTMethodInfo*,
|
||||
&mInterfaceRecord->interfaceDescriptor->
|
||||
method_descriptors[i - mMethodBaseIndex]);
|
||||
NS_ASSERTION(PL_strcmp(methodName, info2->name)!= 0, "duplicate names");
|
||||
}
|
||||
#endif
|
||||
*result = info;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInterfaceInfo::GetConstant(uint16 index, const nsXPTConstant** constant)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,8 @@ class nsInterfaceInfo : public nsIInterfaceInfo
|
|||
// These include methods and constants of parents.
|
||||
// There do *not* make copies ***explicit bending of XPCOM rules***
|
||||
NS_IMETHOD GetMethodInfo(uint16 index, const nsXPTMethodInfo** info);
|
||||
NS_IMETHOD GetMethodInfoForName(const char* methodName, uint16 *index,
|
||||
const nsXPTMethodInfo** info);
|
||||
NS_IMETHOD GetConstant(uint16 index, const nsXPTConstant** constant);
|
||||
|
||||
// Get the interface information or iid associated with a param of some
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
// These include methods and constants of parents.
|
||||
// There do *not* make copies ***explicit bending of XPCOM rules***
|
||||
NS_IMETHOD GetMethodInfo(uint16 index, const nsXPTMethodInfo** info) = 0;
|
||||
NS_IMETHOD GetMethodInfoForName(const char* methodName, uint16 *index,
|
||||
const nsXPTMethodInfo** info) = 0;
|
||||
NS_IMETHOD GetConstant(uint16 index, const nsXPTConstant** constant) = 0;
|
||||
|
||||
// Get the interface information or iid associated with a param of some
|
||||
|
|
|
@ -127,6 +127,36 @@ nsInterfaceInfo::GetMethodInfo(uint16 index, const nsXPTMethodInfo** info)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInterfaceInfo::GetMethodInfoForName(const char* methodName, uint16 *index,
|
||||
const nsXPTMethodInfo** result)
|
||||
{
|
||||
// XXX probably want to speed this up with a hashtable, or by at least interning
|
||||
// the names to avoid the strcmp
|
||||
nsresult rv;
|
||||
for (uint16 i = mMethodBaseIndex; i < mMethodCount; i++) {
|
||||
const nsXPTMethodInfo* info;
|
||||
info = NS_REINTERPRET_CAST(nsXPTMethodInfo*,
|
||||
&mInterfaceRecord->interfaceDescriptor->
|
||||
method_descriptors[i - mMethodBaseIndex]);
|
||||
if (PL_strcmp(methodName, info->name) == 0) {
|
||||
#ifdef NS_DEBUG
|
||||
// make sure there aren't duplicate names
|
||||
for (; i < mMethodCount; i++) {
|
||||
const nsXPTMethodInfo* info2;
|
||||
info2 = NS_REINTERPRET_CAST(nsXPTMethodInfo*,
|
||||
&mInterfaceRecord->interfaceDescriptor->
|
||||
method_descriptors[i - mMethodBaseIndex]);
|
||||
NS_ASSERTION(PL_strcmp(methodName, info2->name)!= 0, "duplicate names");
|
||||
}
|
||||
#endif
|
||||
*result = info;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInterfaceInfo::GetConstant(uint16 index, const nsXPTConstant** constant)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,8 @@ class nsInterfaceInfo : public nsIInterfaceInfo
|
|||
// These include methods and constants of parents.
|
||||
// There do *not* make copies ***explicit bending of XPCOM rules***
|
||||
NS_IMETHOD GetMethodInfo(uint16 index, const nsXPTMethodInfo** info);
|
||||
NS_IMETHOD GetMethodInfoForName(const char* methodName, uint16 *index,
|
||||
const nsXPTMethodInfo** info);
|
||||
NS_IMETHOD GetConstant(uint16 index, const nsXPTConstant** constant);
|
||||
|
||||
// Get the interface information or iid associated with a param of some
|
||||
|
|
Загрузка…
Ссылка в новой задаче