VirtualBox

Ignore:
Timestamp:
Mar 31, 2010 5:10:40 PM (15 years ago)
Author:
vboxsync
Message:

Main/OVF: import vbox:Machine XML within OVF, first batch (XML is parsed and machine config created, but COM Machine can't handle it yet)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ApplianceImpl.cpp

    r27908 r27918  
    964964    /* Initialize data */
    965965    m = new Data();
     966    m->pConfig = NULL;
    966967
    967968    /* Confirm a successful initialization */
     
    976977void VirtualSystemDescription::uninit()
    977978{
     979    if (m->pConfig)
     980        delete m->pConfig;
    978981    delete m;
    979982    m = NULL;
     
    13231326}
    13241327
     1328/**
     1329 * Method called from Appliance::Interpret() if the source OVF for a virtual system
     1330 * contains a <vbox:Machine> element. This method then attempts to parse that and
     1331 * create a MachineConfigFile instance from it which is stored in this instance data
     1332 * and can then be used to create a machine.
     1333 *
     1334 * This must only be called once per instance.
     1335 *
     1336 * This rethrows all XML and logic errors from MachineConfigFile.
     1337 *
     1338 * @param elmMachine <vbox:Machine> element with attributes and subelements from some
     1339 *                  DOM tree.
     1340 */
     1341void VirtualSystemDescription::importVboxMachineXML(const xml::ElementNode &elmMachine)
     1342{
     1343    settings::MachineConfigFile *pConfig = NULL;
     1344
     1345    Assert(m->pConfig == NULL);
     1346
     1347    try
     1348    {
     1349        pConfig = new settings::MachineConfigFile(NULL);
     1350        pConfig->importMachineXML(elmMachine);
     1351
     1352        m->pConfig = pConfig;
     1353    }
     1354    catch (...)
     1355    {
     1356        if (pConfig)
     1357            delete pConfig;
     1358        throw;
     1359    }
     1360}
     1361
     1362/**
     1363 * Returns the machine config created by importVboxMachineXML() or NULL if there's none.
     1364 * @return
     1365 */
     1366const settings::MachineConfigFile* VirtualSystemDescription::getMachineConfig() const
     1367{
     1368    return m->pConfig;
     1369}
     1370
Note: See TracChangeset for help on using the changeset viewer.

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