本文整理汇总了C++中nsDataHashtable::Put方法的典型用法代码示例。如果您正苦于以下问题:C++ nsDataHashtable::Put方法的具体用法?C++ nsDataHashtable::Put怎么用?C++ nsDataHashtable::Put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsDataHashtable
的用法示例。
在下文中一共展示了nsDataHashtable::Put方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
template <class T> void
ExtractCommonNonCDMACellInfoItems(nsCOMPtr<T>& cell, nsDataHashtable<nsCStringHashKey, int32_t>& info)
{
int32_t mcc, mnc, cid, sig;
cell->GetMcc(&mcc);
cell->GetMnc(&mnc);
cell->GetCid(&cid);
cell->GetSignalStrength(&sig);
info.Put(TEXT_MCC, mcc);
info.Put(TEXT_MNC, mnc);
info.Put(TEXT_CID, cid);
info.Put(TEXT_STRENGTH_ASU, sig);
}
示例2: AddNameSpace
nsresult NameSpaceManagerImpl::AddNameSpace(const nsAString& aURI,
const PRInt32 aNameSpaceID)
{
if (aNameSpaceID < 0) {
// We've wrapped... Can't do anything else here; just bail.
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ASSERTION(aNameSpaceID - 1 == (PRInt32) mURIArray.Length(),
"BAD! AddNameSpace not called in right order!");
nsString* uri = new nsString(aURI);
if (!uri || !mURIArray.AppendElement(uri)) {
delete uri;
return NS_ERROR_OUT_OF_MEMORY;
}
if (!mURIToIDTable.Put(uri, aNameSpaceID)) {
mURIArray.RemoveElementAt(aNameSpaceID - 1);
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
示例3: switch
void
BluetoothServiceBluedroid::SspRequestNotification(
const nsAString& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod,
BluetoothSspVariant aPairingVariant, uint32_t aPasskey)
{
MOZ_ASSERT(NS_IsMainThread());
InfallibleTArray<BluetoothNamedValue> propertiesArray;
nsAutoString passkey;
nsAutoString pairingType;
/**
* Assign pairing request type and passkey based on the pairing variant.
*
* passkey value based on pairing request type:
* 1) aPasskey: PAIRING_REQ_TYPE_CONFIRMATION and
* PAIRING_REQ_TYPE_DISPLAYPASSKEY
* 2) empty string: PAIRING_REQ_TYPE_CONSENT
*/
switch (aPairingVariant) {
case SSP_VARIANT_PASSKEY_CONFIRMATION:
pairingType.AssignLiteral(PAIRING_REQ_TYPE_CONFIRMATION);
passkey.AppendInt(aPasskey);
break;
case SSP_VARIANT_PASSKEY_NOTIFICATION:
pairingType.AssignLiteral(PAIRING_REQ_TYPE_DISPLAYPASSKEY);
passkey.AppendInt(aPasskey);
break;
case SSP_VARIANT_CONSENT:
pairingType.AssignLiteral(PAIRING_REQ_TYPE_CONSENT);
break;
default:
BT_WARNING("Unhandled SSP Bonding Variant: %d", aPairingVariant);
return;
}
BT_APPEND_NAMED_VALUE(propertiesArray, "address", nsString(aRemoteBdAddr));
BT_APPEND_NAMED_VALUE(propertiesArray, "name", nsString(aBdName));
BT_APPEND_NAMED_VALUE(propertiesArray, "passkey", passkey);
BT_APPEND_NAMED_VALUE(propertiesArray, "type", pairingType);
sPairingNameTable.Put(nsString(aRemoteBdAddr), nsString(aBdName));
DistributeSignal(NS_LITERAL_STRING("PairingRequest"),
NS_LITERAL_STRING(KEY_PAIRING_LISTENER),
BluetoothValue(propertiesArray));
}
示例4: nsString
void
BluetoothServiceBluedroid::PinRequestNotification(const nsAString& aRemoteBdAddr,
const nsAString& aBdName,
uint32_t aCod)
{
MOZ_ASSERT(NS_IsMainThread());
InfallibleTArray<BluetoothNamedValue> propertiesArray;
BT_APPEND_NAMED_VALUE(propertiesArray, "address", nsString(aRemoteBdAddr));
BT_APPEND_NAMED_VALUE(propertiesArray, "name", nsString(aBdName));
BT_APPEND_NAMED_VALUE(propertiesArray, "passkey", EmptyString());
BT_APPEND_NAMED_VALUE(propertiesArray, "type",
NS_LITERAL_STRING(PAIRING_REQ_TYPE_ENTERPINCODE));
sPairingNameTable.Put(nsString(aRemoteBdAddr), nsString(aBdName));
DistributeSignal(NS_LITERAL_STRING("PairingRequest"),
NS_LITERAL_STRING(KEY_PAIRING_LISTENER),
BluetoothValue(propertiesArray));
}
示例5: AddNameSpace
nsresult NameSpaceManagerImpl::AddNameSpace(const nsAString& aURI,
const PRInt32 aNameSpaceID)
{
if (aNameSpaceID < 0) {
// We've wrapped... Can't do anything else here; just bail.
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ASSERTION(aNameSpaceID - 1 == mURIArray.Count(),
"BAD! AddNameSpace not called in right order!");
if (!mURIArray.AppendString(aURI)) {
return NS_ERROR_OUT_OF_MEMORY;
}
const nsString* uri = mURIArray.StringAt(aNameSpaceID - 1);
if (!mURIToIDTable.Put(uri, aNameSpaceID)) {
mURIArray.RemoveStringAt(aNameSpaceID - 1);
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
示例6: key
//.........这里部分代码省略.........
// if actualOverlap == 0.5
// 1 2 3
// +-------+-------+-------+---+
// | ##### | ***** | ##### |## |
// |#######|*******|##### C_n #|
// |###+###|***+***|###+###+###|
// |# C_0 #|* C_1 *|# C_2 #|###|
// | ##### | ***** | ##### |## |
// +-------+-------+-------+---+
// |
// V
// +-------+-+-------+-+-------+
// | ##### | | ##### | | ##### |
// |#######| |#######| |#######|
// |###+###| |###+###| |###+###| Even if we place C_1 at the middle
// |# C_0 #| |# C_1 #| |# C_n #| of them, it's too near from them
// | ##### | | ##### | | ##### |
// +-------+-+-------+-|-------+
// |
// V
// +-------+-----------+-------+
// | ##### | | ##### |
// |#######| |#######|
// |###+###| |###+###| Do not draw any circle
// |# C_0 #| |# C_n #|
// | ##### | | ##### |
// +-------+-----------+-------+
mCount = 0;
break;
}
// targetCount should be 2n, as we're searching C_1 to C_n.
//
// targetCount = 4
// mCount = 1
// 1 2 3 4
// +-------+-------+-------+-------+-------+
// | ##### | ***** | ##### | ***** | ##### |
// |#######|*******|#######|*******|#######|
// |###+###|***+***|###+###|***+***|###+###|
// |# C_0 #|* C_1 *|# C_2 #|* C_3 *|# C_n #|
// | ##### | ***** | ##### | ***** | ##### |
// +-------+-------+-------+-------+-------+
// 1
//
// targetCount = 6
// mCount = 2
// 1 2 3 4 5 6
// +-------+-------+-------+-------+-------+-------+-------+
// | ##### | ***** | ##### | ***** | ##### | ***** | ##### |
// |#######|*******|#######|*******|#######|*******|#######|
// |###+###|***+***|###+###|***+***|###+###|***+***|###+###|
// |# C_0 #|* C_1 *|# C_2 #|* C_3 *|# C_4 #|* C_5 *|# C_n #|
// | ##### | ***** | ##### | ***** | ##### | ***** | ##### |
// +-------+-------+-------+-------+-------+-------+-------+
// 1 2
if (count % 2) {
targetCount = count + 1;
} else {
targetCount = count;
}
mCount = targetCount / 2 - 1;
}
if (count == targetCount) {
mBestOverlap = overlap;
if (fabs(actualOverlap - overlap) < OVERLAP_MARGIN) {
break;
}
// We started from upper bound, no need to update range when j == 0.
if (j > 0) {
if (actualOverlap > overlap) {
lower = overlap;
} else {
upper = overlap;
}
}
} else {
// |j == 0 && count != targetCount| means that |targetCount = count + 1|,
// and we started from upper bound, no need to update range when j == 0.
if (j > 0) {
if (count > targetCount) {
upper = overlap;
} else {
lower = overlap;
}
}
}
overlap = (upper + lower) / 2.0f;
}
if (DottedCornerCache.Count() > DottedCornerCacheSize) {
DottedCornerCache.Clear();
}
DottedCornerCache.Put(key, BestOverlap(mBestOverlap, mCount));
}