本文整理汇总了C++中nsSubstring::EndReading方法的典型用法代码示例。如果您正苦于以下问题:C++ nsSubstring::EndReading方法的具体用法?C++ nsSubstring::EndReading怎么用?C++ nsSubstring::EndReading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsSubstring
的用法示例。
在下文中一共展示了nsSubstring::EndReading方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
bool
nsCoreUtils::IsWhitespaceString(const nsSubstring& aString)
{
nsSubstring::const_char_iterator iterBegin, iterEnd;
aString.BeginReading(iterBegin);
aString.EndReading(iterEnd);
while (iterBegin != iterEnd && IsWhitespace(*iterBegin))
++iterBegin;
return iterBegin == iterEnd;
}
示例2: if
/**
* Creates an Attribute Value Template using the given value
* This should move to XSLProcessor class
*/
nsresult
txExprParser::createAVT(const nsSubstring& aAttrValue,
txIParseContext* aContext,
Expr** aResult)
{
*aResult = nullptr;
nsresult rv = NS_OK;
nsAutoPtr<Expr> expr;
FunctionCall* concat = nullptr;
nsAutoString literalString;
bool inExpr = false;
nsSubstring::const_char_iterator iter, start, end, avtStart;
aAttrValue.BeginReading(iter);
aAttrValue.EndReading(end);
avtStart = iter;
while (iter != end) {
// Every iteration through this loop parses either a literal section
// or an expression
start = iter;
nsAutoPtr<Expr> newExpr;
if (!inExpr) {
// Parse literal section
literalString.Truncate();
while (iter != end) {
PRUnichar q = *iter;
if (q == '{' || q == '}') {
// Store what we've found so far and set a new |start| to
// skip the (first) brace
literalString.Append(Substring(start, iter));
start = ++iter;
// Unless another brace follows we've found the start of
// an expression (in case of '{') or an unbalanced brace
// (in case of '}')
if (iter == end || *iter != q) {
if (q == '}') {
aContext->SetErrorOffset(iter - avtStart);
return NS_ERROR_XPATH_UNBALANCED_CURLY_BRACE;
}
inExpr = true;
break;
}
// We found a second brace, let that be part of the next
// literal section being parsed and continue looping
}
++iter;
}
if (start == iter && literalString.IsEmpty()) {
// Restart the loop since we didn't create an expression
continue;
}
newExpr = new txLiteralExpr(literalString +
Substring(start, iter));
}
else {
// Parse expressions, iter is already past the initial '{' when
// we get here.
while (iter != end) {
if (*iter == '}') {
rv = createExprInternal(Substring(start, iter),
start - avtStart, aContext,
getter_Transfers(newExpr));
NS_ENSURE_SUCCESS(rv, rv);
inExpr = false;
++iter; // skip closing '}'
break;
}
else if (*iter == '\'' || *iter == '"') {
PRUnichar q = *iter;
while (++iter != end && *iter != q) {} /* do nothing */
if (iter == end) {
break;
}
}
++iter;
}
if (inExpr) {
aContext->SetErrorOffset(start - avtStart);
return NS_ERROR_XPATH_UNBALANCED_CURLY_BRACE;
}
}
// Add expression, create a concat() call if necessary
if (!expr) {
expr = newExpr;
}
else {
if (!concat) {
concat = new txCoreFunctionCall(txCoreFunctionCall::CONCAT);
NS_ENSURE_TRUE(concat, NS_ERROR_OUT_OF_MEMORY);
//.........这里部分代码省略.........