本文整理汇总了C++中nsacstring::const_iterator::get方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::get方法的具体用法?C++ const_iterator::get怎么用?C++ const_iterator::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsacstring::const_iterator
的用法示例。
在下文中一共展示了const_iterator::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: end
// Reads over a boundary and sets start to the position after the end of the
// boundary. Returns false if no boundary is found immediately.
bool
PushOverBoundary(const nsACString& aBoundaryString,
nsACString::const_iterator& aStart,
nsACString::const_iterator& aEnd)
{
// We copy the end iterator to keep the original pointing to the real end
// of the string.
nsACString::const_iterator end(aEnd);
const char* beginning = aStart.get();
if (FindInReadable(aBoundaryString, aStart, end)) {
// We either should find the body immediately, or after 2 chars with the
// 2 chars being '-', everything else is failure.
if ((aStart.get() - beginning) == 0) {
aStart.advance(aBoundaryString.Length());
return true;
}
if ((aStart.get() - beginning) == 2) {
if (*(--aStart) == '-' && *(--aStart) == '-') {
aStart.advance(aBoundaryString.Length() + 2);
return true;
}
}
}
return false;
}
示例2: end
// static
bool
FetchUtil::ExtractHeader(nsACString::const_iterator& aStart,
nsACString::const_iterator& aEnd,
nsCString& aHeaderName,
nsCString& aHeaderValue,
bool* aWasEmptyHeader)
{
MOZ_ASSERT(aWasEmptyHeader);
// Set it to a valid value here so we don't forget later.
*aWasEmptyHeader = false;
const char* beginning = aStart.get();
nsACString::const_iterator end(aEnd);
if (!FindCRLF(aStart, end)) {
return false;
}
if (aStart.get() == beginning) {
*aWasEmptyHeader = true;
return true;
}
nsAutoCString header(beginning, aStart.get() - beginning);
nsACString::const_iterator headerStart, iter, headerEnd;
header.BeginReading(headerStart);
header.EndReading(headerEnd);
iter = headerStart;
if (!FindCharInReadable(':', iter, headerEnd)) {
return false;
}
aHeaderName.Assign(StringHead(header, iter - headerStart));
aHeaderName.CompressWhitespace();
if (!NS_IsValidHTTPToken(aHeaderName)) {
return false;
}
aHeaderValue.Assign(Substring(++iter, headerEnd));
if (!NS_IsReasonableHTTPHeaderValue(aHeaderValue)) {
return false;
}
aHeaderValue.CompressWhitespace();
return PushOverLine(aStart, aEnd);
}
示例3: spec
inline PRBool
nsSMILParserUtils::ParseMetricMultiplicand(nsACString::const_iterator& aSpec,
const nsACString::const_iterator& aEnd,
PRInt32& multiplicand)
{
PRBool result = PR_FALSE;
size_t len = aEnd.get() - aSpec.get();
nsACString::const_iterator spec(aSpec);
if (len) {
switch (*spec++)
{
case 'h':
multiplicand = MSEC_PER_HOUR;
result = PR_TRUE;
break;
case 'm':
if (len >= 2) {
if (*spec == 's') {
++spec;
multiplicand = 1;
result = PR_TRUE;
} else if (len >= 3 && *spec++ == 'i' && *spec++ == 'n') {
multiplicand = MSEC_PER_MIN;
result = PR_TRUE;
}
}
break;
case 's':
multiplicand = MSEC_PER_SEC;
result = PR_TRUE;
break;
}
}
if (result) {
aSpec = spec;
}
return result;
}
示例4:
inline PRBool
nsSMILParserUtils::ConsumeSubstring(nsACString::const_iterator& aIter,
const nsACString::const_iterator& aIterEnd,
const char *aSubstring)
{
size_t substrLen = PL_strlen(aSubstring);
typedef nsACString::const_iterator::difference_type diff_type;
if (aIterEnd.get() - aIter.get() < static_cast<diff_type>(substrLen))
return PR_FALSE;
PRBool result = PR_FALSE;
if (PL_strstr(aIter.get(), aSubstring) == aIter.get()) {
aIter.advance(substrLen);
result = PR_TRUE;
}
return result;
}
示例5: GetFloat
PRBool
nsSMILParserUtils::ParseClockComponent(nsACString::const_iterator& aSpec,
const nsACString::const_iterator& aEnd,
double& aResult,
PRBool& aIsReal,
PRBool& aCouldBeMin,
PRBool& aCouldBeSec)
{
nsresult rv;
char const *begin = aSpec.get();
double value = GetFloat(aSpec, aEnd, &rv);
// Check a number was found
if (NS_FAILED(rv))
return PR_FALSE;
// Check it's not expressed in exponential form
size_t len = aSpec.get() - begin;
PRBool isExp = (PL_strnpbrk(begin, "eE", len) != nsnull);
if (isExp)
return PR_FALSE;
// Don't allow real numbers of the form "23."
if (*(aSpec.get() - 1) == '.')
return PR_FALSE;
// Number looks good
aResult = value;
// Set some flags so we can check this number is valid once we know
// whether it's an hour, minute string etc.
aIsReal = (PL_strnchr(begin, '.', len) != nsnull);
aCouldBeMin = (value < 60.0 && (len == 2));
aCouldBeSec = (value < 60.0 ||
(value == 60.0 && begin[0] == '5')); // Take care of rounding error
aCouldBeSec &= (len >= 2 &&
(begin[2] == '\0' || begin[2] == '.' || IsSpace(begin[2])));
return PR_TRUE;
}