本文整理汇总了C++中nsAFlatString::BeginReading方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAFlatString::BeginReading方法的具体用法?C++ nsAFlatString::BeginReading怎么用?C++ nsAFlatString::BeginReading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAFlatString
的用法示例。
在下文中一共展示了nsAFlatString::BeginReading方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isWhitespace
/**
* Returns true if the given string has only whitespace characters
*/
bool XMLUtils::isWhitespace(const nsAFlatString& aText)
{
nsAFlatString::const_char_iterator start, end;
aText.BeginReading(start);
aText.EndReading(end);
for ( ; start != end; ++start) {
if (!isWhitespace(*start)) {
return false;
}
}
return true;
}
示例2: getDocumentBase
/**
* Returns the document base of the href argument
* @return the document base of the given href
**/
void URIUtils::getDocumentBase(const nsAFlatString& href, nsAString& dest)
{
if (href.IsEmpty()) {
return;
}
nsAFlatString::const_char_iterator temp;
href.BeginReading(temp);
PRUint32 iter = href.Length();
while (iter > 0) {
if (temp[--iter] == HREF_PATH_SEP) {
dest.Append(Substring(href, 0, iter));
break;
}
}
}
示例3: parseStylesheetPI
void txStandaloneXSLTProcessor::parseStylesheetPI(const nsAFlatString& aData,
nsAString& aType,
nsAString& aHref)
{
nsAFlatString::const_char_iterator start, end;
aData.BeginReading(start);
aData.EndReading(end);
nsAFlatString::const_char_iterator iter;
PRInt8 found = 0;
while (start != end) {
SKIP_WHITESPACE(start, end);
iter = start;
SKIP_ATTR_NAME(iter, end);
// Remember the attr name.
const nsAString & attrName = Substring(start, iter);
// Now check whether this is a valid name="value" pair.
start = iter;
SKIP_WHITESPACE(start, end);
if (*start != '=') {
// No '=', so this is not a name="value" pair. We don't know
// what it is, and we have no way to handle it.
break;
}
// Have to skip the value.
++start;
SKIP_WHITESPACE(start, end);
PRUnichar q = *start;
if (q != QUOTE && q != APOSTROPHE) {
// Not a valid quoted value, so bail.
break;
}
++start; // Point to the first char of the value.
iter = start;
while (iter != end && *iter != q) {
++iter;
}
if (iter == end) {
// Oops, unterminated quoted string.
break;
}
// At this point attrName holds the name of the "attribute" and
// the value is between start and iter.
if (attrName.EqualsLiteral("type")) {
aType = Substring(start, iter);
++found;
}
else if (attrName.EqualsLiteral("href")) {
aHref = Substring(start, iter);
++found;
}
// Stop if we found both attributes
if (found == 2) {
break;
}
// Resume scanning after the end of the attribute value.
start = iter;
++start; // To move past the quote char.
}
}