本文整理汇总了C++中nsAString::EndWriting方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAString::EndWriting方法的具体用法?C++ nsAString::EndWriting怎么用?C++ nsAString::EndWriting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAString
的用法示例。
在下文中一共展示了nsAString::EndWriting方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TX_ToLowerCase
void TX_ToLowerCase(nsAString& aString)
{
nsAString::iterator fromBegin, fromEnd;
ConvertToLowerCase converter;
copy_string(aString.BeginWriting(fromBegin), aString.EndWriting(fromEnd),
converter);
}
示例2: while
//.........这里部分代码省略.........
attrs->Item(i, getter_AddRefs(temp));
if (!temp)
break;
temp->GetNamespaceURI(tstr);
if (!tstr.Equals(gSOAPStrings->kXMLNamespaceNamespaceURI))
continue;
temp->GetNodeValue(tstr);
if (tstr.Equals(externalURI)) {
nsAutoString prefix;
rc = temp->GetLocalName(prefix);
if (NS_FAILED(rc))
return rc;
nsCOMPtr<nsIDOMNode> check = aScope;
PRBool hasDecl;
nsCOMPtr<nsIDOMElement> echeck;
while (check != current) { // Make sure prefix is not overridden
echeck = do_QueryInterface(check);
if (echeck) {
rc = echeck->
HasAttributeNS(gSOAPStrings->kXMLNamespaceNamespaceURI, prefix,
&hasDecl);
if (NS_FAILED(rc))
return rc;
if (hasDecl)
break;
echeck->GetParentNode(getter_AddRefs(check));
}
}
if (check == current) {
aPrefix.Assign(prefix);
return NS_OK;
}
}
rc = temp->GetLocalName(tstr);
if (NS_FAILED(rc))
return rc;
else { // Decode the generated namespace into a number
nsReadingIterator < PRUnichar > i1;
nsReadingIterator < PRUnichar > i2;
tstr.BeginReading(i1);
tstr.EndReading(i2);
if (i1 == i2 || *i1 != 'n')
continue;
i1++;
if (i1 == i2 || *i1 != 's')
continue;
i1++;
PRUint32 n = 0;
while (i1 != i2) {
PRUnichar c = *i1;
i1++;
if (c < '0' || c > '9') {
n = 0;
break;
}
n = n * 10 + (c - '0');
}
if (n > maxns)
maxns = n;
}
}
}
current->GetParentNode(getter_AddRefs(temp));
if (temp)
current = temp;
else
break;
}
// Create a unique prefix...
PRUint32 len = 3;
PRUint32 c = maxns + 1;
while (c >= 10) {
c = c / 10;
len++;
}
// Set the length and write it backwards since that's the easiest way..
aPrefix.SetLength(len);
nsWritingIterator < PRUnichar > i2;
aPrefix.EndWriting(i2);
c = maxns + 1;
while (c > 0) {
PRUint32 r = c % 10;
c = c / 10;
i2--;
*i2 = (PRUnichar) (r + '0');
}
i2--;
*i2 = 's';
i2--;
*i2 = 'n';
// Declare the fabricated prefix
if (aScope) {
tstr.Assign(gSOAPStrings->kXMLNamespacePrefix);
tstr.Append(aPrefix);
rc = aScope->SetAttributeNS(gSOAPStrings->kXMLNamespaceNamespaceURI,
tstr, externalURI);
}
return NS_OK;
}