VirtualBox

Changeset 31539 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Aug 10, 2010 3:40:18 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64639
Message:

Main: use settings struct for machine user data; remove iprt::MiniString::raw() and change all occurences to c_str()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r31481 r31539  
    17181718MachineConfigFile::MachineConfigFile(const Utf8Str *pstrFilename)
    17191719    : ConfigFileBase(pstrFilename),
    1720       fNameSync(true),
    1721       fTeleporterEnabled(false),
    1722       uTeleporterPort(0),
    1723       fRTCUseUTC(false),
    17241720      fCurrentStateModified(true),
    17251721      fAborted(false)
     
    17781774    return (    (this == &c)
    17791775            || (    (uuid                       == c.uuid)
    1780                  && (strName                    == c.strName)
    1781                  && (fNameSync                  == c.fNameSync)
    1782                  && (strDescription             == c.strDescription)
    1783                  && (strOsType                  == c.strOsType)
     1776                 && (machineUserData            == c.machineUserData)
    17841777                 && (strStateFile               == c.strStateFile)
    17851778                 && (uuidCurrentSnapshot        == c.uuidCurrentSnapshot)
    1786                  && (strSnapshotFolder          == c.strSnapshotFolder)
    1787                  && (fTeleporterEnabled         == c.fTeleporterEnabled)
    1788                  && (uTeleporterPort            == c.uTeleporterPort)
    1789                  && (strTeleporterAddress       == c.strTeleporterAddress)
    1790                  && (strTeleporterPassword      == c.strTeleporterPassword)
    1791                  && (fRTCUseUTC                 == c.fRTCUseUTC)
    17921779                 // skip fCurrentStateModified!
    17931780                 && (RTTimeSpecIsEqual(&timeLastStateChange, &c.timeLastStateChange))
     
    25362523        {
    25372524            Utf8Str strLocalOrUTC;
    2538             fRTCUseUTC =    pelmHwChild->getAttributeValue("localOrUTC", strLocalOrUTC)
    2539                          && strLocalOrUTC == "UTC";
     2525            machineUserData.fRTCUseUTC =    pelmHwChild->getAttributeValue("localOrUTC", strLocalOrUTC)
     2526                                         && strLocalOrUTC == "UTC";
    25402527        }
    25412528        else if (    (pelmHwChild->nameEquals("UART"))
     
    30493036    Utf8Str strUUID;
    30503037    if (    (elmMachine.getAttributeValue("uuid", strUUID))
    3051          && (elmMachine.getAttributeValue("name", strName))
     3038         && (elmMachine.getAttributeValue("name", machineUserData.strName))
    30523039       )
    30533040    {
    30543041        parseUUID(uuid, strUUID);
    30553042
    3056         if (!elmMachine.getAttributeValue("nameSync", fNameSync))
    3057             fNameSync = true;
     3043        elmMachine.getAttributeValue("nameSync", machineUserData.fNameSync);
    30583044
    30593045        Utf8Str str;
    3060         elmMachine.getAttributeValue("Description", strDescription);
    3061 
    3062         elmMachine.getAttributeValue("OSType", strOsType);
     3046        elmMachine.getAttributeValue("Description", machineUserData.strDescription);
     3047
     3048        elmMachine.getAttributeValue("OSType", machineUserData.strOsType);
    30633049        if (m->sv < SettingsVersion_v1_5)
    3064             convertOldOSType_pre1_5(strOsType);
     3050            convertOldOSType_pre1_5(machineUserData.strOsType);
    30653051
    30663052        elmMachine.getAttributeValue("stateFile", strStateFile);
    30673053        if (elmMachine.getAttributeValue("currentSnapshot", str))
    30683054            parseUUID(uuidCurrentSnapshot, str);
    3069         elmMachine.getAttributeValue("snapshotFolder", strSnapshotFolder);
     3055        elmMachine.getAttributeValue("snapshotFolder", machineUserData.strSnapshotFolder);
    30703056        if (!elmMachine.getAttributeValue("currentStateModified", fCurrentStateModified))
    30713057            fCurrentStateModified = true;
     
    31033089            }
    31043090            else if (pelmMachineChild->nameEquals("Description"))
    3105                 strDescription = pelmMachineChild->getValue();
     3091                machineUserData.strDescription = pelmMachineChild->getValue();
    31063092            else if (pelmMachineChild->nameEquals("Teleporter"))
    31073093            {
    3108                 if (!pelmMachineChild->getAttributeValue("enabled", fTeleporterEnabled))
    3109                     fTeleporterEnabled = false;
    3110                 if (!pelmMachineChild->getAttributeValue("port", uTeleporterPort))
    3111                     uTeleporterPort = 0;
    3112                 if (!pelmMachineChild->getAttributeValue("address", strTeleporterAddress))
    3113                     strTeleporterAddress = "";
    3114                 if (!pelmMachineChild->getAttributeValue("password", strTeleporterPassword))
    3115                     strTeleporterPassword = "";
     3094                pelmMachineChild->getAttributeValue("enabled", machineUserData.fTeleporterEnabled);
     3095                pelmMachineChild->getAttributeValue("port", machineUserData.uTeleporterPort);
     3096                pelmMachineChild->getAttributeValue("address", machineUserData.strTeleporterAddress);
     3097                pelmMachineChild->getAttributeValue("password", machineUserData.strTeleporterPassword);
    31163098            }
    31173099        }
     
    35743556    {
    35753557        xml::ElementNode *pelmRTC = pelmHardware->createChild("RTC");
    3576         pelmRTC->setAttribute("localOrUTC", fRTCUseUTC ? "UTC" : "local");
     3558        pelmRTC->setAttribute("localOrUTC", machineUserData.fRTCUseUTC ? "UTC" : "local");
    35773559    }
    35783560
     
    37823764
    37833765        xml::ElementNode *pelmController = pelmStorageControllers->createChild("StorageController");
    3784         com::Utf8Str name = sc.strName.raw();
    3785         //
     3766        com::Utf8Str name = sc.strName;
    37863767        if (m->sv < SettingsVersion_v1_8)
    37873768        {
     
    39843965
    39853966    elmMachine.setAttribute("uuid", uuid.toStringCurly());
    3986     elmMachine.setAttribute("name", strName);
    3987     if (!fNameSync)
    3988         elmMachine.setAttribute("nameSync", fNameSync);
    3989     if (strDescription.length())
    3990         elmMachine.createChild("Description")->addContent(strDescription);
    3991     elmMachine.setAttribute("OSType", strOsType);
     3967    elmMachine.setAttribute("name", machineUserData.strName);
     3968    if (!machineUserData.fNameSync)
     3969        elmMachine.setAttribute("nameSync", machineUserData.fNameSync);
     3970    if (machineUserData.strDescription.length())
     3971        elmMachine.createChild("Description")->addContent(machineUserData.strDescription);
     3972    elmMachine.setAttribute("OSType", machineUserData.strOsType);
    39923973    if (strStateFile.length())
    39933974        elmMachine.setAttribute("stateFile", strStateFile);
     
    39953976         && !uuidCurrentSnapshot.isEmpty())
    39963977        elmMachine.setAttribute("currentSnapshot", uuidCurrentSnapshot.toStringCurly());
    3997     if (strSnapshotFolder.length())
    3998         elmMachine.setAttribute("snapshotFolder", strSnapshotFolder);
     3978    if (machineUserData.strSnapshotFolder.length())
     3979        elmMachine.setAttribute("snapshotFolder", machineUserData.strSnapshotFolder);
    39993980    if (!fCurrentStateModified)
    40003981        elmMachine.setAttribute("currentStateModified", fCurrentStateModified);
     
    40033984        elmMachine.setAttribute("aborted", fAborted);
    40043985    if (    m->sv >= SettingsVersion_v1_9
    4005         &&  (   fTeleporterEnabled
    4006             ||  uTeleporterPort
    4007             ||  !strTeleporterAddress.isEmpty()
    4008             ||  !strTeleporterPassword.isEmpty()
     3986        &&  (   machineUserData.fTeleporterEnabled
     3987            ||  machineUserData.uTeleporterPort
     3988            ||  !machineUserData.strTeleporterAddress.isEmpty()
     3989            ||  !machineUserData.strTeleporterPassword.isEmpty()
    40093990            )
    40103991       )
    40113992    {
    40123993        xml::ElementNode *pelmTeleporter = elmMachine.createChild("Teleporter");
    4013         pelmTeleporter->setAttribute("enabled", fTeleporterEnabled);
    4014         pelmTeleporter->setAttribute("port", uTeleporterPort);
    4015         pelmTeleporter->setAttribute("address", strTeleporterAddress);
    4016         pelmTeleporter->setAttribute("password", strTeleporterPassword);
     3994        pelmTeleporter->setAttribute("enabled", machineUserData.fTeleporterEnabled);
     3995        pelmTeleporter->setAttribute("port", machineUserData.uTeleporterPort);
     3996        pelmTeleporter->setAttribute("address", machineUserData.strTeleporterAddress);
     3997        pelmTeleporter->setAttribute("password", machineUserData.strTeleporterPassword);
    40173998    }
    40183999
     
    42444225            || (hardwareMachine.fPageFusionEnabled)
    42454226                // and CPU hotplug, RTC timezone control, HID type and HPET
    4246             || fRTCUseUTC
     4227            || machineUserData.fRTCUseUTC
    42474228            || hardwareMachine.fCpuHotPlug
    42484229            || hardwareMachine.pointingHidType != PointingHidType_PS2Mouse
     
    43084289         && (    (hardwareMachine.firmwareType >= FirmwareType_EFI)
    43094290              || (hardwareMachine.fHardwareVirtExclusive != HWVIRTEXCLUSIVEDEFAULT)
    4310               || fTeleporterEnabled
    4311               || uTeleporterPort
    4312               || !strTeleporterAddress.isEmpty()
    4313               || !strTeleporterPassword.isEmpty()
     4291              || machineUserData.fTeleporterEnabled
     4292              || machineUserData.uTeleporterPort
     4293              || !machineUserData.strTeleporterAddress.isEmpty()
     4294              || !machineUserData.strTeleporterPassword.isEmpty()
    43144295              || !hardwareMachine.uuid.isEmpty()
    43154296            )
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette