void CheckIfQueueEmpty(nsDeque& d) { EXPECT_EQ(0u, d.GetSize()) << "Size should be 0"; EXPECT_EQ(nullptr, d.Pop()) << "Invalid operation should return nullptr"; EXPECT_EQ(nullptr, d.PopFront()) << "Invalid operation should return nullptr"; EXPECT_EQ(nullptr, d.Peek()) << "Invalid operation should return nullptr"; EXPECT_EQ(nullptr, d.PeekFront()) << "Invalid operation should return nullptr"; EXPECT_EQ(nullptr, d.ObjectAt(0u)) << "Invalid operation should return nullptr"; }
/** * Pushes all of the tokens in aDeque onto the front of our deque so they * get processed before any other tokens. * * @param aDeque The deque with the tokens in it. */ void nsHTMLTokenizer::PrependTokens(nsDeque& aDeque) { int32_t aCount = aDeque.GetSize(); for (int32_t anIndex = 0; anIndex < aCount; ++anIndex) { CToken* theToken = (CToken*)aDeque.Pop(); PushTokenFront(theToken); } }
/** * This is a utilty method for ScanDocStructure, which finds a given * tag in the stack. The return value is meant to be used with * nsDeque::ObjectAt() on aTagStack. * * @param aTag -- the ID of the tag we're seeking * @param aTagStack -- the stack to be searched * @return index position of tag in stack if found, otherwise kNotFound */ static int32_t FindLastIndexOfTag(eHTMLTags aTag, nsDeque &aTagStack) { int32_t theCount = aTagStack.GetSize(); while (0 < theCount) { CHTMLToken* theToken = (CHTMLToken*)aTagStack.ObjectAt(--theCount); if (theToken) { eHTMLTags theTag = (eHTMLTags)theToken->GetTypeID(); if (theTag == aTag) { return theCount; } } } return kNotFound; }
void PopAll(F&& aF) { while (mDQ.GetSize() != 0) { int i = static_cast<int>(reinterpret_cast<uintptr_t>(mDQ.Pop())); aF(i); } }