VirtualBox

Changeset 91163 in vbox


Ignore:
Timestamp:
Sep 8, 2021 3:21:43 PM (3 years ago)
Author:
vboxsync
Message:

VBoxManageCloudMachine: Factor out the code to get the list of cloud
machines. bugref:10065.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloudMachine.cpp

    r91161 r91163  
    3838                          const char *pcszProviderName,
    3939                          const char *pcszProfileName);
     40
     41static HRESULT getMachineList(com::SafeIfaceArray<ICloudMachine> &aMachines,
     42                              const ComPtr<ICloudClient> &pClient);
     43static HRESULT getMachineById(ComPtr<ICloudMachine> &pMachineOut,
     44                              const ComPtr<ICloudClient> &pClient,
     45                              const char *pcszStrId);
     46
    4047
    4148static RTEXITCODE handleCloudMachineImpl(HandlerArg *a, int iFirst,
     
    246253
    247254static HRESULT
     255getMachineList(com::SafeIfaceArray<ICloudMachine> &aMachines,
     256               const ComPtr<ICloudClient> &pClient)
     257{
     258    HRESULT hrc;
     259
     260    ComPtr<IProgress> pListProgress;
     261    CHECK_ERROR2_RET(hrc, pClient,
     262        ReadCloudMachineList(pListProgress.asOutParam()),
     263            hrc);
     264
     265    hrc = showProgress(pListProgress, SHOW_PROGRESS_NONE);
     266    if (FAILED(hrc))
     267        return hrc;
     268
     269    CHECK_ERROR2_RET(hrc, pClient,
     270        COMGETTER(CloudMachineList)(ComSafeArrayAsOutParam(aMachines)),
     271            hrc);
     272
     273    return S_OK;
     274}
     275
     276
     277static HRESULT
    248278getMachineById(ComPtr<ICloudMachine> &pMachineOut,
    249279               const ComPtr<ICloudClient> &pClient,
     
    449479    }
    450480
    451     ComPtr<IProgress> pListProgress;
    452     CHECK_ERROR2_RET(hrc, pClient,
    453         ReadCloudMachineList(pListProgress.asOutParam()),
    454             RTEXITCODE_FAILURE);
    455 
    456     hrc = showProgress(pListProgress, SHOW_PROGRESS_NONE);
     481    com::SafeIfaceArray<ICloudMachine> aMachines;
     482    hrc = getMachineList(aMachines, pClient);
    457483    if (FAILED(hrc))
    458484        return RTEXITCODE_FAILURE;
    459 
    460     com::SafeIfaceArray<ICloudMachine> aMachines;
    461     CHECK_ERROR2_RET(hrc, pClient,
    462         COMGETTER(CloudMachineList)(ComSafeArrayAsOutParam(aMachines)),
    463             RTEXITCODE_FAILURE);
    464485
    465486    const size_t cMachines = aMachines.size();
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