当前位置: 首页>>代码示例>>C++>>正文


C++ ChildNode类代码示例

本文整理汇总了C++中ChildNode的典型用法代码示例。如果您正苦于以下问题:C++ ChildNode类的具体用法?C++ ChildNode怎么用?C++ ChildNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ChildNode类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: new

DOMString AttrImpl::getValue()
{
    if (value.child == null) {
        return 0; // return "";
    }
    if (hasStringValue()) {
        // change value into a DOMString*
        DOMString *x = (value.str == null
            ?(value.str = new (getOwnerDocument()->getMemoryManager()) DOMString())
            :value.str
        );
        // return the DOMString it points to
        return *x;
    }
    ChildNode *firstChild = value.child;
    ChildNode *node = firstChild->nextSibling;
    if (node == null) {
        return firstChild->getNodeValue().clone();
    }
    int             length = 0;
    for (node = firstChild; node != null; node = node->nextSibling)
        length += node->getNodeValue().length();

    DOMString retString;
    retString.reserve(length);
    for (node = firstChild; node != null; node = node->nextSibling)
    {
        retString.appendData(node->getNodeValue());
    };

    return retString;
};
开发者ID:js422,项目名称:PERL,代码行数:32,代码来源:AttrImpl.cpp

示例2:

	ChildNode * Composite::GetPrevChild(ChildNode const * pNode, ID idMatch)
	{
		for (ChildNode * pSrchNode = GetPrevChild(pNode); pSrchNode; pSrchNode = GetPrevChild(pSrchNode))
		{
			if (pSrchNode->GetChunk()->m_idCk == idMatch && !pSrchNode->GetChunk()->IsUnknown()) return pSrchNode;
		}
		return NULL;
	}
开发者ID:Scraft,项目名称:avpmp,代码行数:8,代码来源:iff.cpp

示例3: setId

void
Attr::setOwnerDocument(Document * doc)
{
  Node::setOwnerDocument(doc);
  for (ChildNode * child = text;
       child != null; child = child->nextSibling) {
    child->setOwnerDocument(doc);
  }
  setId();
}
开发者ID:CaptEmulation,项目名称:svgl,代码行数:10,代码来源:Attr.cpp

示例4: bool

	bool List::EnumChildren(ID idData, ID idChunk, bool (* pfnCallback) (Chunk *, void *), void * pData) const
	{
		for (ChildNode * pNode = GetFirstChild(); pNode; pNode = GetNextChild(pNode))
		{
			Composite const * pComposite = static_cast<Composite const *>(pNode->GetChunk());
			if (pComposite->m_idData == idData && !pComposite->EnumChildren(idData,idChunk,pfnCallback,pData)) return false;
		}
		
		return true;
	}
开发者ID:Scraft,项目名称:avpmp,代码行数:10,代码来源:iff.cpp

示例5: setReadOnly

void ParentNode::setReadOnly(bool readOnl, bool deep)
{
    NodeImpl::setReadOnly(readOnl, deep);

    if (deep)
        // Recursively set kids
        for (ChildNode *mykid = firstChild;
             mykid != null;
             mykid = mykid->nextSibling)
            if(! (mykid->isEntityReference()))
                mykid->setReadOnly(readOnl,true);
};
开发者ID:mydw,项目名称:mydw,代码行数:12,代码来源:ParentNode.cpp

示例6: setReadOnly

void ParentNode::setReadOnly(bool readOnl, bool deep)
{
    NodeImpl::setReadOnly(readOnl, deep);

    if (deep)
        // Recursively set kids
        for (ChildNode *mykid = firstChild;
             mykid != null;
             mykid = mykid->nextSibling)
            if(! (mykid->isEntityReference()))
                mykid->setReadOnly(readOnl,true);
}   /* SPEC_CPU: removed extra ';' for C++98 standards compliance -- yag */
开发者ID:,项目名称:,代码行数:12,代码来源:

示例7: setReadOnly

void AttrImpl::setReadOnly(bool readOnl, bool deep) {
    NodeImpl::setReadOnly(readOnl, deep);

    if (deep) {
        if (hasStringValue()) {
            return;
        }
        // Recursively set kids
        for (ChildNode *mykid = value.child;
             mykid != null;
             mykid = mykid->nextSibling)
            if(! (mykid->isEntityReference()))
                mykid->setReadOnly(readOnl,true);
    }
}
开发者ID:js422,项目名称:PERL,代码行数:15,代码来源:AttrImpl.cpp

示例8: GetPrevChild

	Chunk * Composite::GetProperty(ChildNode const * pNode, ID idProp) const
	{
		// search backward for ID
		
		ChildNode * pFindNode = GetPrevChild(pNode, idProp);
		
		if (pFindNode) return pFindNode->GetChunk();
		
		// if not found, search parent backwards, for "PROP ...." then get that
		// and if not in the parent, search its parent similarly
		// provided all these parents are of type LIST ....
		
		for (Composite const * pThis = this; pThis->m_pParent && pThis->m_pParent->m_idCk == ID("LIST"); pThis = pThis->m_pParent)
		{
			if (pThis->m_pNode)
			{
				for (ChildNode * pFindProp = pThis->m_pParent->GetPrevChild(pThis->m_pNode,"PROP"); pFindProp; pFindProp = pThis->m_pParent->GetPrevChild(pFindProp,"PROP"))
				{
					Composite * pProp = static_cast<Composite *>(pFindProp->GetChunk());
					if (pProp->m_idData == m_idData)
					{
						ChildNode * pFindNode = pProp->GetLastChild(idProp);
						
						if (pFindNode) return pFindNode->GetChunk();
					}
				}
				
			}
		}
		
		return NULL;
	}
开发者ID:Scraft,项目名称:avpmp,代码行数:32,代码来源:iff.cpp

示例9: throw

Node *
Attr::internalRemoveChild(Node * oldChild)
  throw(DOMException)
{
  Document * owner = getOwnerDocument();
  if (isReadOnly())
    throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
  if (oldChild != null && oldChild->getParentNode() != this)
    throw DOMException(DOMException::NOT_FOUND_ERR);
  owner->removedChildNode(oldChild);

  ChildNode * oldInternal = dynamic_cast<ChildNode*>(oldChild);
  if (oldInternal == text) {
    text->isFirstChild(false);
    text = dynamic_cast<Text*>(text->nextSibling);
    if (text != null) {
      text->isFirstChild(true);
      text->previousSibling = oldInternal->previousSibling;
    }
  }
  else {
    ChildNode * prev = oldInternal->previousSibling;
    ChildNode * next = oldInternal->nextSibling;
    prev->nextSibling = next;
    if (next != null) {
      text->previousSibling = prev;
    }
    else {
      next->previousSibling = prev;
    }
  }
  //ChildNode * oldPreviousSibling = oldInternal->previousSibling;
  oldInternal->ownerNode = owner;
  oldInternal->isOwned(false);
  oldInternal->nextSibling = null;
  oldInternal->previousSibling = null;
  changed();
  return oldInternal;
}
开发者ID:CaptEmulation,项目名称:svgl,代码行数:39,代码来源:Attr.cpp

示例10: DeleteAllChildren

	void Composite::Serialize(Archive * pArchv)
	{
		pArchv->Transfer(m_idData);
		
		if (pArchv->m_bIsLoading)
		{
			DeleteAllChildren();
			
			while (pArchv->GetSize())
			{
				Chunk * pChunk = LoadChunk(pArchv);
				InsertChildLast(pChunk);
				pChunk->Release();
			}
		}
		else
		{
			for (ChildNode * pNode = m_pFirst; pNode; pNode = GetNextChild(pNode))
			{
				pNode->GetChunk()->Write(pArchv);
			}
		}
	}
开发者ID:Scraft,项目名称:avpmp,代码行数:23,代码来源:iff.cpp

示例11: DOM_DOMException

NodeImpl *ParentNode::removeChild(NodeImpl *oldChild)
{
    if (ownerDocument->getErrorChecking()) {
        if (isReadOnly()) {
            throw DOM_DOMException(
                                 DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,
                                 null);
        }
        if (oldChild == null || oldChild->getParentNode() != this) {
            throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null);
        }
    }
    //fix other ranges for change before deleting the node
    if (getOwnerDocument() !=  null) {
        typedef RefVectorOf<RangeImpl> RangeImpls;
        RangeImpls* ranges = this->getOwnerDocument()->getRanges();
        if (ranges != null) {
            unsigned int sz = ranges->size();
            if (sz != 0) {
                for (unsigned int i =0; i<sz; i++) {
                    if (ranges->elementAt(i) != null)
                        ranges->elementAt(i)->updateRangeForDeletedNode(oldChild);
                }
            }
        }
    }

    ChildNode * oldInternal = (ChildNode *) oldChild;

    // update cached length if we have any
    if (fCachedLength != -1) {
        fCachedLength--;
    }
    if (fCachedChildIndex != -1) {
        // if the removed node is the cached node
        // move the cache to its (soon former) previous sibling
        if (fCachedChild == oldInternal) {
            fCachedChildIndex--;
            fCachedChild = (ChildNode *)oldInternal->getPreviousSibling();
        } else {
            // otherwise just invalidate the cache
            fCachedChildIndex = -1;
        }
    }

    // Patch linked list around oldChild
    // Note: lastChild == firstChild->previousSibling
    if (oldInternal == firstChild) {
        // removing first child
        oldInternal->isFirstChild(false);
        firstChild = oldInternal->nextSibling;
        if (firstChild != null) {
            firstChild->isFirstChild(true);
            firstChild->previousSibling = oldInternal->previousSibling;
        }
    } else {
        ChildNode *prev = oldInternal->previousSibling;
        ChildNode *next = oldInternal->nextSibling;
        prev->nextSibling = next;
        if (next == null) {
            // removing last child
            firstChild->previousSibling = prev;
        } else {
            // removing some other child in the middle
            next->previousSibling = prev;
        }
    }

    // Remove oldInternal's references to tree
    oldInternal->ownerNode = ownerDocument;
    oldInternal->isOwned(false);
    oldInternal->nextSibling = null;
    oldInternal->previousSibling = null;

    changed();

    return oldInternal;
};
开发者ID:mydw,项目名称:mydw,代码行数:78,代码来源:ParentNode.cpp

示例12: getOwnerDocument

NodeImpl *AttrImpl::removeChild(NodeImpl *oldChild) {

    DocumentImpl *ownerDocument = getOwnerDocument();
    if (ownerDocument->getErrorChecking()) {
        if (isReadOnly()) {
            throw DOM_DOMException(
                                 DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,
                                 null);
        }
        if (oldChild == null || oldChild->getParentNode() != this) {
            throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null);
        }
    }
    // fix other ranges for change before deleting the node
    if (getOwnerDocument() !=  null) {
        typedef RefVectorOf<RangeImpl> RangeImpls;
        RangeImpls* ranges = this->getOwnerDocument()->getRanges();
        if (ranges != null) {
            unsigned int sz = ranges->size();
            if (sz != 0) {
                for (unsigned int i =0; i<sz; i++) {
                    if (ranges->elementAt(i) != null)
                        ranges->elementAt(i)->updateRangeForDeletedNode(oldChild);
                }
            }
        }
    }

    ChildNode * oldInternal = (ChildNode *) oldChild;

    // Patch linked list around oldChild
    // Note: lastChild == firstChild->previousSibling
    if (oldInternal == value.child) {
        // removing first child
        oldInternal->isFirstChild(false);
        value.child = oldInternal->nextSibling; // firstChild = oldInternal->nextSibling
        ChildNode *firstChild = value.child;
        if (firstChild != null) {
            firstChild->isFirstChild(true);
            firstChild->previousSibling = oldInternal->previousSibling;
        }
    } else {
        ChildNode *prev = oldInternal->previousSibling;
        ChildNode *next = oldInternal->nextSibling;
        prev->nextSibling = next;
        if (next == null) {
            // removing last child
            ChildNode *firstChild = value.child;
            firstChild->previousSibling = prev;
        } else {
            // removing some other child in the middle
            next->previousSibling = prev;
        }
    }

    // Remove oldInternal's references to tree
    oldInternal->ownerNode = getOwnerDocument();
    oldInternal->isOwned(false);
    oldInternal->nextSibling = null;
    oldInternal->previousSibling = null;

    changed();

    return oldInternal;
};
开发者ID:js422,项目名称:PERL,代码行数:65,代码来源:AttrImpl.cpp

示例13: ASSERT

Node* Node::removeChild(Node *oldChild)
{
	//ASSERT(0);
#if 0
	// Do this first?
	{
		CComQIPtr<INotifySend> cp = thisNode;
		if (cp)
		{
			cp->FireOnChanged(NOTIFY_REMOVE, oldChild, DISPID_UNKNOWN);
		}
	}
#endif

	Document* ownerDocument = oldChild->get_ownerDocument();

	if (ownerDocument)
	{
		ASSERT(ownerDocument != NULL);

		DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(ownerDocument);
		ASSERT(ownerDocumentEvent != NULL);

		MutationEvent* evt = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(S("MutationEvent")));

	// Create a DOMNodeRemoved event
		evt->initMutationEvent(S("DOMNodeRemoved"), true, false, this, nullptr, nullptr, nullptr, CHANGE_UNKNOWN);

		EventTarget* target = dynamic_cast<EventTarget*>(oldChild);
		target->dispatchEvent(evt);

		NodeRemovedFromDocument(oldChild);
	}

// Do the work
	ChildNode* previous = oldChild->get_previousSibling();

	ChildNode* next = oldChild->get_nextSibling();

	if (previous != NULL)
		previous->set_nextSibling(next);
	else
		m_firstChild = next;

	if (next != NULL)
		next->set_previousSibling(previous);
	else
		m_lastChild = previous;

	oldChild->set_previousSibling(nullptr);
	oldChild->set_nextSibling(nullptr);

	for (int i = 0; i < m_childNodes->m_items.GetSize(); ++i)
	{
		if (m_childNodes->m_items[i] == oldChild)
		{
#if 0
			ASSERT(0);
			/////////
			CComQIPtr<INotifySend, &IID_INotifySend> cp = (IUnknown*)oldChild;
			if (cp)
			{
				CComQIPtr<INotifyGet, &IID_INotifyGet> get = (IUnknown*)thisNode;
				if (get)
				{
					cp->Unadvise(get);
				}
			}
#endif
			/////////

		//	m_childNodes->m_items.erase(&m_childNodes->m_items[i]);
			m_childNodes->m_items.RemoveAt(i);
			break;
		}
	}

	oldChild->set_parentNode(NULL);

	return oldChild;
}
开发者ID:,项目名称:,代码行数:81,代码来源:

示例14: insertNode

Node* Node::insertNode(Node* _newChild, Node* _pBefore)
{
	ChildNode* newChild = dynamic_cast<ChildNode*>(_newChild);
	ChildNode* pBefore = dynamic_cast<ChildNode*>(_pBefore);

	Node* pPrevParent = newChild->get_parentNode();
	if (pPrevParent)
	{
		pPrevParent->removeChild(newChild);
	}

	ChildNode* pAfter;

	if (pBefore)
		pAfter = pBefore->get_previousSibling();
	else
		pAfter = m_lastChild;

	newChild->set_nextSibling(pBefore);
	newChild->set_previousSibling(pAfter);

	if (pAfter == NULL)
		m_firstChild = newChild;
	else
		pAfter->set_nextSibling(newChild);

	if (pBefore == NULL)
		m_lastChild = newChild;
	else
		pBefore->set_previousSibling(newChild);

	if (pBefore)
	{
		for (int i = 0; i < m_childNodes->m_items.GetSize(); i++)
		{
			if (m_childNodes->m_items[i] == pBefore)
			{
				m_childNodes->m_items.InsertAt(i, newChild);
			//	m_childNodes->m_items.insert(&m_childNodes->m_items[i], newChild);
				break;
			}
		}
	}
	else
	{
		m_childNodes->m_items.Add(newChild);
	}

// Set new child node's parent to this element
	newChild->set_parentNode(this);

//	TRACE("TODO\n");
#if 0
// Update computed xmlspace for inserted child(ren)
	CComQIPtr<ILDOMElement> newElement((IUnknown*)newChild);
	if (newElement)
	{
		CComBSTR xmlspace;
		newElement->getAttribute(OLESTR("xml:space"), &xmlspace);
		if (xmlspace.Length()==0)	// inherit from parent
		{
			CComQIPtr<CLDOMElementImplImpl>((IUnknown*)newChild)->m_xmlspace = m_xmlspace;
		}
		else	// explicitly set
		{
			CComQIPtr<CLDOMElementImplImpl>((IUnknown*)newChild)->m_xmlspace = cmpbstr(xmlspace, OLESTR("preserve")) == 0;
		}
	// TODO, update recursively for newChild
	}
#endif
	// SMIL Animation (TODO, not very well thought trough)
#if 0
	{
		CLDOMDocument* pDocument = static_cast<CLDOMDocument*>(static_cast<CLDOMDocumentImpl<ILDOMDocument>*>(m_ownerDocument));

		if (pDocument)
		{
			CComQIPtr<ILDOMElement> newElement = newChild;

			if (newElement)
			{
			// SMIL Animation (connect animate/set etc. elements to the elements they target)
				pDocument->BuildAnimationListForAllElements(newElement, pDocument->m_documentElement);

			// Set baseVal/animVal from attributes and parse 'style' attributes
				pDocument->UpdateAnimationElements(newElement);
			}
		}
	}
#endif

//	TRACE("TODO\n");
#if 0
	// Timing stuff (TODO)
	{
		ElementTimeImplImpl* elementTimeImpl((IUnknown*)newChild);
		if (elementTimeImpl)
		{
			elementTimeImpl->CalculateTimeBeforeParent();

//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的ChildNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。