本文整理汇总了C++中EventListenerManager::GetListenerInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ EventListenerManager::GetListenerInfo方法的具体用法?C++ EventListenerManager::GetListenerInfo怎么用?C++ EventListenerManager::GetListenerInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventListenerManager
的用法示例。
在下文中一共展示了EventListenerManager::GetListenerInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
NS_IMETHODIMP
EventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
uint32_t* aCount,
nsIEventListenerInfo*** aOutArray)
{
NS_ENSURE_ARG_POINTER(aEventTarget);
*aCount = 0;
*aOutArray = nullptr;
nsCOMArray<nsIEventListenerInfo> listenerInfos;
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aEventTarget);
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
EventListenerManager* elm = eventTarget->GetExistingListenerManager();
if (elm) {
elm->GetListenerInfo(&listenerInfos);
}
int32_t count = listenerInfos.Count();
if (count == 0) {
return NS_OK;
}
listenerInfos.Forget(aOutArray);
*aCount = count;
return NS_OK;
}
示例2:
NS_IMETHODIMP
EventListenerService::GetListenerInfoFor(nsIDOMEventTarget* aEventTarget,
uint32_t* aCount,
nsIEventListenerInfo*** aOutArray)
{
NS_ENSURE_ARG_POINTER(aEventTarget);
*aCount = 0;
*aOutArray = nullptr;
nsCOMArray<nsIEventListenerInfo> listenerInfos;
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aEventTarget);
NS_ENSURE_TRUE(eventTarget, NS_ERROR_NO_INTERFACE);
EventListenerManager* elm = eventTarget->GetExistingListenerManager();
if (elm) {
elm->GetListenerInfo(&listenerInfos);
}
int32_t count = listenerInfos.Count();
if (count == 0) {
return NS_OK;
}
*aOutArray =
static_cast<nsIEventListenerInfo**>(
moz_xmalloc(sizeof(nsIEventListenerInfo*) * count));
NS_ENSURE_TRUE(*aOutArray, NS_ERROR_OUT_OF_MEMORY);
for (int32_t i = 0; i < count; ++i) {
NS_ADDREF((*aOutArray)[i] = listenerInfos[i]);
}
*aCount = count;
return NS_OK;
}
示例3:
NS_IMETHODIMP
EventListenerService::GetListenerInfoFor(EventTarget* aEventTarget,
uint32_t* aCount,
nsIEventListenerInfo*** aOutArray)
{
NS_ENSURE_ARG_POINTER(aEventTarget);
*aCount = 0;
*aOutArray = nullptr;
nsCOMArray<nsIEventListenerInfo> listenerInfos;
EventListenerManager* elm = aEventTarget->GetExistingListenerManager();
if (elm) {
elm->GetListenerInfo(&listenerInfos);
}
int32_t count = listenerInfos.Count();
if (count == 0) {
return NS_OK;
}
listenerInfos.Forget(aOutArray);
*aCount = count;
return NS_OK;
}