本文整理汇总了C++中nsAString::AppendPrintf方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAString::AppendPrintf方法的具体用法?C++ nsAString::AppendPrintf怎么用?C++ nsAString::AppendPrintf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAString
的用法示例。
在下文中一共展示了nsAString::AppendPrintf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
CharacterData::ToCString(nsAString& aBuf, int32_t aOffset,
int32_t aLen) const
{
if (mText.Is2b()) {
const char16_t* cp = mText.Get2b() + aOffset;
const char16_t* end = cp + aLen;
while (cp < end) {
char16_t ch = *cp++;
if (ch == '&') {
aBuf.AppendLiteral("&");
} else if (ch == '<') {
aBuf.AppendLiteral("<");
} else if (ch == '>') {
aBuf.AppendLiteral(">");
} else if ((ch < ' ') || (ch >= 127)) {
aBuf.AppendPrintf("\\u%04x", ch);
} else {
aBuf.Append(ch);
}
}
} else {
unsigned char* cp = (unsigned char*)mText.Get1b() + aOffset;
const unsigned char* end = cp + aLen;
while (cp < end) {
char16_t ch = *cp++;
if (ch == '&') {
aBuf.AppendLiteral("&");
} else if (ch == '<') {
aBuf.AppendLiteral("<");
} else if (ch == '>') {
aBuf.AppendLiteral(">");
} else if ((ch < ' ') || (ch >= 127)) {
aBuf.AppendPrintf("\\u%04x", ch);
} else {
aBuf.Append(ch);
}
}
}
}
示例2: defined
//.........这里部分代码省略.........
if (!info[i].mManufacturer.IsEmpty() && !info[i].mManufacturer.Equals(Manufacturer())) {
continue;
}
#if defined(XP_WIN) || defined(ANDROID)
switch (info[i].mComparisonOp) {
case DRIVER_LESS_THAN:
match = driverVersion < info[i].mDriverVersion;
break;
case DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN:
match = driverVersion > info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN_OR_EQUAL:
match = driverVersion >= info[i].mDriverVersion;
break;
case DRIVER_EQUAL:
match = driverVersion == info[i].mDriverVersion;
break;
case DRIVER_NOT_EQUAL:
match = driverVersion != info[i].mDriverVersion;
break;
case DRIVER_BETWEEN_EXCLUSIVE:
match = driverVersion > info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE:
match = driverVersion >= info[i].mDriverVersion && driverVersion <= info[i].mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE_START:
match = driverVersion >= info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
break;
case DRIVER_COMPARISON_IGNORED:
// We don't have a comparison op, so we match everything.
match = true;
break;
default:
NS_WARNING("Bogus op in GfxDriverInfo");
break;
}
#else
// We don't care what driver version it was. We only check OS version and if
// the device matches.
match = true;
#endif
if (match || info[i].mDriverVersion == GfxDriverInfo::allDriverVersions) {
if (info[i].mFeature == GfxDriverInfo::allFeatures ||
info[i].mFeature == aFeature)
{
status = info[i].mFeatureStatus;
if (!info[i].mRuleId.IsEmpty()) {
aFailureId = info[i].mRuleId.get();
} else {
aFailureId = "FEATURE_FAILURE_DL_BLACKLIST_NO_ID";
}
break;
}
}
}
#if defined(XP_WIN)
// As a very special case, we block D2D on machines with an NVidia 310M GPU
// as either the primary or secondary adapter. D2D is also blocked when the
// NV 310M is the primary adapter (using the standard blocklisting mechanism).
// If the primary GPU already matched something in the blocklist then we
// ignore this special rule. See bug 1008759.
if (status == nsIGfxInfo::FEATURE_STATUS_UNKNOWN &&
(aFeature == nsIGfxInfo::FEATURE_DIRECT2D)) {
nsAutoString adapterVendorID2;
nsAutoString adapterDeviceID2;
if ((!NS_FAILED(GetAdapterVendorID2(adapterVendorID2))) &&
(!NS_FAILED(GetAdapterDeviceID2(adapterDeviceID2))))
{
nsAString &nvVendorID = (nsAString &)GfxDriverInfo::GetDeviceVendor(VendorNVIDIA);
const nsString nv310mDeviceId = NS_LITERAL_STRING("0x0A70");
if (nvVendorID.Equals(adapterVendorID2, nsCaseInsensitiveStringComparator()) &&
nv310mDeviceId.Equals(adapterDeviceID2, nsCaseInsensitiveStringComparator())) {
status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
aFailureId = "FEATURE_FAILURE_D2D_NV310M_BLOCK";
}
}
}
// Depends on Windows driver versioning. We don't pass a GfxDriverInfo object
// back to the Windows handler, so we must handle this here.
if (status == FEATURE_BLOCKED_DRIVER_VERSION) {
if (info[i].mSuggestedVersion) {
aSuggestedVersion.AppendPrintf("%s", info[i].mSuggestedVersion);
} else if (info[i].mComparisonOp == DRIVER_LESS_THAN &&
info[i].mDriverVersion != GfxDriverInfo::allDriverVersions)
{
aSuggestedVersion.AppendPrintf("%lld.%lld.%lld.%lld",
(info[i].mDriverVersion & 0xffff000000000000) >> 48,
(info[i].mDriverVersion & 0x0000ffff00000000) >> 32,
(info[i].mDriverVersion & 0x00000000ffff0000) >> 16,
(info[i].mDriverVersion & 0x000000000000ffff));
}
}
示例3: ParseDriverVersion
//.........这里部分代码省略.........
}
if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) {
bool deviceMatches = false;
for (uint32_t j = 0; j < info[i].mDevices->Length(); j++) {
if ((*info[i].mDevices)[j].Equals(adapterDeviceID, nsCaseInsensitiveStringComparator())) {
deviceMatches = true;
break;
}
}
if (!deviceMatches) {
continue;
}
}
bool match = false;
if (!info[i].mHardware.IsEmpty() && !info[i].mHardware.Equals(Hardware())) {
continue;
}
if (!info[i].mModel.IsEmpty() && !info[i].mModel.Equals(Model())) {
continue;
}
if (!info[i].mProduct.IsEmpty() && !info[i].mProduct.Equals(Product())) {
continue;
}
if (!info[i].mManufacturer.IsEmpty() && !info[i].mManufacturer.Equals(Manufacturer())) {
continue;
}
#if defined(XP_WIN) || defined(ANDROID)
switch (info[i].mComparisonOp) {
case DRIVER_LESS_THAN:
match = driverVersion < info[i].mDriverVersion;
break;
case DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN:
match = driverVersion > info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN_OR_EQUAL:
match = driverVersion >= info[i].mDriverVersion;
break;
case DRIVER_EQUAL:
match = driverVersion == info[i].mDriverVersion;
break;
case DRIVER_NOT_EQUAL:
match = driverVersion != info[i].mDriverVersion;
break;
case DRIVER_BETWEEN_EXCLUSIVE:
match = driverVersion > info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE:
match = driverVersion >= info[i].mDriverVersion && driverVersion <= info[i].mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE_START:
match = driverVersion >= info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
break;
case DRIVER_COMPARISON_IGNORED:
// We don't have a comparison op, so we match everything.
match = true;
break;
default:
NS_WARNING("Bogus op in GfxDriverInfo");
break;
}
#else
// We don't care what driver version it was. We only check OS version and if
// the device matches.
match = true;
#endif
if (match || info[i].mDriverVersion == GfxDriverInfo::allDriverVersions) {
if (info[i].mFeature == GfxDriverInfo::allFeatures ||
info[i].mFeature == aFeature)
{
status = info[i].mFeatureStatus;
break;
}
}
}
// Depends on Windows driver versioning. We don't pass a GfxDriverInfo object
// back to the Windows handler, so we must handle this here.
#if defined(XP_WIN)
if (status == FEATURE_BLOCKED_DRIVER_VERSION) {
if (info[i].mSuggestedVersion) {
aSuggestedVersion.AppendPrintf("%s", info[i].mSuggestedVersion);
} else if (info[i].mComparisonOp == DRIVER_LESS_THAN &&
info[i].mDriverVersion != GfxDriverInfo::allDriverVersions)
{
aSuggestedVersion.AppendPrintf("%lld.%lld.%lld.%lld",
(info[i].mDriverVersion & 0xffff000000000000) >> 48,
(info[i].mDriverVersion & 0x0000ffff00000000) >> 32,
(info[i].mDriverVersion & 0x00000000ffff0000) >> 16,
(info[i].mDriverVersion & 0x000000000000ffff));
}
}