本文整理汇总了C++中castToNodeImpl函数的典型用法代码示例。如果您正苦于以下问题:C++ castToNodeImpl函数的具体用法?C++ castToNodeImpl怎么用?C++ castToNodeImpl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了castToNodeImpl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DOMException
DOMNode *DOMAttrMapImpl::removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName)
{
if (this->readOnly())
throw DOMException(
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
int i = findNamePoint(namespaceURI, localName);
if (i < 0)
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
DOMNode * removed = fNodes -> elementAt(i);
fNodes -> removeElementAt(i); //remove n from nodes
castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
castToNodeImpl(removed)->isOwned(false);
// Replace it if it had a default value
// (DOM spec level 2 - Element Interface)
if (hasDefaults() && (removed != 0))
{
DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItemNS(namespaceURI, localName));
if (attr != 0)
{
DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
setNamedItemNS(newAttr);
}
}
return removed;
}
示例2: new
void DOMAttrMapImpl::cloneContent(const DOMAttrMapImpl *srcmap)
{
if ((srcmap != 0) && (srcmap->fNodes != 0))
{
if (fNodes != 0)
fNodes->reset();
else
{
XMLSize_t size = srcmap->fNodes->size();
if(size > 0) {
DOMDocument *doc = fOwnerNode->getOwnerDocument();
fNodes = new (doc) DOMNodeVector(doc, size);
}
}
for (XMLSize_t i = 0; i < srcmap->fNodes->size(); i++)
{
DOMNode *n = srcmap->fNodes->elementAt(i);
DOMNode *clone = n->cloneNode(true);
castToNodeImpl(clone)->isSpecified(castToNodeImpl(n)->isSpecified());
castToNodeImpl(clone)->fOwnerNode = fOwnerNode;
castToNodeImpl(clone)->isOwned(true);
fNodes->addElement(clone);
}
}
}
示例3: DOMException
//
// removeNamedItem() - Remove the named item, and return it.
// The caller can release the
// returned item if it's not used
// we can't do it here because the caller would
// never see the returned node.
//
DOMNode * DOMNamedNodeMapImpl::removeNamedItem(const XMLCh *name)
{
if (this->readOnly())
throw DOMException(
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
unsigned int hash=XMLString::hash(name,MAP_SIZE);
if(fBuckets[hash]==0)
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
int i = 0;
int size = fBuckets[hash]->size();
for (i = 0; i < size; ++i) {
DOMNode *n=fBuckets[hash]->elementAt(i);
if(XMLString::equals(name,n->getNodeName())) {
fBuckets[hash]->removeElementAt(i);
castToNodeImpl(n)->fOwnerNode = fOwnerNode->getOwnerDocument();
castToNodeImpl(n)->isOwned(false);
return n;
}
}
throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
return 0;
}
示例4: castToNodeImpl
//
// setNamedItem() Put the item into the NamedNodeList by name.
// If an item with the same name already was
// in the list, replace it. Return the old
// item, if there was one.
// Caller is responsible for arranging for
// deletion of the old item if its ref count is
// zero.
//
DOMNode * DOMNamedNodeMapImpl::setNamedItem(DOMNode * arg)
{
DOMDocument *doc = fOwnerNode->getOwnerDocument();
DOMNodeImpl *argImpl = castToNodeImpl(arg);
if(argImpl->getOwnerDocument() != doc)
throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager);
if (this->readOnly())
throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode))
throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
argImpl->fOwnerNode = fOwnerNode;
argImpl->isOwned(true);
const XMLCh* name=arg->getNodeName();
unsigned int hash=XMLString::hash(name,MAP_SIZE);
if(fBuckets[hash]==0)
fBuckets[hash] = new (doc) DOMNodeVector(doc, 3);
int i = 0;
int size = fBuckets[hash]->size();
for (i = 0; i < size; ++i) {
DOMNode *n=fBuckets[hash]->elementAt(i);
if(XMLString::equals(name,n->getNodeName())) {
fBuckets[hash]->setElementAt(arg,i);
castToNodeImpl(n)->fOwnerNode = fOwnerNode->getOwnerDocument();
castToNodeImpl(n)->isOwned(false);
return n;
}
}
fBuckets[hash]->addElement(arg);
return 0;
}
示例5: setSystemId
void DOMDocumentTypeImpl::setSystemId(const XMLCh *value)
{
if ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())
fSystemId = ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())->cloneString(value);
else {
fSystemId = ((DOMDocumentImpl *)&gDocTypeDocument())->cloneString(value);
}
}
示例6: setInternalSubset
void DOMDocumentTypeImpl::setInternalSubset(const XMLCh *value)
{
if ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())
fInternalSubset = ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())->cloneString(value);
else {
fInternalSubset = ((DOMDocumentImpl *)&gDocTypeDocument())->cloneString(value);
}
}
示例7: new
DOMNode *DOMDocumentTypeImpl::cloneNode(bool deep) const
{
DOMNode* newNode = 0;
if (castToNodeImpl(this)->getOwnerDocument())
newNode = new (castToNodeImpl(this)->getOwnerDocument(), DOMDocumentImpl::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(*this, false, deep);
else
newNode = new (&gDocTypeDocument(), DOMDocumentImpl::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(*this, false, deep);
fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
return newNode;
}
示例8: setPublicId
void DOMDocumentTypeImpl::setPublicId(const XMLCh *value)
{
// revist. Why shouldn't 0 be assigned like any other value?
if (value == 0)
return;
if ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())
fPublicId = ((DOMDocumentImpl *)castToNodeImpl(this)->getOwnerDocument())->cloneString(value);
else {
fPublicId = ((DOMDocumentImpl *)&gDocTypeDocument())->cloneString(value);
}
}
示例9: castToNodeImpl
DOMNode* DOMElementImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
{
DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
if (!namespaceURI || !*namespaceURI) {
fName = doc->getPooledString(name);
fAttributes->reconcileDefaultAttributes(getDefaultAttributes());
// and fire user data NODE_RENAMED event
castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this);
return this;
}
else {
// create a new ElementNS
DOMElementNSImpl* newElem = (DOMElementNSImpl*)doc->createElementNS(namespaceURI, name);
// transfer the userData
doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newElem));
// remove old node from parent if any
DOMNode* parent = getParentNode();
DOMNode* nextSib = getNextSibling();
if (parent) {
parent->removeChild(this);
}
// move children to new node
DOMNode* child = getFirstChild();
while (child) {
removeChild(child);
newElem->appendChild(child);
child = getFirstChild();
}
// insert new node where old one was
if (parent) {
parent->insertBefore(newElem, nextSib);
}
// move specified attributes to new node
newElem->fAttributes->moveSpecifiedAttributes(fAttributes);
// and fire user data NODE_RENAMED event
castToNodeImpl(newElem)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newElem);
return newElem;
}
}
示例10: fRootNode
//DOM Level 2
DOMDeepNodeListImpl::DOMDeepNodeListImpl(const DOMNode *rootNode,
const XMLCh *namespaceURI,
const XMLCh *localName)
: fRootNode(rootNode)
, fChanges(0)
, fCurrentNode(0)
, fCurrentIndexPlus1(0)
, fMatchAllURI(false)
, fMatchURIandTagname(true)
{
fTagName = ((DOMDocumentImpl *)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(localName);
fMatchAll = XMLString::equals(fTagName, kAstr);
fMatchAllURI = XMLString::equals(namespaceURI, kAstr);
fNamespaceURI = ((DOMDocumentImpl *)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(namespaceURI);
}
示例11: setOwnerDocument
/**
* NON-DOM
* set the ownerDocument of this node and its children
*/
void DOMDocumentTypeImpl::setOwnerDocument(DOMDocument *doc) {
if (castToNodeImpl(this)->getOwnerDocument()) {
fNode.setOwnerDocument(doc);
fParent.setOwnerDocument(doc);
}
else {
if (doc) {
DOMDocumentImpl *docImpl = (DOMDocumentImpl *)doc;
fPublicId = docImpl->cloneString(fPublicId);
fSystemId = docImpl->cloneString(fSystemId);
fInternalSubset = docImpl->cloneString(fInternalSubset);
fName = docImpl->getPooledString(fName);
fNode.setOwnerDocument(doc);
fParent.setOwnerDocument(doc);
DOMNamedNodeMapImpl* entitiesTemp = fEntities->cloneMap(this);
DOMNamedNodeMapImpl* notationsTemp = fNotations->cloneMap(this);
DOMNamedNodeMapImpl* elementsTemp = fElements->cloneMap(this);
fEntities = entitiesTemp;
fNotations = notationsTemp;
fElements = elementsTemp;
}
}
}
示例12: castToNodeImpl
DOMNode * DOMChildNode::getParentNode(const DOMNode *thisNode) const
{
// if we have an owner, ownerNode is our parent, otherwise it's
// our ownerDocument and we don't have a parent
DOMNodeImpl *thisNodeImpl = castToNodeImpl(thisNode);
return thisNodeImpl->isOwned() ? thisNodeImpl->fOwnerNode : 0;
}
示例13: switch
void DOMNodeImpl::setReadOnly(bool readOnl, bool deep)
{
this->isReadOnly(readOnl);
if (deep) {
for (DOMNode *mykid = castToNode(this)->getFirstChild();
mykid != 0;
mykid = mykid->getNextSibling()) {
short kidNodeType = mykid->getNodeType();
switch (kidNodeType) {
case DOMNode::ENTITY_REFERENCE_NODE:
break;
case DOMNode::ELEMENT_NODE:
((DOMElementImpl*) mykid)->setReadOnly(readOnl, true);
break;
case DOMNode::DOCUMENT_TYPE_NODE:
((DOMDocumentTypeImpl*) mykid)->setReadOnly(readOnl, true);
break;
default:
castToNodeImpl(mykid)->setReadOnly(readOnl, true);
break;
}
}
}
}
示例14: DOMCDATASection
DOMCDATASectionImpl::DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool /*deep*/)
: DOMCDATASection(other),
fNode(*castToNodeImpl(&other)),
fChild(*castToChildImpl(&other)),
fCharacterData(other.fCharacterData)
{
// revisit. Something nees to make "deep" work.
}
示例15: appendData
void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat)
{
if(castToNodeImpl(node)->isReadOnly())
throw DOMException(
DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
fDataBuf->append(dat);
}