本文整理汇总了C++中AtomArray::AppendElement方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomArray::AppendElement方法的具体用法?C++ AtomArray::AppendElement怎么用?C++ AtomArray::AppendElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomArray
的用法示例。
在下文中一共展示了AtomArray::AppendElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
nsresult
nsTreeUtils::TokenizeProperties(const nsAString& aProperties, AtomArray & aPropertiesArray)
{
nsAString::const_iterator end;
aProperties.EndReading(end);
nsAString::const_iterator iter;
aProperties.BeginReading(iter);
do {
// Skip whitespace
while (iter != end && nsCRT::IsAsciiSpace(*iter))
++iter;
// If only whitespace, we're done
if (iter == end)
break;
// Note the first non-whitespace character
nsAString::const_iterator first = iter;
// Advance to the next whitespace character
while (iter != end && ! nsCRT::IsAsciiSpace(*iter))
++iter;
// XXX this would be nonsensical
NS_ASSERTION(iter != first, "eh? something's wrong here");
if (iter == first)
break;
nsCOMPtr<nsIAtom> atom = do_GetAtom(Substring(first, iter));
aPropertiesArray.AppendElement(atom);
} while (iter != end);
return NS_OK;
}
示例2: start
void
nsAttrValue::ParseAtomArray(const nsAString& aValue)
{
nsAString::const_iterator iter, end;
aValue.BeginReading(iter);
aValue.EndReading(end);
PRBool hasSpace = PR_FALSE;
// skip initial whitespace
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
hasSpace = PR_TRUE;
++iter;
}
if (iter == end) {
SetTo(aValue);
return;
}
nsAString::const_iterator start(iter);
// get first - and often only - atom
do {
++iter;
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
nsCOMPtr<nsIAtom> classAtom = do_GetAtom(Substring(start, iter));
if (!classAtom) {
Reset();
return;
}
// skip whitespace
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
hasSpace = PR_TRUE;
++iter;
}
if (iter == end && !hasSpace) {
// we only found one classname and there was no whitespace so
// don't bother storing a list
ResetIfSet();
nsIAtom* atom = nsnull;
classAtom.swap(atom);
SetPtrValueAndType(atom, eAtomBase);
return;
}
if (!EnsureEmptyAtomArray()) {
return;
}
AtomArray* array = GetAtomArrayValue();
if (!array->AppendElement(classAtom)) {
Reset();
return;
}
// parse the rest of the classnames
while (iter != end) {
start = iter;
do {
++iter;
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
classAtom = do_GetAtom(Substring(start, iter));
if (!array->AppendElement(classAtom)) {
Reset();
return;
}
// skip whitespace
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
++iter;
}
}
SetMiscAtomOrString(&aValue);
return;
}