本文整理汇总了C++中nsAString::AssignASCII方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAString::AssignASCII方法的具体用法?C++ nsAString::AssignASCII怎么用?C++ nsAString::AssignASCII使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAString
的用法示例。
在下文中一共展示了nsAString::AssignASCII方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
nsresult
GonkCameraParameters::MapIsoFromGonk(const char* aIso, nsAString& aIsoOut)
{
if (strcmp(aIso, "ISO_HJR") == 0) {
aIsoOut.AssignASCII("hjr");
} else if (strcmp(aIso, "auto") == 0) {
aIsoOut.AssignASCII("auto");
} else {
unsigned int iso;
if (sscanf(aIso, "ISO%u", &iso) != 1) {
return NS_ERROR_INVALID_ARG;
}
aIsoOut.AppendInt(iso);
}
return NS_OK;
}
示例2:
NS_IMETHODIMP
nsDOMDataTransfer::GetEffectAllowed(nsAString& aEffectAllowed)
{
if (mEffectAllowed == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED)
aEffectAllowed.AssignLiteral("uninitialized");
else
aEffectAllowed.AssignASCII(sEffects[mEffectAllowed]);
return NS_OK;
}
示例3: switch
/* static */ bool
GonkRecorderProfile::Translate(output_format aContainer, nsAString& aContainerName)
{
switch (aContainer) {
case OUTPUT_FORMAT_THREE_GPP:
aContainerName.AssignASCII("3gp");
break;
case OUTPUT_FORMAT_MPEG_4:
aContainerName.AssignASCII("mp4");
break;
default:
return false;
}
return true;
}
示例4:
void
GeneratePermissionName(nsAString& aPermission,
const nsAString& aName,
const nsAString& aManifestURL)
{
aPermission.AssignASCII("indexedDB-chrome-");
aPermission.Append(aName);
aPermission.AppendASCII("|");
aPermission.Append(aManifestURL);
}
示例5: GetParameterConstChar
nsresult
CameraControlImpl::Get(uint32_t aKey, nsAString& aValue)
{
const char* value = GetParameterConstChar(aKey);
if (!value) {
return NS_ERROR_FAILURE;
}
aValue.AssignASCII(value);
return NS_OK;
}
示例6: GetImpl
nsresult
GonkCameraParameters::GetTranslated(uint32_t aKey, nsAString& aValue)
{
const char* val;
nsresult rv = GetImpl(aKey, val);
if (NS_FAILED(rv)) {
return rv;
}
aValue.AssignASCII(val);
return NS_OK;
}
示例7: GetParameterConstChar
nsresult
nsCameraControl::GetHelper(PRUint32 aKey, nsAString& aValue)
{
const char* value = GetParameterConstChar(aKey);
if (!value) {
return NS_ERROR_FAILURE;
}
aValue.AssignASCII(value);
return NS_OK;
}
示例8:
static void
GetAlignString(nsAString& aAlignString, PRUint16 aAlign)
{
NS_ASSERTION(
aAlign >= nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE &&
aAlign <= nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX,
"Unknown align");
aAlignString.AssignASCII(
sAlignStrings[aAlign -
nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE]);
}
示例9: if
nsresult
GonkCameraParameters::MapIsoFromGonk(const char* aIso, nsAString& aIsoOut)
{
if (strcmp(aIso, "ISO_HJR") == 0) {
aIsoOut.AssignASCII("hjr");
} else if (strcmp(aIso, "auto") == 0) {
aIsoOut.AssignASCII("auto");
} else {
unsigned int iso;
char ignored;
// Some camera libraries return ISO modes as "ISO100", others as "100".
if (sscanf(aIso, "ISO%u%c", &iso, &ignored) != 1 &&
sscanf(aIso, "%u%c", &iso, &ignored) != 1) {
return NS_ERROR_INVALID_ARG;
}
aIsoOut.Truncate(0);
aIsoOut.AppendInt(iso);
}
return NS_OK;
}
示例10:
static void
GetErrorString(nsresult rv, nsAString& errorString)
{
for (size_t i = 0; i < ArrayLength(socketTransportStatuses); ++i) {
if (socketTransportStatuses[i].key == rv) {
errorString.AssignASCII(socketTransportStatuses[i].error);
return;
}
}
nsAutoCString errorCString;
mozilla::GetErrorName(rv, errorCString);
CopyUTF8toUTF16(errorCString, errorString);
}
示例11:
/* static */ void
AudioChannelService::GetDefaultAudioChannelString(nsAString& aString)
{
aString.AssignASCII("normal");
nsString audioChannel = Preferences::GetString("media.defaultAudioChannel");
if (!audioChannel.IsEmpty()) {
for (uint32_t i = 0; kMozAudioChannelAttributeTable[i].tag; ++i) {
if (audioChannel.EqualsASCII(kMozAudioChannelAttributeTable[i].tag)) {
aString = audioChannel;
break;
}
}
}
}
示例12: GetImpl
nsresult
GonkCameraParameters::GetTranslated(uint32_t aKey, nsAString& aValue)
{
const char* val;
nsresult rv = GetImpl(aKey, val);
if (NS_FAILED(rv)) {
return rv;
}
if (aKey == CAMERA_PARAM_ISOMODE) {
rv = MapIsoFromGonk(val, aValue);
} else if(val) {
aValue.AssignASCII(val);
} else {
aValue.Truncate(0);
}
return rv;
}
示例13: switch
void
BluetoothUnixSocketConnector::GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr)
{
char addr[18];
switch (mType) {
case BluetoothSocketType::RFCOMM:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.rc.rc_bdaddr), addr);
break;
case BluetoothSocketType::SCO:
get_bdaddr_as_string((bdaddr_t*)(&aAddr.sco.sco_bdaddr), addr);
break;
default:
MOZ_NOT_REACHED("Socket should be either RFCOMM or SCO!");
}
aAddrStr.AssignASCII(addr);
}
示例14:
NS_IMETHODIMP
nsDOMDataChannel::GetReadyState(nsAString& aReadyState)
{
uint16_t readyState = mDataChannel->GetReadyState();
// From the WebRTC spec
const char * stateName[] = {
"connecting",
"open",
"closing",
"closed"
};
MOZ_ASSERT(/*readyState >= mozilla::DataChannel::CONNECTING && */ // Always true due to datatypes
readyState <= mozilla::DataChannel::CLOSED);
aReadyState.AssignASCII(stateName[readyState]);
return NS_OK;
}
示例15:
/* readonly attribute DOMString adapterDescription; */
NS_IMETHODIMP
GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
{
aAdapterDescription.AssignASCII(mozilla::gl::GetVendor());
if (mozilla::AndroidBridge::Bridge()) {
nsAutoString str;
aAdapterDescription.Append(NS_LITERAL_STRING(" "));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING(" "));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING(" "));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
aAdapterDescription.Append(str);
}
return NS_OK;
}