void CNodedMemoryBuffer::SkipField() { ASSERT(IsLoading()); if(m_iFieldType == ID_FIELD_IS_NODE) SkipNode(); else { Seek(m_dwFieldSize, SEEK_CURRENT); } }
void CFX_SAXReader::ParseDeclOrComment() { if (m_CurByte == '-') { m_eMode = FX_SAXMODE_Comment; m_pCurItem->m_eNode = FX_SAXNODE_Comment; if (m_pCommentContext == NULL) { m_pCommentContext = new CFX_SAXCommentContext; } m_pCommentContext->m_iHeaderCount = 1; m_pCommentContext->m_iTailCount = 0; } else { m_eMode = FX_SAXMODE_DeclNode; m_dwDataOffset = m_File.m_dwBufIndex; m_SkipChar = '>'; m_SkipStack.Add('>'); SkipNode(); } }
nsresult nsFind::NextNode(nsIDOMRange* aSearchRange, nsIDOMRange* aStartPoint, nsIDOMRange* aEndPoint, bool aContinueOk) { nsresult rv; nsCOMPtr<nsIContent> content; if (!mIterator || aContinueOk) { // If we are continuing, that means we have a match in progress. // In that case, we want to continue from the end point // (where we are now) to the beginning/end of the search range. nsCOMPtr<nsIDOMNode> startNode; nsCOMPtr<nsIDOMNode> endNode; PRInt32 startOffset, endOffset; if (aContinueOk) { #ifdef DEBUG_FIND printf("Match in progress: continuing past endpoint\n"); #endif if (mFindBackward) { aSearchRange->GetStartContainer(getter_AddRefs(startNode)); aSearchRange->GetStartOffset(&startOffset); aEndPoint->GetStartContainer(getter_AddRefs(endNode)); aEndPoint->GetStartOffset(&endOffset); } else { // forward aEndPoint->GetEndContainer(getter_AddRefs(startNode)); aEndPoint->GetEndOffset(&startOffset); aSearchRange->GetEndContainer(getter_AddRefs(endNode)); aSearchRange->GetEndOffset(&endOffset); } } else // Normal, not continuing { if (mFindBackward) { aSearchRange->GetStartContainer(getter_AddRefs(startNode)); aSearchRange->GetStartOffset(&startOffset); aStartPoint->GetEndContainer(getter_AddRefs(endNode)); aStartPoint->GetEndOffset(&endOffset); // XXX Needs work: // Problem with this approach: if there is a match which starts // just before the current selection and continues into the selection, // we will miss it, because our search algorithm only starts // searching from the end of the word, so we would have to // search the current selection but discount any matches // that fall entirely inside it. } else { // forward aStartPoint->GetStartContainer(getter_AddRefs(startNode)); aStartPoint->GetStartOffset(&startOffset); aEndPoint->GetEndContainer(getter_AddRefs(endNode)); aEndPoint->GetEndOffset(&endOffset); } } rv = InitIterator(startNode, startOffset, endNode, endOffset); NS_ENSURE_SUCCESS(rv, rv); if (!aStartPoint) aStartPoint = aSearchRange; content = do_QueryInterface(mIterator->GetCurrentNode()); #ifdef DEBUG_FIND nsCOMPtr<nsIDOMNode> dnode (do_QueryInterface(content)); printf(":::::: Got the first node "); DumpNode(dnode); #endif if (content && content->IsNodeOfType(nsINode::eTEXT) && !SkipNode(content)) { mIterNode = do_QueryInterface(content); // Also set mIterOffset if appropriate: nsCOMPtr<nsIDOMNode> node; if (mFindBackward) { aStartPoint->GetEndContainer(getter_AddRefs(node)); if (mIterNode.get() == node.get()) aStartPoint->GetEndOffset(&mIterOffset); else mIterOffset = -1; // sign to start from end } else { aStartPoint->GetStartContainer(getter_AddRefs(node)); if (mIterNode.get() == node.get()) aStartPoint->GetStartOffset(&mIterOffset); else mIterOffset = 0; } #ifdef DEBUG_FIND printf("Setting initial offset to %d\n", mIterOffset); #endif return NS_OK; } } while (1) { if (mFindBackward) mIterator->Prev(); else mIterator->Next(); content = do_QueryInterface(mIterator->GetCurrentNode()); if (!content) break; #ifdef DEBUG_FIND nsCOMPtr<nsIDOMNode> dnode (do_QueryInterface(content)); printf(":::::: Got another node "); DumpNode(dnode); #endif // If we ever cross a block node, we might want to reset // the match anchor: // we don't match patterns extending across block boundaries. // But we can't depend on this test here now, because the iterator // doesn't give us the parent going in and going out, and we // need it both times to depend on this. //if (IsBlockNode(content)) // Now see if we need to skip this node -- // e.g. is it part of a script or other invisible node? // Note that we don't ask for CSS information; // a node can be invisible due to CSS, and we'd still find it. if (SkipNode(content)) continue; if (content->IsNodeOfType(nsINode::eTEXT)) break; #ifdef DEBUG_FIND dnode = do_QueryInterface(content); printf("Not a text node: "); DumpNode(dnode); #endif } if (content) mIterNode = do_QueryInterface(content); else mIterNode = nsnull; mIterOffset = -1; #ifdef DEBUG_FIND printf("Iterator gave: "); DumpNode(mIterNode); #endif return NS_OK; }
void CFX_SAXReader::ParseDeclNode() { SkipNode(); }