Changeset 27835 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Mar 30, 2010 4:40:44 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59510
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r27830 r27835 2952 2952 * @param st 2953 2953 */ 2954 void MachineConfigFile:: writeHardware(xml::ElementNode &elmParent,2955 const Hardware &hw,2956 const Storage &strg)2954 void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent, 2955 const Hardware &hw, 2956 const Storage &strg) 2957 2957 { 2958 2958 xml::ElementNode *pelmHardware = elmParent.createChild("Hardware"); … … 3442 3442 * @param st 3443 3443 */ 3444 void MachineConfigFile:: writeStorageControllers(xml::ElementNode &elmParent,3445 const Storage &st)3444 void MachineConfigFile::buildStorageControllersXML(xml::ElementNode &elmParent, 3445 const Storage &st) 3446 3446 { 3447 3447 xml::ElementNode *pelmStorageControllers = elmParent.createChild("StorageControllers"); … … 3560 3560 * @param snap 3561 3561 */ 3562 void MachineConfigFile:: writeSnapshot(xml::ElementNode &elmParent,3563 const Snapshot &snap)3562 void MachineConfigFile::buildSnapshotXML(xml::ElementNode &elmParent, 3563 const Snapshot &snap) 3564 3564 { 3565 3565 xml::ElementNode *pelmSnapshot = elmParent.createChild("Snapshot"); … … 3575 3575 pelmSnapshot->createChild("Description")->addContent(snap.strDescription); 3576 3576 3577 writeHardware(*pelmSnapshot, snap.hardware, snap.storage);3578 writeStorageControllers(*pelmSnapshot, snap.storage);3577 buildHardwareXML(*pelmSnapshot, snap.hardware, snap.storage); 3578 buildStorageControllersXML(*pelmSnapshot, snap.storage); 3579 3579 3580 3580 if (snap.llChildSnapshots.size()) … … 3586 3586 { 3587 3587 const Snapshot &child = *it; 3588 writeSnapshot(*pelmChildren, child); 3589 } 3590 } 3588 buildSnapshotXML(*pelmChildren, child); 3589 } 3590 } 3591 } 3592 3593 /** 3594 * Builds the XML DOM tree for the machine config under the given XML element. 3595 * This has been separated out from write() so it can be called from elsewhere, 3596 * such as the OVF code, to build machine XML in an existing XML tree. 3597 * @param elmMachine 3598 */ 3599 void MachineConfigFile::buildMachineXML(xml::ElementNode &elmMachine) 3600 { 3601 elmMachine.setAttribute("uuid", makeString(uuid)); 3602 elmMachine.setAttribute("name", strName); 3603 if (!fNameSync) 3604 elmMachine.setAttribute("nameSync", fNameSync); 3605 if (strDescription.length()) 3606 elmMachine.createChild("Description")->addContent(strDescription); 3607 elmMachine.setAttribute("OSType", strOsType); 3608 if (strStateFile.length()) 3609 elmMachine.setAttribute("stateFile", strStateFile); 3610 if (!uuidCurrentSnapshot.isEmpty()) 3611 elmMachine.setAttribute("currentSnapshot", makeString(uuidCurrentSnapshot)); 3612 if (strSnapshotFolder.length()) 3613 elmMachine.setAttribute("snapshotFolder", strSnapshotFolder); 3614 if (!fCurrentStateModified) 3615 elmMachine.setAttribute("currentStateModified", fCurrentStateModified); 3616 elmMachine.setAttribute("lastStateChange", makeString(timeLastStateChange)); 3617 if (fAborted) 3618 elmMachine.setAttribute("aborted", fAborted); 3619 if ( m->sv >= SettingsVersion_v1_9 3620 && ( fTeleporterEnabled 3621 || uTeleporterPort 3622 || !strTeleporterAddress.isEmpty() 3623 || !strTeleporterPassword.isEmpty() 3624 ) 3625 ) 3626 { 3627 xml::ElementNode *pelmTeleporter = elmMachine.createChild("Teleporter"); 3628 pelmTeleporter->setAttribute("enabled", fTeleporterEnabled); 3629 pelmTeleporter->setAttribute("port", uTeleporterPort); 3630 pelmTeleporter->setAttribute("address", strTeleporterAddress); 3631 pelmTeleporter->setAttribute("password", strTeleporterPassword); 3632 } 3633 3634 writeExtraData(elmMachine, mapExtraDataItems); 3635 3636 if (llFirstSnapshot.size()) 3637 buildSnapshotXML(elmMachine, llFirstSnapshot.front()); 3638 3639 buildHardwareXML(elmMachine, hardwareMachine, storageMachine); 3640 buildStorageControllersXML(elmMachine, storageMachine); 3591 3641 } 3592 3642 … … 3726 3776 3727 3777 xml::ElementNode *pelmMachine = m->pelmRoot->createChild("Machine"); 3728 3729 pelmMachine->setAttribute("uuid", makeString(uuid)); 3730 pelmMachine->setAttribute("name", strName); 3731 if (!fNameSync) 3732 pelmMachine->setAttribute("nameSync", fNameSync); 3733 if (strDescription.length()) 3734 pelmMachine->createChild("Description")->addContent(strDescription); 3735 pelmMachine->setAttribute("OSType", strOsType); 3736 if (strStateFile.length()) 3737 pelmMachine->setAttribute("stateFile", strStateFile); 3738 if (!uuidCurrentSnapshot.isEmpty()) 3739 pelmMachine->setAttribute("currentSnapshot", makeString(uuidCurrentSnapshot)); 3740 if (strSnapshotFolder.length()) 3741 pelmMachine->setAttribute("snapshotFolder", strSnapshotFolder); 3742 if (!fCurrentStateModified) 3743 pelmMachine->setAttribute("currentStateModified", fCurrentStateModified); 3744 pelmMachine->setAttribute("lastStateChange", makeString(timeLastStateChange)); 3745 if (fAborted) 3746 pelmMachine->setAttribute("aborted", fAborted); 3747 if ( m->sv >= SettingsVersion_v1_9 3748 && ( fTeleporterEnabled 3749 || uTeleporterPort 3750 || !strTeleporterAddress.isEmpty() 3751 || !strTeleporterPassword.isEmpty() 3752 ) 3753 ) 3754 { 3755 xml::ElementNode *pelmTeleporter = pelmMachine->createChild("Teleporter"); 3756 pelmTeleporter->setAttribute("enabled", fTeleporterEnabled); 3757 pelmTeleporter->setAttribute("port", uTeleporterPort); 3758 pelmTeleporter->setAttribute("address", strTeleporterAddress); 3759 pelmTeleporter->setAttribute("password", strTeleporterPassword); 3760 } 3761 3762 writeExtraData(*pelmMachine, mapExtraDataItems); 3763 3764 if (llFirstSnapshot.size()) 3765 writeSnapshot(*pelmMachine, llFirstSnapshot.front()); 3766 3767 writeHardware(*pelmMachine, hardwareMachine, storageMachine); 3768 writeStorageControllers(*pelmMachine, storageMachine); 3778 buildMachineXML(*pelmMachine); 3769 3779 3770 3780 // now go write the XML
Note:
See TracChangeset
for help on using the changeset viewer.