VirtualBox

Changeset 90274 in vbox


Ignore:
Timestamp:
Jul 21, 2021 1:43:05 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145813
Message:

VBoxManage: Print integer and choice form values. Not tested, as the
details form doesn't use them currently. bugref:10065.

File:
1 edited

Legend:

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

    r90269 r90274  
    638638            {
    639639                RTStrmPrintf(g_pStdErr,
    640                     "%ls: unable to obtain boolean value\n", bstrLabel.raw());
     640                    "%ls: unable to convert to boolean value\n", bstrLabel.raw());
    641641                break;
    642642            }
     
    663663            {
    664664                RTStrmPrintf(g_pStdErr,
    665                     "%ls: unable to obtain string value\n", bstrLabel.raw());
     665                    "%ls: unable to convert to string value\n", bstrLabel.raw());
    666666                break;
    667667            }
     
    698698
    699699        case FormValueType_RangedInteger:
    700             RTStrmPrintf(g_pStdOut, "integer\n");
     700        {
     701            ComPtr<IRangedIntegerFormValue> pIntValue;
     702            hrc = pValue.queryInterfaceTo(pIntValue.asOutParam());
     703            if (FAILED(hrc))
     704            {
     705                RTStrmPrintf(g_pStdErr,
     706                    "%ls: unable to convert to integer value\n", bstrLabel.raw());
     707                break;
     708            }
     709
     710            LONG lValue;
     711            hrc = pIntValue->GetInteger(&lValue);
     712            if (FAILED(hrc))
     713            {
     714                RTStrmPrintf(g_pStdOut,
     715                    "%ls: %Rhra", bstrLabel.raw(), hrc);
     716                break;
     717            }
     718
     719            RTPrintf("%ls: %RI64\n",
     720                bstrLabel.raw(), (int64_t)lValue);
    701721            break;
     722        }
    702723
    703724        case FormValueType_Choice:
    704             RTStrmPrintf(g_pStdOut, "choice\n");
     725        {
     726            ComPtr<IChoiceFormValue> pChoiceValue;
     727            hrc = pValue.queryInterfaceTo(pChoiceValue.asOutParam());
     728            if (FAILED(hrc))
     729            {
     730                RTStrmPrintf(g_pStdErr,
     731                    "%ls: unable to convert to choice value\n", bstrLabel.raw());
     732                break;
     733            }
     734
     735            com::SafeArray<BSTR> aValues;
     736            hrc = pChoiceValue->COMGETTER(Values)(ComSafeArrayAsOutParam(aValues));
     737            if (FAILED(hrc))
     738            {
     739                RTStrmPrintf(g_pStdOut,
     740                    "%ls: values: %Rhra", bstrLabel.raw(), hrc);
     741                break;
     742            }
     743
     744            LONG idxSelected = -1;
     745            hrc = pChoiceValue->GetSelectedIndex(&idxSelected);
     746            if (FAILED(hrc))
     747            {
     748                RTStrmPrintf(g_pStdOut,
     749                    "%ls: selectedIndex: %Rhra", bstrLabel.raw(), hrc);
     750                break;
     751            }
     752
     753            if (idxSelected < 0 || (size_t)idxSelected >  aValues.size())
     754            {
     755                RTStrmPrintf(g_pStdOut,
     756                    "%ls: selected index %RI64 out of range [0, %zu)\n",
     757                             bstrLabel.raw(), (int64_t)idxSelected, aValues.size());
     758                break;
     759            }
     760
     761            RTPrintf("%ls: %ls\n",
     762                bstrLabel.raw(), aValues[idxSelected]);
    705763            break;
     764        }
    706765
    707766        default:
     767        {
    708768            RTStrmPrintf(g_pStdOut, "unknown value type %RU32\n", enmType);
    709769            break;
     770        }
    710771    }
    711772
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