本文整理汇总了C++中AbstractNode::dispatchNodeInserted方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractNode::dispatchNodeInserted方法的具体用法?C++ AbstractNode::dispatchNodeInserted怎么用?C++ AbstractNode::dispatchNodeInserted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractNode
的用法示例。
在下文中一共展示了AbstractNode::dispatchNodeInserted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertBefore
Node* AbstractContainerNode::insertBefore(Node* newChild, Node* refChild)
{
poco_check_ptr (newChild);
if (static_cast<AbstractNode*>(newChild)->_pOwner != _pOwner && static_cast<AbstractNode*>(newChild)->_pOwner != this)
throw DOMException(DOMException::WRONG_DOCUMENT_ERR);
if (refChild && static_cast<AbstractNode*>(refChild)->_pParent != this)
throw DOMException(DOMException::NOT_FOUND_ERR);
if (newChild == refChild)
return newChild;
if (this == newChild)
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
AbstractNode* pFirst = 0;
AbstractNode* pLast = 0;
if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
{
AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
pFirst = pFrag->_pFirstChild;
pLast = pFirst;
if (pFirst)
{
while (pLast->_pNext)
{
pLast->_pParent = this;
pLast = pLast->_pNext;
}
pLast->_pParent = this;
}
pFrag->_pFirstChild = 0;
}
else
{
newChild->duplicate();
AbstractContainerNode* pParent = static_cast<AbstractNode*>(newChild)->_pParent;
if (pParent) pParent->removeChild(newChild);
pFirst = static_cast<AbstractNode*>(newChild);
pLast = pFirst;
pFirst->_pParent = this;
}
if (_pFirstChild && pFirst)
{
AbstractNode* pCur = _pFirstChild;
if (pCur == refChild)
{
pLast->_pNext = _pFirstChild;
_pFirstChild = pFirst;
}
else
{
while (pCur && pCur->_pNext != refChild) pCur = pCur->_pNext;
if (pCur)
{
pLast->_pNext = pCur->_pNext;
pCur->_pNext = pFirst;
}
else throw DOMException(DOMException::NOT_FOUND_ERR);
}
}
else _pFirstChild = pFirst;
if (events())
{
while (pFirst && pFirst != pLast->_pNext)
{
pFirst->dispatchNodeInserted();
pFirst->dispatchNodeInsertedIntoDocument();
pFirst = pFirst->_pNext;
}
dispatchSubtreeModified();
}
return newChild;
}