本文整理汇总了C++中nsAutoPtr::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAutoPtr::Get方法的具体用法?C++ nsAutoPtr::Get怎么用?C++ nsAutoPtr::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAutoPtr
的用法示例。
在下文中一共展示了nsAutoPtr::Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BluetoothEventObserverList
nsresult
RegisterBluetoothEventHandler(const nsCString& aNodeName,
BluetoothEventObserver* aHandler)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothEventObserverList *ol;
NS_ENSURE_TRUE(sBluetoothEventObserverTable, NS_ERROR_FAILURE);
if (!sBluetoothEventObserverTable->Get(aNodeName, &ol)) {
sBluetoothEventObserverTable->Put(aNodeName,
new BluetoothEventObserverList());
}
sBluetoothEventObserverTable->Get(aNodeName, &ol);
ol->AddObserver(aHandler);
return NS_OK;
}
示例2:
nsresult
UnregisterBluetoothEventHandler(const nsCString& aNodeName,
BluetoothEventObserver* aHandler)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothEventObserverList *ol;
NS_ENSURE_TRUE(sBluetoothEventObserverTable, NS_ERROR_FAILURE);
if (!sBluetoothEventObserverTable->Get(aNodeName, &ol)) {
NS_WARNING("Node does not exist to remove BluetoothEventListener from!");
return NS_ERROR_FAILURE;
}
sBluetoothEventObserverTable->Get(aNodeName, &ol);
ol->RemoveObserver(aHandler);
if (ol->Length() == 0) {
sBluetoothEventObserverTable->Remove(aNodeName);
}
return NS_OK;
}
示例3: Run
NS_IMETHOD Run()
{
if (dbus_message_get_path(mMsg.get()) == NULL) {
return NS_OK;
}
MOZ_ASSERT(NS_IsMainThread());
// Notify observers that a message has been sent
nsDependentCString path(dbus_message_get_path(mMsg.get()));
nsDependentCString member(dbus_message_get_member(mMsg.get()));
BluetoothEventObserverList *ol;
if (!sBluetoothEventObserverTable->Get(path, &ol)) {
LOG("No objects registered for %s, returning\n",
dbus_message_get_path(mMsg.get()));
return NS_OK;
}
BluetoothEvent e;
e.mEventName = member;
ol->Broadcast(e);
return NS_OK;
}