本文整理汇总了C++中nsACString::EndWriting方法的典型用法代码示例。如果您正苦于以下问题:C++ nsACString::EndWriting方法的具体用法?C++ nsACString::EndWriting怎么用?C++ nsACString::EndWriting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsACString
的用法示例。
在下文中一共展示了nsACString::EndWriting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SplitLastSquareBracket
/** Takes an ASCII string like "foo[i]", turns it into "foo" and returns "[i]" in bracketPart
*
* \param string input/output: the string to split, becomes the string without the bracket part
* \param bracketPart output: gets the bracket part.
*
* Notice that if there are multiple brackets like "foo[i].bar[j]", only the last bracket is split.
*/
static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart)
{
MOZ_ASSERT(bracketPart.IsEmpty(), "SplitLastSquareBracket must be called with empty bracketPart string");
if (string.IsEmpty())
return false;
char *string_start = string.BeginWriting();
char *s = string_start + string.Length() - 1;
if (*s != ']')
return false;
while (*s != '[' && s != string_start)
s--;
if (*s != '[')
return false;
bracketPart.Assign(s);
*s = 0;
string.EndWriting();
string.SetLength(s - string_start);
return true;
}
示例2: converter
void
ToLowerCase(const nsACString& aSource, nsACString& aDest)
{
nsACString::const_iterator fromBegin, fromEnd;
nsACString::iterator toBegin, toEnd;
aDest.SetLength(aSource.Length());
CopyToLowerCase converter(aDest.BeginWriting(toBegin), aDest.EndWriting(toEnd));
copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
converter);
}
示例3: ReverseString
void ReverseString(const nsACString& aSource, nsACString& aResult) {
nsACString::const_iterator sourceBegin, sourceEnd;
aSource.BeginReading(sourceBegin);
aSource.EndReading(sourceEnd);
aResult.SetLength(aSource.Length());
auto destEnd = aResult.EndWriting();
while (sourceBegin != sourceEnd) {
*(--destEnd) = *sourceBegin;
++sourceBegin;
}
}