VirtualBox

Ignore:
Timestamp:
Aug 11, 2009 3:38:59 PM (15 years ago)
Author:
vboxsync
Message:

Main: the big XML settings rework. Move XML reading/writing out of interface implementation code into separate layer so it can handle individual settings versions in the future.

File:
1 edited

Legend:

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

    r21878 r22173  
    8686}
    8787
    88 HRESULT DHCPServer::init(VirtualBox *aVirtualBox, const settings::Key &aNode)
    89 {
    90     using namespace settings;
    91 
     88HRESULT DHCPServer::init(VirtualBox *aVirtualBox,
     89                         const settings::DHCPServer &data)
     90{
    9291    /* Enclose the state transition NotReady->InInit->Ready */
    9392    AutoInitSpan autoInitSpan(this);
     
    9998    aVirtualBox->addDependentChild (this);
    10099
    101     unconst(mName) = aNode.stringValue ("networkName");
    102     m.IPAddress = aNode.stringValue ("IPAddress");
    103     m.networkMask = aNode.stringValue ("networkMask");
    104     m.enabled = aNode.value <bool> ("enabled");
    105     m.lowerIP = aNode.stringValue ("lowerIP");
    106     m.upperIP = aNode.stringValue ("upperIP");
     100    unconst(mName) = data.strNetworkName;
     101    m.IPAddress = data.strIPAddress;
     102    m.networkMask = data.strIPNetworkMask;
     103    m.enabled = data.fEnabled;
     104    m.lowerIP = data.strIPLower;
     105    m.upperIP = data.strIPUpper;
    107106
    108107    autoInitSpan.setSucceeded();
     
    111110}
    112111
    113 HRESULT DHCPServer::saveSettings (settings::Key &aParentNode)
    114 {
    115     using namespace settings;
    116 
    117     AssertReturn(!aParentNode.isNull(), E_FAIL);
    118 
     112HRESULT DHCPServer::saveSettings(settings::DHCPServer &data)
     113{
    119114    AutoCaller autoCaller(this);
    120115    CheckComRCReturnRC(autoCaller.rc());
     
    122117    AutoReadLock alock(this);
    123118
    124     Key aNode = aParentNode.appendKey ("DHCPServer");
    125     /* required */
    126     aNode.setValue <Bstr> ("networkName", mName);
    127     aNode.setValue <Bstr> ("IPAddress", m.IPAddress);
    128     aNode.setValue <Bstr> ("networkMask", m.networkMask);
    129     aNode.setValue <Bstr> ("lowerIP", m.lowerIP);
    130     aNode.setValue <Bstr> ("upperIP", m.upperIP);
    131     /* To force it back to a numeric value; will otherwise break for 2.2.x. */
    132     aNode.setValue <ULONG> ("enabled", m.enabled);
     119    data.strNetworkName = mName;
     120    data.strIPAddress = m.IPAddress;
     121    data.strIPNetworkMask = m.networkMask;
     122    data.fEnabled = m.enabled;
     123    data.strIPLower = m.lowerIP;
     124    data.strIPUpper = m.upperIP;
    133125
    134126    return S_OK;
     
    243235}
    244236
    245 STDMETHODIMP DHCPServer::Start (IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType)
     237STDMETHODIMP DHCPServer::Start(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType)
    246238{
    247239    /* Silently ignore attepmts to run disabled servers. */
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