📄 domcif.cpp
字号:
return NULL; } *err =NO_ERR; try { *ret = (*(Document *)OperationDocument).removeChild((*(Node *)oldChild)); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);} Upnp_Node UpnpDocument_appendChild(Upnp_Document OperationDocument, Upnp_Node newChild, Upnp_DOMException *err){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *err =NO_ERR; try { *ret = (*(Document *)OperationDocument).appendChild((*(Node *)newChild)); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);} Upnp_Bool UpnpDocument_hasChildNodes(Upnp_Document OperationDocument){ return((*(Document *)OperationDocument).hasChildNodes());} Upnp_Node UpnpDocument_cloneNode(Upnp_Document OperationDocument, Upnp_Bool deep){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).cloneNode((deep>0)); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_DOMString UpnpDocument_getNodeName(Upnp_Document OperationDocument){ Upnp_DOMString temp; temp = (*(Document *)OperationDocument).getNodeName(); return(temp);}Upnp_DOMString UpnpDocument_getNodeValue(Upnp_Document OperationDocument, Upnp_DOMException *err){ Upnp_DOMString temp=NULL; *err =NO_ERR; try { temp = (*(Document *)OperationDocument).getNodeValue(); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } return(temp);}Upnp_Void UpnpDocument_setNodeValue(Upnp_Document OperationDocument, Upnp_DOMString nodeValue, Upnp_DOMException *err){ *err =NO_ERR; try { (*(Document *)OperationDocument).setNodeValue(nodeValue); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; }}Upnp_UShort UpnpDocument_getNodeType(Upnp_Document OperationDocument){ return((*(Document *)OperationDocument).getNodeType());}Upnp_Node UpnpDocument_getParentNode(Upnp_Document OperationDocument){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getParentNode(); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_NodeList UpnpDocument_getChildNodes(Upnp_Document OperationDocument){ NodeList *ret = new NodeList; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getChildNodes(); if(!ret->getLength()) { UpnpNodeList_free(ret); return NULL; } else return((void *)ret);}Upnp_Node UpnpDocument_getFirstChild(Upnp_Document OperationDocument){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getFirstChild(); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_Node UpnpDocument_getLastChild(Upnp_Document OperationDocument){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getLastChild(); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_Node UpnpDocument_getPreviousSibling(Upnp_Document OperationDocument){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getPreviousSibling(); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_Node UpnpDocument_getNextSibling(Upnp_Document OperationDocument){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getNextSibling(); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_NamedNodeMap UpnpDocument_getAttributes(Upnp_Document OperationDocument){ NamedNodeMap *ret = new NamedNodeMap; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getAttributes(); if(!ret->getLength()) { UpnpNamedNodeMap_free(ret); return NULL; } else return((void *)ret);}Upnp_Document UpnpDocument_getOwnerDocument(Upnp_Document OperationDocument){ Document *ret = new Document; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Document *)OperationDocument).getOwnerDocument(); if(ret->isNull()) { UpnpDocument_free(ret); return NULL; } else return((void *)ret);}Upnp_Void UpnpDocument_free(Upnp_Document OperationDocument){ if(OperationDocument == NULL) return; Document *rmv; rmv=(Document *)OperationDocument; rmv->deleteDocumentTree(); // Be ware everything is deleted rmv->deleteDocument(); delete rmv; rmv=NULL;}Upnp_Void UpnpDocumentTree_free(Upnp_Document OperationDocument){ if(OperationDocument == NULL) return; Document *rmv; rmv=(Document *)OperationDocument; rmv->deleteDocumentTree(); delete rmv; rmv=NULL;} /*******************************************************************************************************************************///Interface NodeList Implementation/*******************************************************************************************************************************/Upnp_Node UpnpNodeList_item(Upnp_NodeList OperationNodeList, unsigned long index){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(NodeList *)OperationNodeList).item(index); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}int UpnpNodeList_getLength(Upnp_NodeList OperationNodeList){ return((*(NodeList *)OperationNodeList).getLength());}Upnp_Void UpnpNodeList_free(Upnp_NodeList OperationNodeList){ if(OperationNodeList ==NULL) return; NodeList *rmv; rmv=(NodeList *)OperationNodeList; rmv->deleteNodeList(); delete rmv; rmv=NULL;}/*******************************************************************************************************************************///Interface Element Implementation/*******************************************************************************************************************************/Upnp_Void UpnpElement_setAttribute(Upnp_Element OperationElement, Upnp_DOMString name, Upnp_DOMString value, Upnp_DOMException *err){ *err =NO_ERR; try { (*(Element *)OperationElement).setAttribute(name, value); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; }}Upnp_Attr UpnpElement_setAttributeNode(Upnp_Element OperationElement, Upnp_Attr newAttr, Upnp_DOMException *err){ Attr *ret = new Attr; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *err =NO_ERR; try { *ret = (*(Element *)OperationElement).setAttributeNode(*(Attr *)newAttr); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } if(ret->isNull()) { delete ret; return NULL; } else return((void *)ret);}Upnp_NodeList UpnpElement_getElementsByTagName(Upnp_Element OperationElement, Upnp_DOMString name){ NodeList *ret = new NodeList; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Element *)OperationElement).getElementsByTagName(name); if(!ret->getLength()) { UpnpNodeList_free(ret); return NULL; } else return((void *)ret);}Upnp_Node UpnpElement_insertBefore(Upnp_Element OperationElement, Upnp_Node newChild, Upnp_Node refChild, Upnp_DOMException *err){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *err =NO_ERR; try { *ret = (*(Element *)OperationElement).insertBefore((*(Node *)newChild),(*(Node *)refChild)); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);} Upnp_Node UpnpElement_replaceChild(Upnp_Element OperationElement, Upnp_Node newChild, Upnp_Node oldChild, Upnp_DOMException *err){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *err =NO_ERR; try { *ret = (*(Element *)OperationElement).replaceChild((*(Node *)newChild),(*(Node *)oldChild)); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);} Upnp_Node UpnpElement_removeChild(Upnp_Element OperationElement, Upnp_Node oldChild, Upnp_DOMException *err){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *err =NO_ERR; try { *ret = (*(Element *)OperationElement).removeChild((*(Node *)oldChild)); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);} Upnp_Node UpnpElement_appendChild(Upnp_Element OperationElement, Upnp_Node newChild, Upnp_DOMException *err){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *err =NO_ERR; try { *ret = (*(Element *)OperationElement).appendChild((*(Node *)newChild)); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);} Upnp_Bool UpnpElement_hasChildNodes(Upnp_Element OperationElement){ return((*(Element *)OperationElement).hasChildNodes());} Upnp_Node UpnpElement_cloneNode(Upnp_Element OperationNode, Upnp_Bool deep){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Element *)OperationNode).cloneNode((deep>0)); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_DOMString UpnpElement_getNodeName(Upnp_Element OperationElement){ Upnp_DOMString temp; temp = (*(Element *)OperationElement).getNodeName(); return(temp);}Upnp_DOMString UpnpElement_getNodeValue(Upnp_Element OperationElement, Upnp_DOMException *err){ Upnp_DOMString temp=NULL; *err =NO_ERR; try { temp = (*(Element *)OperationElement).getNodeValue(); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; } return(temp);}Upnp_Void UpnpElement_setNodeValue(Upnp_Element OperationElement, Upnp_DOMString nodeValue, Upnp_DOMException *err){ *err =NO_ERR; try { (*(Element *)OperationElement).setNodeValue(nodeValue); } catch(DOMException &tocatch) { *err = (enum Upnp_DOMException)tocatch.code; }}Upnp_UShort UpnpElement_getNodeType(Upnp_Element OperationElement){ return((*(Element *)OperationElement).getNodeType());}Upnp_Node UpnpElement_getParentNode(Upnp_Element OperationElement){ Node *ret = new Node; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Element *)OperationElement).getParentNode(); if(ret->isNull()) { UpnpNode_free(ret); return NULL; } else return((void *)ret);}Upnp_NodeList UpnpElement_getChildNodes(Upnp_Element OperationElement){ NodeList *ret = new NodeList; if(!ret) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } *ret = (*(Element *)OperationElement).getChildNodes(); if(!ret->getLength()) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -