Changeset 18052 in vbox
- Timestamp:
- Mar 18, 2009 9:56:49 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
include/VBox/xml.h (modified) (1 diff)
-
src/VBox/Main/ApplianceImpl.cpp (modified) (7 diffs)
-
src/VBox/Main/xml/xml.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/xml.h
r17573 r18052 298 298 * Possible file access modes. 299 299 */ 300 enum Mode { Mode_Read, Mode_Write , Mode_ReadWrite };300 enum Mode { Mode_Read, Mode_WriteCreate, Mode_Overwrite, Mode_ReadWrite }; 301 301 302 302 /** -
trunk/src/VBox/Main/ApplianceImpl.cpp
r18024 r18052 508 508 return rc; 509 509 } 510 else if ( (!strcmp(pcszElemName, "NetworkSection")) // we ignore NetworkSections for now510 else if ( (!strcmp(pcszElemName, "NetworkSection")) 511 511 || ( (!strcmp(pcszElemName, "Section")) 512 512 && (!strcmp(pcszTypeAttr, "ovf:NetworkSection_Type")) … … 517 517 return rc; 518 518 } 519 else if ( (!strcmp(pcszElemName, "DeploymentOptionSection >")))519 else if ( (!strcmp(pcszElemName, "DeploymentOptionSection"))) 520 520 { 521 521 // TODO … … 694 694 const char *pcszTypeAttr = (pTypeAttr) ? pTypeAttr->getValue() : ""; 695 695 696 if (!strcmp(pcszElemName, "Info")) 697 { 698 // the "Info" section directly under VirtualSystem is where our export routine 699 // chooses to save the VM description (comments), so re-import it from there too 700 vsys.strDescription = pelmThis->getValue(); 701 } 702 else if (!strcmp(pcszElemName, "EulaSection")) 696 if (!strcmp(pcszElemName, "EulaSection")) 703 697 { 704 698 /* <EulaSection> … … 1063 1057 vsys.cimos = (CIMOSType_T)cimos64; 1064 1058 } 1059 else if ( (!strcmp(pcszElemName, "AnnotationSection")) 1060 || (!strcmp(pcszTypeAttr, "ovf:AnnotationSection_Type")) 1061 ) 1062 { 1063 const xml::ElementNode *pelmAnnotation; 1064 if ((pelmAnnotation = pelmThis->findChildElement("Annotation"))) 1065 vsys.strDescription = pelmAnnotation->getValue(); 1066 } 1065 1067 } 1066 1068 … … 2561 2563 pelmRoot->setAttribute("xsi:schemaLocation", "http://schemas.dmtf.org/ovf/envelope/1 ../ovf-envelope.xsd"); 2562 2564 2563 2564 2565 // <Envelope>/<References> 2565 2566 xml::ElementNode *pelmReferences = pelmRoot->createChild("References"); 2566 // @ŧodo2567 2567 2568 2568 /* <Envelope>/<DiskSection>: … … 2607 2607 xml::ElementNode *pelmVirtualSystem = pelmVirtualSystemCollection->createChild("VirtualSystem"); 2608 2608 2609 xml::ElementNode *pelmVirtualSystemInfo = pelmVirtualSystem->createChild("Info"); 2610 std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description); 2611 if (llDescription.size()) 2612 pelmVirtualSystemInfo->addContent(llDescription.front()->strVbox); 2609 /*xml::ElementNode *pelmVirtualSystemInfo =*/ pelmVirtualSystem->createChild("Info")->addContent("A virtual machine"); 2613 2610 2614 2611 std::list<VirtualSystemDescriptionEntry*> llName = vsdescThis->findByType(VirtualSystemDescriptionType_Name); … … 2618 2615 pelmVirtualSystem->setAttribute("ovf:id", llName.front()->strVbox); 2619 2616 2617 // description 2618 std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description); 2619 if (llDescription.size()) 2620 { 2621 /* <Section ovf:required="false" xsi:type="ovf:AnnotationSection_Type"> 2622 <Info>A human-readable annotation</Info> 2623 <Annotation>Plan 9</Annotation> 2624 </Section> */ 2625 xml::ElementNode *pelmAnnotationSection = pelmVirtualSystem->createChild("AnnotationSection"); 2626 pelmAnnotationSection->createChild("Info")->addContent("A human-readable annotation"); 2627 pelmAnnotationSection->createChild("Annotation")->addContent(llDescription.front()->strVbox); 2628 } 2629 2630 // operating system 2620 2631 std::list<VirtualSystemDescriptionEntry*> llOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS); 2621 2632 if (llOS.size() != 1) -
trunk/src/VBox/Main/xml/xml.cpp
r17664 r18052 184 184 flags = RTFILE_O_READ; 185 185 break; 186 case Mode_Write :186 case Mode_WriteCreate: // fail if file exists 187 187 flags = RTFILE_O_WRITE | RTFILE_O_CREATE; 188 break; 189 case Mode_Overwrite: // overwrite if file exists 190 flags = RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE; 188 191 break; 189 192 case Mode_ReadWrite: … … 1133 1136 { 1134 1137 WriteContext(const char *pcszFilename) 1135 : IOContext(pcszFilename, File::Mode_ Write)1138 : IOContext(pcszFilename, File::Mode_Overwrite) 1136 1139 { 1137 1140 }
Note:
See TracChangeset
for help on using the changeset viewer.

