本文整理汇总了C++中nsAutoTArray::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAutoTArray::Clear方法的具体用法?C++ nsAutoTArray::Clear怎么用?C++ nsAutoTArray::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAutoTArray
的用法示例。
在下文中一共展示了nsAutoTArray::Clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RebuildIndexStack
// WARNING: This function is expensive
nsresult nsContentIterator::RebuildIndexStack()
{
// Make sure we start at the right indexes on the stack! Build array up
// to common parent of start and end. Perhaps it's too many entries, but
// that's far better than too few.
nsINode* parent;
nsINode* current;
mIndexes.Clear();
current = mCurNode;
if (!current) {
return NS_OK;
}
while (current != mCommonParent)
{
parent = current->GetNodeParent();
if (!parent)
return NS_ERROR_FAILURE;
mIndexes.InsertElementAt(0, parent->IndexOf(current));
current = parent;
}
return NS_OK;
}
示例2: GetDeepLastChild
nsresult
nsContentIterator::Init(nsINode* aRoot)
{
if (!aRoot)
return NS_ERROR_NULL_POINTER;
mIsDone = PR_FALSE;
mIndexes.Clear();
if (mPre)
{
mFirst = aRoot;
mLast = GetDeepLastChild(aRoot, nsnull);
}
else
{
mFirst = GetDeepFirstChild(aRoot, nsnull);
mLast = aRoot;
}
mCommonParent = aRoot;
mCurNode = mFirst;
RebuildIndexStack();
return NS_OK;
}
示例3:
void
nsContentIterator::MakeEmpty()
{
mCurNode = nsnull;
mFirst = nsnull;
mLast = nsnull;
mCommonParent = nsnull;
mIsDone = PR_TRUE;
mIndexes.Clear();
}
示例4: MakeEmpty
//.........这里部分代码省略.........
{
if (mPre)
mFirst = cChild;
else // post-order
{
mFirst = GetDeepFirstChild(cChild, nsnull);
// Does mFirst node really intersect the range?
// The range could be 'degenerate', ie not collapsed
// but still contain no content.
if (mFirst &&
!NodeIsInTraversalRange(mFirst, mPre, startNode, startIndx,
endNode, endIndx))
mFirst = nsnull;
}
}
// Find last node in range.
PRBool endIsData = endNode->IsNodeOfType(nsINode::eDATA_NODE);
if (endIsData || !NodeHasChildren(endNode) || endIndx == 0)
{
if (mPre) {
if (endNode->IsNodeOfType(nsINode::eCONTENT)) {
mLast = static_cast<nsIContent*>(endNode);
} else {
// Not much else to do here...
mLast = nsnull;
}
}
else // post-order
{
// XXX: In the future, if end offset is before the first
// character in the cdata node, should we set mLast to
// the prev sibling?
if (!endIsData)
{
mLast = GetPrevSibling(endNode, nsnull);
if (!NodeIsInTraversalRange(mLast, mPre, startNode, startIndx,
endNode, endIndx))
mLast = nsnull;
}
else {
NS_ASSERTION(endNode->IsNodeOfType(nsINode::eCONTENT),
"Data node that's not content?");
mLast = static_cast<nsIContent*>(endNode);
}
}
}
else
{
PRInt32 indx = endIndx;
cChild = endNode->GetChildAt(--indx);
if (!cChild) // No child at offset!
{
NS_NOTREACHED("nsContentIterator::nsContentIterator");
return NS_ERROR_FAILURE;
}
if (mPre)
{
mLast = GetDeepLastChild(cChild, nsnull);
if (!NodeIsInTraversalRange(mLast, mPre, startNode, startIndx,
endNode, endIndx)) {
mLast = nsnull;
}
}
else { // post-order
mLast = cChild;
}
}
// If either first or last is null, they both
// have to be null!
if (!mFirst || !mLast)
{
mFirst = nsnull;
mLast = nsnull;
}
mCurNode = mFirst;
mIsDone = !mCurNode;
if (!mCurNode)
mIndexes.Clear();
else
RebuildIndexStack();
return NS_OK;
}