本文整理汇总了C++中nsAString::AppendLiteral方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAString::AppendLiteral方法的具体用法?C++ nsAString::AppendLiteral怎么用?C++ nsAString::AppendLiteral使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAString
的用法示例。
在下文中一共展示了nsAString::AppendLiteral方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessListStyleTypeValue
static
void ProcessListStyleTypeValue(const nsAString * aInputString, nsAString & aOutputString,
const char * aDefaultValueString,
const char * aPrependString, const char* aAppendString)
{
aOutputString.Truncate();
if (aInputString) {
if (aInputString->EqualsLiteral("1")) {
aOutputString.AppendLiteral("decimal");
}
else if (aInputString->EqualsLiteral("a")) {
aOutputString.AppendLiteral("lower-alpha");
}
else if (aInputString->EqualsLiteral("A")) {
aOutputString.AppendLiteral("upper-alpha");
}
else if (aInputString->EqualsLiteral("i")) {
aOutputString.AppendLiteral("lower-roman");
}
else if (aInputString->EqualsLiteral("I")) {
aOutputString.AppendLiteral("upper-roman");
}
else if (aInputString->EqualsLiteral("square")
|| aInputString->EqualsLiteral("circle")
|| aInputString->EqualsLiteral("disc")) {
aOutputString.Append(*aInputString);
}
}
}
示例2: toString
void RelationalExpr::toString(nsAString& str) {
mLeftExpr->toString(str);
switch (mOp) {
case NOT_EQUAL:
str.AppendLiteral("!=");
break;
case LESS_THAN:
str.Append(char16_t('<'));
break;
case LESS_OR_EQUAL:
str.AppendLiteral("<=");
break;
case GREATER_THAN:
str.Append(char16_t('>'));
break;
case GREATER_OR_EQUAL:
str.AppendLiteral(">=");
break;
default:
str.Append(char16_t('='));
break;
}
mRightExpr->toString(str);
}
示例3: GetMaximumValue
NS_IMETHODIMP
nsXULProgressMeterAccessible::GetValue(nsAString& aValue)
{
nsresult rv = nsFormControlAccessible::GetValue(aValue);
NS_ENSURE_SUCCESS(rv, rv);
if (!aValue.IsEmpty())
return NS_OK;
double maxValue = 0;
rv = GetMaximumValue(&maxValue);
NS_ENSURE_SUCCESS(rv, rv);
if (maxValue != 1) {
double curValue = 0;
rv = GetCurrentValue(&curValue);
NS_ENSURE_SUCCESS(rv, rv);
double percentValue = (curValue / maxValue) * 100;
nsAutoString value;
value.AppendFloat(percentValue); // AppendFloat isn't available on nsAString
value.AppendLiteral("%");
aValue = value;
return NS_OK;
}
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aValue);
if (aValue.IsEmpty())
aValue.AppendLiteral("0"); // Empty value for progress meter = 0%
aValue.AppendLiteral("%");
return NS_OK;
}
示例4: escapedLeftValue
NS_IMETHODIMP
sbSQLBuilderCriterionBetweenString::ToString(nsAString& _retval)
{
AppendTableColumnTo(_retval);
if (mNegate) {
_retval.AppendLiteral(" not ");
}
_retval.AppendLiteral(" between ");
nsAutoString escapedLeftValue(mLeftValue);
SB_EscapeSQL(escapedLeftValue);
nsAutoString escapedRightValue(mRightValue);
SB_EscapeSQL(escapedRightValue);
_retval.AppendLiteral("'");
_retval.Append(mLeftValue);
_retval.AppendLiteral("' and '");
_retval.Append(mRightValue);
_retval.AppendLiteral("'");
return NS_OK;
}
示例5: switch
void
txNumberExpr::toString(nsAString& str)
{
mLeftExpr->toString(str);
switch (mOp) {
case ADD:
str.AppendLiteral(" + ");
break;
case SUBTRACT:
str.AppendLiteral(" - ");
break;
case DIVIDE:
str.AppendLiteral(" div ");
break;
case MODULUS:
str.AppendLiteral(" mod ");
break;
case MULTIPLY:
str.AppendLiteral(" * ");
break;
}
mRightExpr->toString(str);
}
示例6: switch
void
txNodeTypeTest::toString(nsAString& aDest)
{
switch (mNodeType) {
case COMMENT_TYPE:
aDest.AppendLiteral("comment()");
break;
case TEXT_TYPE:
aDest.AppendLiteral("text()");
break;
case PI_TYPE:
aDest.AppendLiteral("processing-instruction(");
if (mNodeName) {
nsAutoString str;
mNodeName->ToString(str);
aDest.Append(char16_t('\''));
aDest.Append(str);
aDest.Append(char16_t('\''));
}
aDest.Append(char16_t(')'));
break;
case NODE_TYPE:
aDest.AppendLiteral("node()");
break;
}
}
示例7:
nsresult
nsDOMFileReader::GetAsDataURL(nsIDOMBlob *aFile,
const char *aFileData,
uint32_t aDataLen,
nsAString& aResult)
{
aResult.AssignLiteral("data:");
nsresult rv;
nsString contentType;
rv = aFile->GetType(contentType);
if (NS_SUCCEEDED(rv) && !contentType.IsEmpty()) {
aResult.Append(contentType);
} else {
aResult.AppendLiteral("application/octet-stream");
}
aResult.AppendLiteral(";base64,");
nsCString encodedData;
rv = Base64Encode(Substring(aFileData, aDataLen), encodedData);
NS_ENSURE_SUCCESS(rv, rv);
if (!AppendASCIItoUTF16(encodedData, aResult, fallible_t())) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
示例8: escapedURL
NS_IMETHODIMP
nsCSSDocumentRule::GetCssText(nsAString& aCssText)
{
aCssText.AssignLiteral("@-moz-document ");
for (URL *url = mURLs; url; url = url->next) {
switch (url->func) {
case eURL:
aCssText.AppendLiteral("url(\"");
break;
case eURLPrefix:
aCssText.AppendLiteral("url-prefix(\"");
break;
case eDomain:
aCssText.AppendLiteral("domain(\"");
break;
}
nsCAutoString escapedURL(url->url);
escapedURL.ReplaceSubstring("\"", "\\\""); // escape quotes
AppendUTF8toUTF16(escapedURL, aCssText);
aCssText.AppendLiteral("\"), ");
}
aCssText.Cut(aCssText.Length() - 2, 1); // remove last ,
return nsCSSGroupRule::AppendRulesToCssText(aCssText);
}
示例9: switch
NS_IMETHODIMP
nsSVGPreserveAspectRatio::GetValueString(nsAString& aValue)
{
// XXX: defer isn't stored
switch (mAlign) {
case SVG_PRESERVEASPECTRATIO_NONE:
aValue.AssignLiteral("none");
break;
case SVG_PRESERVEASPECTRATIO_XMINYMIN:
aValue.AssignLiteral("xMinYMin");
break;
case SVG_PRESERVEASPECTRATIO_XMIDYMIN:
aValue.AssignLiteral("xMidYMin");
break;
case SVG_PRESERVEASPECTRATIO_XMAXYMIN:
aValue.AssignLiteral("xMaxYMin");
break;
case SVG_PRESERVEASPECTRATIO_XMINYMID:
aValue.AssignLiteral("xMinYMid");
break;
case SVG_PRESERVEASPECTRATIO_XMIDYMID:
aValue.AssignLiteral("xMidYMid");
break;
case SVG_PRESERVEASPECTRATIO_XMAXYMID:
aValue.AssignLiteral("xMaxYMid");
break;
case SVG_PRESERVEASPECTRATIO_XMINYMAX:
aValue.AssignLiteral("xMinYMax");
break;
case SVG_PRESERVEASPECTRATIO_XMIDYMAX:
aValue.AssignLiteral("xMidYMax");
break;
case SVG_PRESERVEASPECTRATIO_XMAXYMAX:
aValue.AssignLiteral("xMaxYMax");
break;
default:
NS_NOTREACHED("Unknown value for mAlign");
}
// XXX: meetOrSlice may not have been specified in the attribute
if (mAlign != SVG_PRESERVEASPECTRATIO_NONE) {
switch (mMeetOrSlice) {
case SVG_MEETORSLICE_MEET:
aValue.AppendLiteral(" meet");
break;
case SVG_MEETORSLICE_SLICE:
aValue.AppendLiteral(" slice");
break;
default:
NS_NOTREACHED("Unknown value for mMeetOrSlice");
}
}
return NS_OK;
}
示例10: GetDeviceInfoNodes
//-------------------------------------
//
// GetExcludedFolders
//
nsresult
sbDeviceXMLInfo::GetExcludedFolders(nsAString & aExcludedFolders)
{
nsresult rv;
aExcludedFolders.Truncate();
// Do nothing more if no device info element.
if (!mDeviceInfoElement)
return NS_OK;
// Get the list of exclude folder nodes.
nsTArray< nsCOMPtr<nsIDOMNode> > excludeNodeList;
rv = GetDeviceInfoNodes(NS_LITERAL_STRING("excludefolder"), excludeNodeList);
NS_ENSURE_SUCCESS(rv, rv);
// Get all excluded folders.
PRUint32 nodeCount = excludeNodeList.Length();
const char * delimiter = "";
for (PRUint32 i = 0; i < nodeCount; i++) {
// Get the next exclude folder element.
nsCOMPtr<nsIDOMElement> excludeElement;
excludeElement = do_QueryInterface(excludeNodeList[i], &rv);
if (NS_SUCCEEDED(rv)) {
nsString excludeStr;
// The url attribute, if present, will contain a literal path.
// Remove any leading slash to distinguish literal paths from
// patterns
rv = excludeElement->GetAttribute(NS_LITERAL_STRING("url"), excludeStr);
NS_ENSURE_SUCCESS(rv, rv);
if (excludeStr.Length() > 0 && excludeStr[0] == L'/') {
excludeStr.Cut(0, 1);
}
if (!excludeStr.IsEmpty()) {
aExcludedFolders.AppendLiteral(delimiter);
aExcludedFolders.Append(excludeStr);
delimiter = ",";
}
// The match attribute, if present, will contain a folder name pattern.
// Add a leading and trailing slash to distinguish patterns from literal
// paths. The pattern itself may not contain any slashes
rv = excludeElement->GetAttribute(NS_LITERAL_STRING("match"), excludeStr);
NS_ENSURE_SUCCESS(rv, rv);
if (!excludeStr.IsEmpty() && excludeStr.Find("/") == -1) {
aExcludedFolders.AppendLiteral(delimiter);
aExcludedFolders.AppendLiteral("/");
aExcludedFolders.Append(excludeStr);
aExcludedFolders.AppendLiteral("/");
delimiter = ",";
}
}
}
return NS_OK;
}
示例11: switch
void
sbSQLBuilderCriterionBase::AppendMatchTo(nsAString& aStr)
{
switch(mMatchType) {
case sbISQLWhereBuilder::MATCH_EQUALS:
aStr.AppendLiteral(" = ");
break;
case sbISQLWhereBuilder::MATCH_NOTEQUALS:
aStr.AppendLiteral(" != ");
break;
case sbISQLWhereBuilder::MATCH_GREATER:
aStr.AppendLiteral(" > ");
break;
case sbISQLWhereBuilder::MATCH_GREATEREQUAL:
aStr.AppendLiteral(" >= ");
break;
case sbISQLWhereBuilder::MATCH_LESS:
aStr.AppendLiteral(" < ");
break;
case sbISQLWhereBuilder::MATCH_LESSEQUAL:
aStr.AppendLiteral(" <= ");
break;
case sbISQLWhereBuilder::MATCH_LIKE:
aStr.AppendLiteral(" like ");
break;
case sbISQLWhereBuilder::MATCH_NOTLIKE:
aStr.AppendLiteral(" not like ");
break;
case sbISQLWhereBuilder::MATCH_MATCH:
aStr.AppendLiteral(" match ");
break;
default:
NS_NOTREACHED("Unknown Match Type");
}
}
示例12: toString
void txUnionPattern::toString(nsAString& aDest) {
# ifdef DEBUG
aDest.AppendLiteral("txUnionPattern{");
# endif
for (uint32_t i = 0; i < mLocPathPatterns.Length(); ++i) {
if (i != 0) aDest.AppendLiteral(" | ");
mLocPathPatterns[i]->toString(aDest);
}
# ifdef DEBUG
aDest.Append(char16_t('}'));
# endif
}
示例13: GetTxnDescription
NS_IMETHODIMP ChangeCSSInlineStyleTxn::GetTxnDescription(nsAString& aString)
{
aString.AssignLiteral("ChangeCSSInlineStyleTxn: [mRemoveProperty == ");
if (!mRemoveProperty)
aString.AppendLiteral("false] ");
else
aString.AppendLiteral("true] ");
nsAutoString tempString;
mProperty->ToString(tempString);
aString += tempString;
return NS_OK;
}
示例14: nsDependentAtomString
NS_IMETHODIMP
ChangeAttributeTxn::GetTxnDescription(nsAString& aString)
{
aString.AssignLiteral("ChangeAttributeTxn: [mRemoveAttribute == ");
if (mRemoveAttribute) {
aString.AppendLiteral("true] ");
} else {
aString.AppendLiteral("false] ");
}
aString += nsDependentAtomString(mAttribute);
return NS_OK;
}
示例15: nsDependentAtomString
NS_IMETHODIMP
ChangeStyleTxn::GetTxnDescription(nsAString& aString)
{
aString.AssignLiteral("ChangeStyleTxn: [mRemoveProperty == ");
if (mRemoveProperty) {
aString.AppendLiteral("true] ");
} else {
aString.AppendLiteral("false] ");
}
aString += nsDependentAtomString(mProperty);
return NS_OK;
}