本文整理汇总了C++中nsTArray::IndexOfFirstElementGt方法的典型用法代码示例。如果您正苦于以下问题:C++ nsTArray::IndexOfFirstElementGt方法的具体用法?C++ nsTArray::IndexOfFirstElementGt怎么用?C++ nsTArray::IndexOfFirstElementGt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsTArray
的用法示例。
在下文中一共展示了nsTArray::IndexOfFirstElementGt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertNoDuplicates
static void InsertNoDuplicates(nsTArray<nsString>& aArray,
const nsAString& aString)
{
size_t i = aArray.IndexOfFirstElementGt(aString);
if (i > 0 && aArray[i-1].Equals(aString)) {
return;
}
aArray.InsertElementAt(i, aString);
}
示例2: Append
//.........这里部分代码省略.........
mSkipBytes = mElement.mSize.mValue;
mState = SKIP_DATA;
mNextState = READ_ELEMENT_ID;
break;
}
break;
case READ_VINT: {
unsigned char c = *p++;
uint32_t mask;
mVInt.mLength = VIntLength(c, &mask);
mVIntLeft = mVInt.mLength - 1;
mVInt.mValue = mVIntRaw ? c : c & ~mask;
mState = READ_VINT_REST;
break;
}
case READ_VINT_REST:
if (mVIntLeft) {
mVInt.mValue <<= 8;
mVInt.mValue |= *p++;
mVIntLeft -= 1;
} else {
mState = mNextState;
}
break;
case READ_TIMECODESCALE:
MOZ_ASSERT(mGotTimecodeScale);
mTimecodeScale = mVInt.mValue;
mState = READ_ELEMENT_ID;
break;
case READ_CLUSTER_TIMECODE:
mClusterTimecode = mVInt.mValue;
mState = READ_ELEMENT_ID;
break;
case READ_BLOCK_TIMECODE:
if (mBlockTimecodeLength) {
mBlockTimecode <<= 8;
mBlockTimecode |= *p++;
mBlockTimecodeLength -= 1;
} else {
// It's possible we've parsed this data before, so avoid inserting
// duplicate WebMTimeDataOffset entries.
{
ReentrantMonitorAutoEnter mon(aReentrantMonitor);
int64_t endOffset = mBlockOffset + mBlockSize +
mElement.mID.mLength + mElement.mSize.mLength;
uint32_t idx = aMapping.IndexOfFirstElementGt(endOffset);
if (idx == 0 || aMapping[idx - 1] != endOffset) {
// Don't insert invalid negative timecodes.
if (mBlockTimecode >= 0 || mClusterTimecode >= uint16_t(abs(mBlockTimecode))) {
MOZ_ASSERT(mGotTimecodeScale);
uint64_t absTimecode = mClusterTimecode + mBlockTimecode;
absTimecode *= mTimecodeScale;
WebMTimeDataOffset entry(endOffset, absTimecode, mLastInitStartOffset,
mClusterOffset, mClusterEndOffset);
aMapping.InsertElementAt(idx, entry);
}
}
}
// Skip rest of block header and the block's payload.
mBlockSize -= mVInt.mLength;
mBlockSize -= BLOCK_TIMECODE_LENGTH;
mSkipBytes = uint32_t(mBlockSize);
mState = SKIP_DATA;
mNextState = READ_ELEMENT_ID;
}
break;
case SKIP_DATA:
if (mSkipBytes) {
uint32_t left = aLength - (p - aBuffer);
left = std::min(left, mSkipBytes);
p += left;
mSkipBytes -= left;
}
if (!mSkipBytes) {
mBlockEndOffset = mCurrentOffset + (p - aBuffer);
mState = mNextState;
}
break;
case CHECK_INIT_FOUND:
if (mSkipBytes) {
uint32_t left = aLength - (p - aBuffer);
left = std::min(left, mSkipBytes);
p += left;
mSkipBytes -= left;
}
if (!mSkipBytes) {
if (mInitEndOffset < 0) {
mInitEndOffset = mCurrentOffset + (p - aBuffer);
mBlockEndOffset = mCurrentOffset + (p - aBuffer);
}
mState = READ_ELEMENT_ID;
}
break;
}
}
NS_ASSERTION(p == aBuffer + aLength, "Must have parsed to end of data.");
mCurrentOffset += aLength;
}