⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kissdom.cc

📁 XMDS is a code generator that integrates equations. You write them down in human readable form in a
💻 CC
📖 第 1 页 / 共 5 页
字号:
    for(i = 0; i < childNodes()->length(); i++) {      if(!childNodes()->item(i)->equalsNode(arg->childNodes()->item(i),deep)) {	return 0;      }    }  }  // well, if we have gotten this far then these nodes must be,  // to all intents, equal!  return 1;};// ******************************************************************************Node* KissNode::getAs(		      DOMString& feature) {  return this;};// ******************************************************************************bool KissNode::readOnly() const {  return myReadOnly;};// ******************************************************************************void KissNode::setReadOnly(			   const bool& newReadOnly,			   const bool& deep) {  myReadOnly = newReadOnly;  if(deep) {    for(list<Node*>::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode ++ ) {      (*ppNode)->setReadOnly(newReadOnly,deep);    }  }};// ******************************************************************************void KissNode::checkChildAddingConstraints1(					    const Node* newChild) const {  // this node is not read only  if(myReadOnly) {    throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);  }  // that new node's parent is not read only -  // i.e. it will allow this node to be removed from it  if(newChild->parentNode() != 0) {    if(newChild->parentNode()->readOnly()) {      throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);    }  }  // if the new node is a document fragment node that is itself  // not read only - i.e. it will allow its children to be removed  if(newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) {    if(newChild->readOnly()) {      throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);    }  }  // that the node to add is not this node or one of its ancestors  const Node* ancestorNode = this;  while(ancestorNode != 0) {    if(newChild == ancestorNode) {      throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);    }    ancestorNode = ancestorNode->parentNode();  }  // new node has same owner document  if(myOwnerDocument == 0) {    if(nodeType() == DOCUMENT_NODE) { // I am a document!       if((const Node*) newChild->ownerDocument() != this) {	throw DOMException(DOMException::WRONG_DOCUMENT_ERR);      }    }    else if(newChild->ownerDocument() != myOwnerDocument) {      throw DOMException(DOMException::WRONG_DOCUMENT_ERR);    }  }};// ******************************************************************************void KissNode::checkChildAddingConstraints2(					    const Node* newChild) const {  // this base class routine only checks that the new child is not  // an illegal type to add to the majority of other classes.  // the Document and Attr classes have more stringent constraints  // and so these classes override this function  switch(newChild->nodeType()) {  case DOCUMENT_NODE :  case DOCUMENT_TYPE_NODE :  case ATTRIBUTE_NODE :  case ENTITY_NODE :  case NOTATION_NODE :    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);    break;  }};// ******************************************************************************// ******************************************************************************//	KissDocument// ******************************************************************************// ******************************************************************************long nKissDocuments=0;  //!< Number of KISS document objects// ******************************************************************************unsigned long KissDocument::nodeType() const {  return DOCUMENT_NODE;};// ******************************************************************************void KissDocument::setParentNode(				 Node* newParentNode) {  throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);};// ******************************************************************************void KissDocument::setOwnerDocument(				    const Document *const newOwnerDocument) {  throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);};// ******************************************************************************Node* KissDocument::insertBefore(				 Node* newChild,				 Node* refChild) {  if(refChild == 0) {    return appendChild(newChild);  }  if(newChild == 0) {    return 0;  }  // may only have one DOCUMENT_TYPE_NODE  if((newChild->nodeType() == DOCUMENT_TYPE_NODE) &(myDoctype != 0)) {    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);  }  // may only have one ELEMENT_NODE  if((newChild->nodeType() == ELEMENT_NODE) &(myDocumentElement != 0)) {    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);  }  KissNode::insertBefore(newChild,refChild);  if(newChild->nodeType() == DOCUMENT_TYPE_NODE) {    myDoctype = newChild;  }  if(newChild->nodeType() == ELEMENT_NODE) {    myDocumentElement = newChild;  }  return newChild;};// ******************************************************************************Node* KissDocument::replaceChild(				 Node* newChild,				 Node* oldChild) {  if(newChild == 0) {    return 0;  }  KissNode::replaceChild(newChild,oldChild);  if(newChild->nodeType() == DOCUMENT_TYPE_NODE) {    myDoctype = newChild;  }  if(newChild->nodeType() == ELEMENT_NODE) {    myDocumentElement = newChild;  }  return oldChild;};// ******************************************************************************Node* KissDocument::removeChild(				Node* oldChild) {  KissNode::removeChild(oldChild);  if(oldChild->nodeType() == DOCUMENT_TYPE_NODE) {    myDoctype = 0;  }  if(oldChild->nodeType() == ELEMENT_NODE) {    myDocumentElement = 0;  }  return oldChild;};// ******************************************************************************Node* KissDocument::appendChild(				Node* newChild) {  if(newChild == 0) {    return 0;  }  // may only have one DOCUMENT_TYPE_NODE  if((newChild->nodeType() == DOCUMENT_TYPE_NODE) &(myDoctype != 0)) {    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);  }  // may only have one ELEMENT_NODE  if((newChild->nodeType() == ELEMENT_NODE) &(myDocumentElement != 0)) {    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);  }  KissNode::appendChild(newChild);  if(newChild->nodeType() == DOCUMENT_TYPE_NODE) {    myDoctype = newChild;  }  if(newChild->nodeType() == ELEMENT_NODE) {    myDocumentElement = newChild;  }  return newChild;};// ******************************************************************************Node* KissDocument::cloneNode(			      const bool& deep) const {  Document* newDocument = new KissDocument(myDOMImplementation);  newDocument->setActualEncoding(myActualEncoding);  newDocument->setEncoding(myEncoding);  newDocument->setVersion(myVersion);  newDocument->setStandalone(myStandalone);  newDocument->setStrictErrorChecking(myStrictErrorChecking);  if(deep) {    for(unsigned long i = 0; i < childNodes()->length(); i++) {      Node* newChild = childNodes()->item(i)->cloneNode(deep);      newChild->setOwnerDocument(this);      newDocument->appendChild(newChild);    }  }  return newDocument;};// ******************************************************************************const DOMString* KissDocument::namespaceURI() const {  return &myNamespaceURI;};// ******************************************************************************Node::DocumentOrder KissDocument::compareDocumentOrder(						       const Node* other) const {  if(other == this) {    return DOCUMENT_ORDER_SAME;  }   if(other->ownerDocument() != this) {    throw DOMException(DOMException::WRONG_DOCUMENT_ERR);  }  if(other->nodeType() == ATTRIBUTE_NODE) {    return DOCUMENT_ORDER_UNORDERED;  }	  return DOCUMENT_ORDER_FOLLOWING;};// ******************************************************************************Node::TreePosition KissDocument::compareTreePosition(						     const Node* other) const {  if(other == this) {    return TREE_POSITION_SAME;  }  if(other->ownerDocument() != this) {    throw DOMException(DOMException::WRONG_DOCUMENT_ERR);  }  return TREE_POSITION_DESCENDANT;};// ******************************************************************************void KissDocument::setTextContent(				  const DOMString& newTextContent) {  throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);};// ******************************************************************************void KissDocument::normalizeNS() {  if(myDocumentElement != 0) {    myDocumentElement->normalizeNS();  }};// ******************************************************************************void KissDocument::checkChildAddingConstraints2(						const Node* newChild) const {  switch(newChild->nodeType()) {  case DOCUMENT_TYPE_NODE :  case ELEMENT_NODE :  case PROCESSING_INSTRUCTION_NODE :  case COMMENT_NODE :    break;  case DOCUMENT_FRAGMENT_NODE :    for(unsigned long i = 0; i < newChild->childNodes()->length(); i++) {      unsigned long nextType = newChild->childNodes()->item(i)->nodeType();      if(!((nextType == PROCESSING_INSTRUCTION_NODE) |(nextType == COMMENT_NODE))) {	throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);      }    }    break;  default :    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);  }};// ******************************************************************************KissDocument::KissDocument(			   const DOMImplementation* yourDOMImplementation) :  KissNode(0,0,"#document"),  myElementNodeList(&myElementList) {  if(DEBUGKISSDOM) {    nKissDocuments++;    printf("KissDocument::KissDocument(); [%s]\n",nodeName()->c_str());    printf("nKissDocuments=%li\n",nKissDocuments);  }  myDoctype = 0;  myDocumentElement = 0;  nextKey=0;  myDOMImplementation = yourDOMImplementation;  myStandalone = 0;  myStrictErrorChecking = 1;};// ******************************************************************************KissDocument::~KissDocument() {  if(DEBUGKISSDOM) {    nKissDocuments--;    printf("KissDocument::~KissDocument(); [%s]\n",nodeName()->c_str());    printf("nKissDocuments=%li\n",nKissDocuments);  }};// ******************************************************************************DOMKey KissDocument::getDOMKey() const {  nextKey++;  return nextKey;};// ******************************************************************************const DocumentType* KissDocument::doctype() const {  return dynamic_cast<DocumentType*>(myDoctype);};// ******************************************************************************const DOMImplementation* KissDocument::implementation() const {  return myDOMImplementation;};// ******************************************************************************Element* KissDocument::documentElement() const {  return dynamic_cast<Element*>(myDocumentElement);};// ******************************************************************************Element* KissDocument::createElement(				     const DOMString& tagName) {  if(DEBUGKISSDOM) {    printf("KissDocument::createElement(); [%s]\n",nodeName()->c_str());  }  if((!tagName.isName()) |tagName.beginsWithxml()) {    throw DOMException(DOMException::INVALID_CHARACTER_ERR);  }  return new KissElement(this,0,"",tagName);};// ******************************************************************************DocumentFragment* KissDocument::createDocumentFragment() {  return new KissDocumentFragment(this);};// ******************************************************************************Text* KissDocument::createTextNode(				   const DOMString& data) {  return new KissText(this,0,data);};// ******************************************************************************Comment* KissDocument::createComment(				     const DOMString& data) {  return new KissComment(this,0,data);};// ******************************************************************************CDATASection* KissDocument::createCDATASection(					       const DOMString& data) {  return new KissCDATASection(this,0,data);};// ******************************************************************************ProcessingInstruction* KissDocument::createProcessingInstruction(								 const DOMString& target,								 const DOMString& data) {  if(target.hasIllegalCharacters()) {    throw DOMException(DOMException::INVALID_CHARACTER_ERR);  }  return new KissProcessingInstruction(this,0,target,data);};// ******************************************************************************Attr* KissDocument::createAttribute(				    const DOMString& name) {  if(DEBUGKISSDOM) {    printf("KissDocument::createAttribute(); [%s]\n",nodeName()->c_str());  }  if((!name.isName())|name.beginsWithxml()) {    throw DOMException(DOMException::INVALID_CHARACTER_ERR);  }  return new KissAttr(ownerDocument(),0,"",name,1);};// ******************************************************************************EntityReference* KissDocument::createEntityReference(						     const DOMString& name) {  if(name.hasIllegalCharacters()) {    throw DOMException(DOMException::INVALID_CHARACTER_ERR);  }  return new KissEntityReference(this,0,name);};// ******************************************************************************NodeList* KissDocument::getElementsByTagName(					     const DOMString& tagName) {  myElementList.clear();  Node* nextNode = myDocumentElement;  while (nextNode != 0) {    if(nextNode->nodeType() == ELEMENT_NODE) {      if(tagName == "*") {	myElementList.push_back(nextNode);      }      else if(*nextNode->nodeName() == tagName) {	myElementList.push_back(nextNode);      }    }    if(nextNode->hasChildNodes()) {      nextNode = nextNode->firstChild();    }    else {      while((nextNode->nextSibling() == 0) &(nextNode->parentNode() != 0)) {	nextNode = nextNode->parentNode();      }    }    if(nextNode != 0) {      nextNode = nextNode->nextSibling();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -