- Timestamp:
- Mar 9, 2009 1:02:45 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/xml.h
r17417 r17573 447 447 */ 448 448 449 class Node; 450 typedef std::list<const Node*> NodesList; 449 class ElementNode; 450 typedef std::list<const ElementNode*> ElementNodesList; 451 452 class AttributeNode; 453 454 class ContentNode; 451 455 452 456 class VBOXXML_CLASS Node … … 464 468 int getLineNumber() const; 465 469 466 int getChildElements(NodesList &children, 470 int isElement() 471 { 472 return mType == IsElement; 473 } 474 475 protected: 476 typedef enum {IsElement, IsAttribute, IsContent} EnumType; 477 EnumType mType; 478 479 // hide the default constructor so people use only our factory methods 480 Node(EnumType type); 481 Node(const Node &x); // no copying 482 483 void buildChildren(); 484 485 /* Obscure class data */ 486 struct Data; 487 Data *m; 488 }; 489 490 class VBOXXML_CLASS ElementNode : public Node 491 { 492 public: 493 int getChildElements(ElementNodesList &children, 467 494 const char *pcszMatch = NULL) const; 468 495 469 const Node* findChildElement(const char *pcszMatch) const;470 const Node* findChildElementFromId(const char *pcszId) const;471 472 const Node* findAttribute(const char *pcszMatch) const;496 const ElementNode* findChildElement(const char *pcszMatch) const; 497 const ElementNode* findChildElementFromId(const char *pcszId) const; 498 499 const AttributeNode* findAttribute(const char *pcszMatch) const; 473 500 bool getAttributeValue(const char *pcszMatch, com::Utf8Str &str) const; 474 501 bool getAttributeValue(const char *pcszMatch, int64_t &i) const; 475 502 bool getAttributeValue(const char *pcszMatch, uint64_t &i) const; 476 503 477 Node* createChild(const char *pcszElementName);478 Node* addContent(const char *pcszContent);479 Node* setAttribute(const char *pcszName, const char *pcszValue);480 481 pr ivate:504 ElementNode* createChild(const char *pcszElementName); 505 ContentNode* addContent(const char *pcszContent); 506 AttributeNode* setAttribute(const char *pcszName, const char *pcszValue); 507 508 protected: 482 509 // hide the default constructor so people use only our factory methods 483 Node(); 484 510 ElementNode(); 511 ElementNode(const ElementNode &x); // no copying 512 513 friend class Node; 485 514 friend class Document; 486 515 friend class XmlFileParser; 487 488 Node(const Node &x); // no copying 489 490 void buildChildren(); 491 492 /* Obscure class data */ 493 struct Data; 494 Data *m; 516 }; 517 518 class VBOXXML_CLASS ContentNode : public Node 519 { 520 public: 521 522 protected: 523 // hide the default constructor so people use only our factory methods 524 ContentNode(); 525 ContentNode(const ContentNode &x); // no copying 526 527 friend class Node; 528 friend class ElementNode; 529 }; 530 531 class VBOXXML_CLASS AttributeNode : public Node 532 { 533 public: 534 535 protected: 536 // hide the default constructor so people use only our factory methods 537 AttributeNode(); 538 AttributeNode(const AttributeNode &x); // no copying 539 540 friend class Node; 541 friend class ElementNode; 495 542 }; 496 543 … … 503 550 { 504 551 public: 505 NodesLoop(const Node &node, const char *pcszMatch = NULL);552 NodesLoop(const ElementNode &node, const char *pcszMatch = NULL); 506 553 ~NodesLoop(); 507 const Node* forAllNodes() const;554 const ElementNode* forAllNodes() const; 508 555 509 556 private: … … 527 574 Document& operator=(const Document &x); 528 575 529 const Node* getRootElement() const;530 531 Node* createRootElement(const char *pcszRootElementName);576 const ElementNode* getRootElement() const; 577 578 ElementNode* createRootElement(const char *pcszRootElementName); 532 579 533 580 private: -
trunk/src/VBox/Main/ApplianceImpl.cpp
r17566 r17573 373 373 */ 374 374 HRESULT Appliance::LoopThruSections(const char *pcszPath, 375 const xml:: Node *pReferencesElem,376 const xml:: Node *pCurElem)375 const xml::ElementNode *pReferencesElem, 376 const xml::ElementNode *pCurElem) 377 377 { 378 378 HRESULT rc; 379 379 380 380 xml::NodesLoop loopChildren(*pCurElem); 381 const xml:: Node *pElem;381 const xml::ElementNode *pElem; 382 382 while ((pElem = loopChildren.forAllNodes())) 383 383 { 384 384 const char *pcszElemName = pElem->getName(); 385 385 const char *pcszTypeAttr = ""; 386 const xml:: Node *pTypeAttr;386 const xml::AttributeNode *pTypeAttr; 387 387 if ((pTypeAttr = pElem->findAttribute("type"))) 388 388 pcszTypeAttr = pTypeAttr->getValue(); … … 458 458 */ 459 459 HRESULT Appliance::HandleDiskSection(const char *pcszPath, 460 const xml:: Node *pReferencesElem,461 const xml:: Node *pSectionElem)460 const xml::ElementNode *pReferencesElem, 461 const xml::ElementNode *pSectionElem) 462 462 { 463 463 // contains "Disk" child elements 464 464 xml::NodesLoop loopDisks(*pSectionElem, "Disk"); 465 const xml:: Node *pelmDisk;465 const xml::ElementNode *pelmDisk; 466 466 while ((pelmDisk = loopDisks.forAllNodes())) 467 467 { … … 484 484 { 485 485 // look up corresponding /References/File nodes (list built above) 486 const xml:: Node *pFileElem;486 const xml::ElementNode *pFileElem; 487 487 if ( pReferencesElem 488 488 && ((pFileElem = pReferencesElem->findChildElementFromId(strFileRef.c_str()))) … … 537 537 */ 538 538 HRESULT Appliance::HandleNetworkSection(const char *pcszPath, 539 const xml:: Node *pSectionElem)539 const xml::ElementNode *pSectionElem) 540 540 { 541 541 // we ignore network sections for now … … 567 567 */ 568 568 HRESULT Appliance::HandleVirtualSystemContent(const char *pcszPath, 569 const xml:: Node *pelmVirtualSystem)569 const xml::ElementNode *pelmVirtualSystem) 570 570 { 571 571 VirtualSystem vsys; 572 572 573 const xml:: Node *pIdAttr = pelmVirtualSystem->findAttribute("id");573 const xml::AttributeNode *pIdAttr = pelmVirtualSystem->findAttribute("id"); 574 574 if (pIdAttr) 575 575 vsys.strName = pIdAttr->getValue(); 576 576 577 577 xml::NodesLoop loop(*pelmVirtualSystem); // all child elements 578 const xml:: Node *pelmThis;578 const xml::ElementNode *pelmThis; 579 579 while ((pelmThis = loop.forAllNodes())) 580 580 { 581 581 const char *pcszElemName = pelmThis->getName(); 582 const xml:: Node *pTypeAttr = pelmThis->findAttribute("type");582 const xml::AttributeNode *pTypeAttr = pelmThis->findAttribute("type"); 583 583 const char *pcszTypeAttr = (pTypeAttr) ? pTypeAttr->getValue() : ""; 584 584 … … 590 590 </EulaSection> */ 591 591 592 const xml:: Node *pelmInfo, *pelmLicense;592 const xml::ElementNode *pelmInfo, *pelmLicense; 593 593 if ( ((pelmInfo = pelmThis->findChildElement("Info"))) 594 594 && ((pelmLicense = pelmThis->findChildElement("License"))) … … 603 603 ) 604 604 { 605 const xml:: Node *pelmSystem, *pelmVirtualSystemType;605 const xml::ElementNode *pelmSystem, *pelmVirtualSystemType; 606 606 if ((pelmSystem = pelmThis->findChildElement("System"))) 607 607 { … … 618 618 619 619 xml::NodesLoop loopVirtualHardwareItems(*pelmThis, "Item"); // all "Item" child elements 620 const xml:: Node *pelmItem;620 const xml::ElementNode *pelmItem; 621 621 while ((pelmItem = loopVirtualHardwareItems.forAllNodes())) 622 622 { … … 626 626 627 627 xml::NodesLoop loopItemChildren(*pelmItem); // all child elements 628 const xml:: Node *pelmItemChild;628 const xml::ElementNode *pelmItemChild; 629 629 while ((pelmItemChild = loopItemChildren.forAllNodes())) 630 630 { … … 1252 1252 doc); 1253 1253 1254 const xml:: Node *pRootElem = doc.getRootElement();1254 const xml::ElementNode *pRootElem = doc.getRootElement(); 1255 1255 if (strcmp(pRootElem->getName(), "Envelope")) 1256 1256 return setError(VBOX_E_FILE_ERROR, … … 1267 1267 // get all "File" child elements of "References" section so we can look up files easily; 1268 1268 // first find the "References" sections so we can look up files 1269 xml:: NodesList listFileElements; // receives all /Envelope/References/File nodes1270 const xml:: Node *pReferencesElem;1269 xml::ElementNodesList listFileElements; // receives all /Envelope/References/File nodes 1270 const xml::ElementNode *pReferencesElem; 1271 1271 if ((pReferencesElem = pRootElem->findChildElement("References"))) 1272 1272 pReferencesElem->getChildElements(listFileElements, "File"); … … 2465 2465 { 2466 2466 xml::Document doc; 2467 xml:: Node *pelmRoot = doc.createRootElement("Envelope");2467 xml::ElementNode *pelmRoot = doc.createRootElement("Envelope"); 2468 2468 2469 2469 pelmRoot->setAttribute("ovf:version", "1.0"); … … 2479 2479 2480 2480 // <Envelope>/<References> 2481 xml:: Node *pelmReferences = pelmRoot->createChild("References");2481 xml::ElementNode *pelmReferences = pelmRoot->createChild("References"); 2482 2482 // @ŧodo 2483 2483 … … 2487 2487 <Disk ovf:capacity="4294967296" ovf:diskId="lamp" ovf:format="http://www.vmware.com/specifications/vmdk.html#compressed" ovf:populatedSize="1924967692"/> 2488 2488 </DiskSection> */ 2489 xml:: Node *pelmDiskSection = pelmRoot->createChild("DiskSection");2490 xml:: Node *pelmDiskSectionInfo = pelmDiskSection->createChild("Info");2489 xml::ElementNode *pelmDiskSection = pelmRoot->createChild("DiskSection"); 2490 xml::ElementNode *pelmDiskSectionInfo = pelmDiskSection->createChild("Info"); 2491 2491 pelmDiskSectionInfo->addContent("List of the virtual disks used in the package"); 2492 2492 // @todo for each disk: 2493 // xml:: Node *pelmDisk = pelmDiskSection->createChild("Disk");2493 // xml::ElementNode *pelmDisk = pelmDiskSection->createChild("Disk"); 2494 2494 2495 2495 /* <Envelope>/<NetworkSection>: … … 2500 2500 </Network> 2501 2501 </NetworkSection> */ 2502 xml:: Node *pelmNetworkSection = pelmRoot->createChild("NetworkSection");2503 xml:: Node *pelmNetworkSectionInfo = pelmNetworkSection->createChild("Info");2502 xml::ElementNode *pelmNetworkSection = pelmRoot->createChild("NetworkSection"); 2503 xml::ElementNode *pelmNetworkSectionInfo = pelmNetworkSection->createChild("Info"); 2504 2504 pelmNetworkSectionInfo->addContent("Logical networks used in the package"); 2505 2505 // for now, set up a map so we have a list of unique network names (to make … … 2509 2509 2510 2510 // and here come the virtual systems: 2511 xml:: Node *pelmVirtualSystemCollection = pelmRoot->createChild("VirtualSystemCollection");2512 xml:: Node *pattrVirtualSystemCollectionId = pelmVirtualSystemCollection->setAttribute("ovf:id", "ExportedVirtualBoxMachines"); // whatever2511 xml::ElementNode *pelmVirtualSystemCollection = pelmRoot->createChild("VirtualSystemCollection"); 2512 xml::AttributeNode *pattrVirtualSystemCollectionId = pelmVirtualSystemCollection->setAttribute("ovf:id", "ExportedVirtualBoxMachines"); // whatever 2513 2513 2514 2514 list< ComObjPtr<VirtualSystemDescription> >::const_iterator it; … … 2520 2520 ComObjPtr<VirtualSystemDescription> vsdescThis = (*it); 2521 2521 2522 xml:: Node *pelmVirtualSystem = pelmVirtualSystemCollection->createChild("VirtualSystem");2523 xml:: Node *pelmVirtualSystemInfo = pelmVirtualSystem->createChild("Info"); // @todo put in description here after implementing an entry for it2522 xml::ElementNode *pelmVirtualSystem = pelmVirtualSystemCollection->createChild("VirtualSystem"); 2523 xml::ElementNode *pelmVirtualSystemInfo = pelmVirtualSystem->createChild("Info"); // @todo put in description here after implementing an entry for it 2524 2524 2525 2525 std::list<VirtualSystemDescriptionEntry*> llName = vsdescThis->findByType(VirtualSystemDescriptionType_Name); … … 2530 2530 <Description>Linux 2.6.x</Description> 2531 2531 </OperatingSystemSection> */ 2532 xml:: Node *pelmOperatingSystemSection = pelmVirtualSystem->createChild("OperatingSystemSection");2532 xml::ElementNode *pelmOperatingSystemSection = pelmVirtualSystem->createChild("OperatingSystemSection"); 2533 2533 pelmOperatingSystemSection->setAttribute("ovf:id", "82"); 2534 2534 // @todo convert vbox OS type into OVF ID … … 2537 2537 2538 2538 // <VirtualHardwareSection ovf:id="hw1" ovf:transport="iso"> 2539 xml:: Node *pelmVirtualHardwareSection = pelmVirtualSystem->createChild("VirtualHardwareSection");2539 xml::ElementNode *pelmVirtualHardwareSection = pelmVirtualSystem->createChild("VirtualHardwareSection"); 2540 2540 2541 2541 /* <System> … … 2546 2546 <vssd:VirtualSystemType>vmx-4</vssd:VirtualSystemType> 2547 2547 </System> */ 2548 xml:: Node *pelmSystem = pelmVirtualHardwareSection->createChild("System");2548 xml::ElementNode *pelmSystem = pelmVirtualHardwareSection->createChild("System"); 2549 2549 2550 2550 // <vssd:VirtualSystemType>vmx-4</vssd:VirtualSystemType> 2551 xml:: Node *pelmVirtualSystemType = pelmSystem->createChild("VirtualSystemType");2551 xml::ElementNode *pelmVirtualSystemType = pelmSystem->createChild("VirtualSystemType"); 2552 2552 pelmVirtualSystemType->addContent("virtualbox-2.2"); // instead of vmx-7? 2553 2553 … … 2677 2677 if (type) 2678 2678 { 2679 xml:: Node *pItem;2679 xml::ElementNode *pItem; 2680 2680 pItem = pelmVirtualHardwareSection->createChild("Item"); 2681 2681 … … 2714 2714 { 2715 2715 const Utf8Str &strNetwork = itN->first; 2716 xml:: Node *pelmNetwork = pelmNetworkSection->createChild("Network");2716 xml::ElementNode *pelmNetwork = pelmNetworkSection->createChild("Network"); 2717 2717 pelmNetwork->setAttribute("ovf:name", strNetwork.c_str()); 2718 pelmNetwork->createChild(" <Description>")->addContent("Logical network used by this appliance.");2718 pelmNetwork->createChild("Description")->addContent("Logical network used by this appliance."); 2719 2719 } 2720 2720 -
trunk/src/VBox/Main/include/ApplianceImpl.h
r17343 r17573 30 30 { 31 31 class Node; 32 class ElementNode; 32 33 } 33 34 … … 88 89 Data *m; 89 90 90 HRESULT LoopThruSections(const char *pcszPath, const xml:: Node *pReferencesElem, const xml::Node *pCurElem);91 HRESULT HandleDiskSection(const char *pcszPath, const xml:: Node *pReferencesElem, const xml::Node *pSectionElem);92 HRESULT HandleNetworkSection(const char *pcszPath, const xml:: Node *pSectionElem);93 HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml:: Node *pContentElem);91 HRESULT LoopThruSections(const char *pcszPath, const xml::ElementNode *pReferencesElem, const xml::ElementNode *pCurElem); 92 HRESULT HandleDiskSection(const char *pcszPath, const xml::ElementNode *pReferencesElem, const xml::ElementNode *pSectionElem); 93 HRESULT HandleNetworkSection(const char *pcszPath, const xml::ElementNode *pSectionElem); 94 HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml::ElementNode *pContentElem); 94 95 95 96 HRESULT searchUniqueVMName(Utf8Str& aName) const; -
trunk/src/VBox/Main/xml/xml.cpp
r17560 r17573 427 427 428 428 // attributes, if this is an element; can be empty 429 typedef std::map<const char*, boost::shared_ptr< Node>, compare_const_char > AttributesMap;429 typedef std::map<const char*, boost::shared_ptr<AttributeNode>, compare_const_char > AttributesMap; 430 430 AttributesMap attribs; 431 431 … … 435 435 }; 436 436 437 Node::Node() 438 : m(new Data) 437 Node::Node(EnumType type) 438 : mType(type), 439 m(new Data) 439 440 { 440 441 m->plibNode = NULL; … … 455 456 { 456 457 const char *pcszAttribName = (const char*)plibAttr->name; 457 boost::shared_ptr< Node> pNew(newNode);458 boost::shared_ptr<AttributeNode> pNew(new AttributeNode); 458 459 pNew->m->plibAttr = plibAttr; 459 460 pNew->m->pcszName = (const char*)plibAttr->name; … … 469 470 while (plibNode) 470 471 { 471 // create a new Node for this child element 472 boost::shared_ptr<Node> pNew(new Node); 472 boost::shared_ptr<Node> pNew; 473 474 if (plibNode->name) 475 pNew = boost::shared_ptr<Node>(new ElementNode); 476 else 477 pNew = boost::shared_ptr<Node>(new ContentNode); 478 473 479 pNew->m->plibNode = plibNode; 474 480 pNew->m->pcszName = (const char*)plibNode->name; … … 593 599 } 594 600 601 ElementNode::ElementNode() 602 : Node(IsElement) 603 { 604 } 605 595 606 /** 596 607 * Builds a list of direct child elements of the current element that … … 601 612 * @return Number of items appended to the list (0 if none). 602 613 */ 603 int Node::getChildElements(NodesList &children,604 const char *pcszMatch /*= NULL*/)614 int ElementNode::getChildElements(ElementNodesList &children, 615 const char *pcszMatch /*= NULL*/) 605 616 const 606 617 { … … 618 629 ) 619 630 { 620 children.push_back((*it).get()); 631 Node *pNode = (*it).get(); 632 if (pNode->isElement()) 633 children.push_back(static_cast<ElementNode*>(pNode)); 621 634 ++i; 622 635 } … … 630 643 * @return 631 644 */ 632 const Node*Node::findChildElement(const char *pcszMatch)645 const ElementNode* ElementNode::findChildElement(const char *pcszMatch) 633 646 const 634 647 { … … 640 653 ++it) 641 654 { 642 if (!strcmp(pcszMatch, (**it).getName())) // the element name matches 643 return (*it).get(); 655 if ((**it).isElement()) 656 { 657 ElementNode *pelm = static_cast<ElementNode*>((*it).get()); 658 if (!strcmp(pcszMatch, pelm->getName())) // the element name matches 659 return pelm; 660 } 644 661 } 645 662 … … 652 669 * @return child element or NULL if not found. 653 670 */ 654 const Node*Node::findChildElementFromId(const char *pcszId) const671 const ElementNode* ElementNode::findChildElementFromId(const char *pcszId) const 655 672 { 656 673 Data::InternalNodesList::const_iterator … … 661 678 ++it) 662 679 { 663 const Node *pElem = (*it).get(); 664 const Node *pAttr; 665 if ( ((pAttr = pElem->findAttribute("id"))) 666 && (!strcmp(pAttr->getValue(), pcszId)) 667 ) 668 return pElem; 680 if ((**it).isElement()) 681 { 682 ElementNode *pelm = static_cast<ElementNode*>((*it).get()); 683 const AttributeNode *pAttr; 684 if ( ((pAttr = pelm->findAttribute("id"))) 685 && (!strcmp(pAttr->getValue(), pcszId)) 686 ) 687 return pelm; 688 } 669 689 } 670 690 … … 677 697 * @return 678 698 */ 679 const Node*Node::findAttribute(const char *pcszMatch) const699 const AttributeNode* ElementNode::findAttribute(const char *pcszMatch) const 680 700 { 681 701 Data::AttributesMap::const_iterator it; … … 696 716 * @return TRUE if attribute was found and str was thus updated. 697 717 */ 698 bool Node::getAttributeValue(const char *pcszMatch, com::Utf8Str &str) const718 bool ElementNode::getAttributeValue(const char *pcszMatch, com::Utf8Str &str) const 699 719 { 700 720 const Node* pAttr; … … 718 738 * @return TRUE if attribute was found and str was thus updated. 719 739 */ 720 bool Node::getAttributeValue(const char *pcszMatch, int64_t &i) const740 bool ElementNode::getAttributeValue(const char *pcszMatch, int64_t &i) const 721 741 { 722 742 com::Utf8Str str; … … 739 759 * @return TRUE if attribute was found and str was thus updated. 740 760 */ 741 bool Node::getAttributeValue(const char *pcszMatch, uint64_t &i) const761 bool ElementNode::getAttributeValue(const char *pcszMatch, uint64_t &i) const 742 762 { 743 763 com::Utf8Str str; … … 757 777 * @return 758 778 */ 759 Node*Node::createChild(const char *pcszElementName)779 ElementNode* ElementNode::createChild(const char *pcszElementName) 760 780 { 761 781 // we must be an element, not an attribute … … 771 791 772 792 // now wrap this in C++ 773 Node *p = newNode;774 boost::shared_ptr< Node> pNew(p);793 ElementNode *p = new ElementNode; 794 boost::shared_ptr<ElementNode> pNew(p); 775 795 pNew->m->plibNode = plibNode; 776 796 pNew->m->pcszName = (const char*)plibNode->name; … … 789 809 * @return 790 810 */ 791 Node* Node::addContent(const char *pcszContent) 792 { 793 // we must be an element, not an attribute 794 if (!m->plibNode) 795 throw ENodeIsNotElement(RT_SRC_POS); 796 811 ContentNode* ElementNode::addContent(const char *pcszContent) 812 { 797 813 // libxml side: create new node 798 814 xmlNode *plibNode; … … 802 818 803 819 // now wrap this in C++ 804 Node *p = newNode;805 boost::shared_ptr< Node> pNew(p);820 ContentNode *p = new ContentNode; 821 boost::shared_ptr<ContentNode> pNew(p); 806 822 pNew->m->plibNode = plibNode; 807 823 pNew->m->pcszName = NULL; … … 813 829 814 830 /** 815 * Sets the given attribute. Assumes that "this" is an element node, 816 * otherwise ENodeIsNotElement is thrown. 831 * Sets the given attribute. 817 832 * 818 833 * If an attribute with the given name exists, it is overwritten, … … 824 839 * @return 825 840 */ 826 Node* Node::setAttribute(const char *pcszName, const char *pcszValue) 827 { 828 // we must be an element, not an attribute 829 if (!m->plibNode) 830 throw ENodeIsNotElement(RT_SRC_POS); 831 841 AttributeNode* ElementNode::setAttribute(const char *pcszName, const char *pcszValue) 842 { 832 843 Data::AttributesMap::const_iterator it; 833 844 … … 840 851 841 852 // C++ side: create an attribute node around it 842 boost::shared_ptr< Node> pNew(newNode);853 boost::shared_ptr<AttributeNode> pNew(new AttributeNode); 843 854 pNew->m->plibAttr = plibAttr; 844 855 pNew->m->pcszName = (const char*)plibAttr->name; … … 858 869 859 870 871 AttributeNode::AttributeNode() 872 : Node(IsAttribute) 873 { 874 } 875 876 ContentNode::ContentNode() 877 : Node(IsContent) 878 { 879 } 880 860 881 /* 861 882 * NodesLoop … … 865 886 struct NodesLoop::Data 866 887 { 867 NodesList listElements;868 NodesList::const_iterator it;888 ElementNodesList listElements; 889 ElementNodesList::const_iterator it; 869 890 }; 870 891 871 NodesLoop::NodesLoop(const Node &node, const char *pcszMatch /* = NULL */)892 NodesLoop::NodesLoop(const ElementNode &node, const char *pcszMatch /* = NULL */) 872 893 { 873 894 m = new Data; … … 897 918 * @return 898 919 */ 899 const Node* NodesLoop::forAllNodes() const900 { 901 const Node *pNode = NULL;920 const ElementNode* NodesLoop::forAllNodes() const 921 { 922 const ElementNode *pNode = NULL; 902 923 903 924 if (m->it != m->listElements.end()) … … 919 940 { 920 941 xmlDocPtr plibDocument; 921 Node*pRootElement;942 ElementNode *pRootElement; 922 943 923 944 Data() … … 986 1007 void Document::refreshInternals() // private 987 1008 { 988 m->pRootElement = new Node();1009 m->pRootElement = new ElementNode(); 989 1010 m->pRootElement->m->plibNode = xmlDocGetRootElement(m->plibDocument); 990 1011 m->pRootElement->m->pcszName = (const char*)m->pRootElement->m->plibNode->name; … … 997 1018 * @return 998 1019 */ 999 const Node* Document::getRootElement() const1020 const ElementNode* Document::getRootElement() const 1000 1021 { 1001 1022 return m->pRootElement; … … 1006 1027 * only work if the document is empty; otherwise EDocumentNotEmpty is thrown. 1007 1028 */ 1008 Node* Document::createRootElement(const char *pcszRootElementName)1029 ElementNode* Document::createRootElement(const char *pcszRootElementName) 1009 1030 { 1010 1031 if (m->pRootElement || m->plibDocument) … … 1020 1041 1021 1042 // now wrap this in C++ 1022 m->pRootElement = new Node();1043 m->pRootElement = new ElementNode(); 1023 1044 m->pRootElement->m->plibNode = plibRootNode; 1024 1045 m->pRootElement->m->pcszName = (const char*)plibRootNode->name;
Note:
See TracChangeset
for help on using the changeset viewer.