VirtualBox

Changeset 13673 in vbox


Ignore:
Timestamp:
Oct 30, 2008 1:04:36 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
38632
Message:

Main: Added the Name, Capabilities, ConfigNames attributes. Removed all support* methods.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

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

    r13580 r13673  
    1 /* $Id $ */
     1/* $Id$ */
    22
    33/** @file
     
    5050 * @param aVDInfo  Pointer to a backend info object.
    5151 */
    52 HRESULT HardDiskFormat::init (VDBACKENDINFO *aVDInfo)
     52HRESULT HardDiskFormat::init (const VDBACKENDINFO *aVDInfo)
    5353{
    5454    LogFlowThisFunc (("aVDInfo=%p\n", aVDInfo));
     
    6262    /* The ID of the backend */
    6363    unconst (mData.id) = aVDInfo->pszBackend;
     64    /* The Name of the backend */
     65    /* Use id for now as long as VDBACKENDINFO hasn't any extra
     66     * name/description field. */
     67    unconst (mData.name) = aVDInfo->pszBackend;
    6468    /* The capabilities of the backend */
    6569    unconst (mData.capabilities) = aVDInfo->uBackendCaps;
     
    7478        }
    7579    }
     80    /* Save a list of config names */
     81    if (aVDInfo->paConfigInfo)
     82    {
     83        PCVDCONFIGINFO pa = aVDInfo->paConfigInfo;
     84        while (pa->pszKey != NULL)
     85        {
     86            unconst (mData.configNames).push_back (*pa->pszKey);
     87            ++ pa;
     88        }
     89    }
    7690
    7791    /* Confirm a successful initialization */
     
    94108        return;
    95109
     110    unconst (mData.configNames).clear();
    96111    unconst (mData.fileExtensions).clear();
    97112    unconst (mData.capabilities) = 0;
     113    unconst (mData.name).setNull();
    98114    unconst (mData.id).setNull();
    99115}
     
    110126    CheckComRCReturnRC (autoCaller.rc());
    111127
    112     /* mData.id is const, no need to lock */
    113 
     128    /* this is const, no need to lock */
    114129    mData.id.cloneTo (aId);
     130
     131    return S_OK;
     132}
     133
     134STDMETHODIMP HardDiskFormat::COMGETTER(Name)(BSTR *aName)
     135{
     136    if (!aName)
     137        return E_POINTER;
     138
     139    AutoCaller autoCaller (this);
     140    CheckComRCReturnRC (autoCaller.rc());
     141
     142    /* this is const, no need to lock */
     143    mData.name.cloneTo (aName);
    115144
    116145    return S_OK;
     
    126155    CheckComRCReturnRC (autoCaller.rc());
    127156
    128     /* mData.fileExtensions is const, no need to lock */
    129 
     157    /* this is const, no need to lock */
    130158    com::SafeArray <BSTR> fileExtentions (mData.fileExtensions.size());
    131159    int i = 0;
     
    138166}
    139167
    140 STDMETHODIMP HardDiskFormat::COMGETTER(SupportUuid)(BOOL *aBool)
    141 {
    142     if (!aBool)
    143         return E_POINTER;
    144 
    145     AutoCaller autoCaller (this);
    146     CheckComRCReturnRC (autoCaller.rc());
    147 
    148     /* mData.capabilities is const, no need to lock */
    149 
    150     *aBool = mData.capabilities & VD_CAP_UUID;
    151 
    152     return S_OK;
    153 }
    154 
    155 STDMETHODIMP HardDiskFormat::COMGETTER(SupportCreateFixed)(BOOL *aBool)
    156 {
    157     if (!aBool)
    158         return E_POINTER;
    159 
    160     AutoCaller autoCaller (this);
    161     CheckComRCReturnRC (autoCaller.rc());
    162 
    163     /* mData.capabilities is const, no need to lock */
    164 
    165     *aBool = mData.capabilities & VD_CAP_CREATE_FIXED;
    166 
    167     return S_OK;
    168 }
    169 
    170 STDMETHODIMP HardDiskFormat::COMGETTER(SupportCreateDynamic)(BOOL *aBool)
    171 {
    172     if (!aBool)
    173         return E_POINTER;
    174 
    175     AutoCaller autoCaller (this);
    176     CheckComRCReturnRC (autoCaller.rc());
    177 
    178     /* mData.capabilities is const, no need to lock */
    179 
    180     *aBool = mData.capabilities & VD_CAP_CREATE_DYNAMIC;
    181 
    182     return S_OK;
    183 }
    184 
    185 STDMETHODIMP HardDiskFormat::COMGETTER(SupportCreateSplit2G)(BOOL *aBool)
    186 {
    187     if (!aBool)
    188         return E_POINTER;
    189 
    190     AutoCaller autoCaller (this);
    191     CheckComRCReturnRC (autoCaller.rc());
    192 
    193     /* mData.capabilities is const, no need to lock */
    194 
    195     *aBool = mData.capabilities & VD_CAP_CREATE_SPLIT_2G;
    196 
    197     return S_OK;
    198 }
    199 
    200 STDMETHODIMP HardDiskFormat::COMGETTER(SupportDiff)(BOOL *aBool)
    201 {
    202     if (!aBool)
    203         return E_POINTER;
    204 
    205     AutoCaller autoCaller (this);
    206     CheckComRCReturnRC (autoCaller.rc());
    207 
    208     /* mData.capabilities is const, no need to lock */
    209 
    210     *aBool = mData.capabilities & VD_CAP_DIFF;
    211 
    212     return S_OK;
    213 }
    214 
    215 STDMETHODIMP HardDiskFormat::COMGETTER(SupportASync)(BOOL *aBool)
    216 {
    217     if (!aBool)
    218         return E_POINTER;
    219 
    220     AutoCaller autoCaller (this);
    221     CheckComRCReturnRC (autoCaller.rc());
    222 
    223     /* mData.capabilities is const, no need to lock */
    224 
    225     *aBool = mData.capabilities & VD_CAP_ASYNC;
    226 
    227     return S_OK;
    228 }
    229 
    230 STDMETHODIMP HardDiskFormat::COMGETTER(SupportFile)(BOOL *aBool)
    231 {
    232     if (!aBool)
    233         return E_POINTER;
    234 
    235     AutoCaller autoCaller (this);
    236     CheckComRCReturnRC (autoCaller.rc());
    237 
    238     /* mData.capabilities is const, no need to lock */
    239 
    240     *aBool = mData.capabilities & VD_CAP_FILE;
    241 
    242     return S_OK;
    243 }
    244 
    245 STDMETHODIMP HardDiskFormat::COMGETTER(SupportConfig)(BOOL *aBool)
    246 {
    247     if (!aBool)
    248         return E_POINTER;
    249 
    250     AutoCaller autoCaller (this);
    251     CheckComRCReturnRC (autoCaller.rc());
    252 
    253     /* mData.capabilities is const, no need to lock */
    254 
    255     *aBool = mData.capabilities & VD_CAP_CONFIG;
     168STDMETHODIMP HardDiskFormat::COMGETTER(Capabilities)(ULONG *aCaps)
     169{
     170    if (!aCaps)
     171        return E_POINTER;
     172
     173    AutoCaller autoCaller (this);
     174    CheckComRCReturnRC (autoCaller.rc());
     175
     176    /* this is const, no need to lock */
     177    *aCaps = mData.capabilities;
     178
     179    return S_OK;
     180}
     181
     182STDMETHODIMP HardDiskFormat::
     183COMGETTER(ConfigNames)(ComSafeArrayOut (BSTR, aConfigNames))
     184{
     185    if (ComSafeArrayOutIsNull (aConfigNames))
     186        return E_POINTER;
     187
     188    AutoCaller autoCaller (this);
     189    CheckComRCReturnRC (autoCaller.rc());
     190
     191    /* this is const, no need to lock */
     192    com::SafeArray <BSTR> configNames (mData.configNames.size());
     193    int i = 0;
     194    for (BstrList::const_iterator it = mData.configNames.begin();
     195        it != mData.configNames.end(); ++ it, ++ i)
     196        (*it).cloneTo (&configNames [i]);
     197    configNames.detachTo (ComSafeArrayOutArg (aConfigNames));
    256198
    257199    return S_OK;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r13588 r13673  
    72007200  -->
    72017201
     7202  <enum
     7203    name="HardDiskFormatCaps"
     7204    uuid="80aa4ab9-8abe-42f0-a270-225b8f9882fb"
     7205  >
     7206    <desc>
     7207       Harddisk format capability flags.
     7208    </desc>
     7209
     7210    <const name="CapilityUuid" value="0x00">
     7211      <desc>
     7212        Supports UUIDs as expected by VirtualBox code.
     7213      </desc>
     7214    </const>
     7215
     7216    <const name="CapilityCreateFixed" value="0x01">
     7217      <desc>
     7218        Supports creating fixed size images, allocating all space instantly.
     7219      </desc>
     7220    </const>
     7221
     7222    <const name="CapilityCreateDynamic" value="0x02">
     7223      <desc>
     7224        Supports creating dynamically growing images, allocating space on
     7225        demand.
     7226      </desc>
     7227    </const>
     7228
     7229    <const name="CapilityCreateSplit2G" value="0x04">
     7230      <desc>
     7231        Supports creating images split in chunks of a bit less than 2GBytes.
     7232      </desc>
     7233    </const>
     7234
     7235    <const name="CapilityDiff" value="0x08">
     7236      <desc>
     7237        Supports being used as differencing image format backend.
     7238      </desc>
     7239    </const>
     7240
     7241    <const name="CapilityASync" value="0x10">
     7242      <desc>
     7243        Supports asynchronous I/O operations for at least some configurations.
     7244      </desc>
     7245    </const>
     7246
     7247    <const name="CapilityFile" value="0x20">
     7248      <desc>
     7249        The backend operates on files. The caller needs to know to handle the
     7250        location appropriately. For a list of supported file extentions see
     7251        <link to="IHardDiskFormat::fileExtensions"/>.
     7252      </desc>
     7253    </const>
     7254
     7255    <const name="CapilityConfig" value="0x40">
     7256      <desc>
     7257        The backend uses the config interface. The caller needs to know how to
     7258        provide the mandatory configuration parts this way.
     7259
     7260        <see>IHardDiskFormat::configNames</see>
     7261      </desc>
     7262    </const>
     7263
     7264    <const name="CapilityMask" value="0x7F"/>
     7265  </enum>
     7266
    72027267  <interface
    72037268     name="IHardDiskFormat" extends="$unknown"
    7204      uuid="e4d3c3af-bcff-4b6a-a50f-854298864cb4"
     7269     uuid="3753099d-9c92-494f-ae2d-bd6faa857d95"
    72057270     wsmap="managed"
    72067271     >
     
    72337298    </attribute>
    72347299
    7235     <attribute name="supportUuid" type="boolean" readonly="yes">
    7236       <desc>
    7237         Supports UUIDs as expected by VirtualBox code.
    7238       </desc>
    7239     </attribute>
    7240 
    7241     <attribute name="supportCreateFixed" type="boolean" readonly="yes">
    7242       <desc>
    7243         Supports creating fixed size images, allocating all space instantly.
    7244       </desc>
    7245     </attribute>
    7246 
    7247     <attribute name="supportCreateDynamic" type="boolean" readonly="yes">
    7248       <desc>
    7249         Supports creating dynamically growing images, allocating space on
    7250         demand.
    7251       </desc>
    7252     </attribute>
    7253 
    7254     <attribute name="supportCreateSplit2G" type="boolean" readonly="yes">
    7255       <desc>
    7256         Supports creating images split in chunks of a bit less than 2GBytes.
    7257       </desc>
    7258     </attribute>
    7259 
    7260     <attribute name="supportDiff" type="boolean" readonly="yes">
    7261       <desc>
    7262         Supports being used as differencing image format backend.
    7263       </desc>
    7264     </attribute>
    7265 
    7266     <attribute name="supportASync" type="boolean" readonly="yes">
    7267       <desc>
    7268         Supports asynchronous I/O operations for at least some configurations.
    7269       </desc>
    7270     </attribute>
    7271 
    7272     <attribute name="supportFile" type="boolean" readonly="yes">
    7273       <desc>
    7274         The backend operates on files. The caller needs to know to handle the
    7275         location appropriately. For a list of supported file extentions see
    7276         <link to="IHardDiskFormat::fileExtensions"/>.
    7277       </desc>
    7278     </attribute>
    7279 
    7280     <attribute name="supportConfig" type="boolean" readonly="yes">
    7281       <desc>
    7282         The backend uses the config interface. The caller needs to know how to
    7283         provide the mandatory configuration parts this way.
     7300    <attribute name="name" type="wstring" readonly="yes">
     7301      <desc>
     7302        Human readable description of this format.
     7303
     7304        Mainly for use in file open dialogs.
    72847305      </desc>
    72857306    </attribute>
     
    72977318
    72987319        <see>IHardDiskFormat::supportFile</see>
     7320      </desc>
     7321    </attribute>
     7322
     7323    <attribute name="capabilities" type="unsigned long" readonly="yes">
     7324      <desc>
     7325        The backend uses the config interface. The caller needs to know how to
     7326        provide the mandatory configuration parts this way. For the meaning of
     7327        the different capabilities see <link to="HardDiskFormatCaps"/>.
     7328      </desc>
     7329    </attribute>
     7330
     7331    <attribute name="configNames" type="wstring" safearray="yes" readonly="yes">
     7332      <desc>
     7333        Array of strings containing the supported configuration keys.
    72997334      </desc>
    73007335    </attribute>
  • trunk/src/VBox/Main/include/HardDiskFormatImpl.h

    r13580 r13673  
    1 /* $Id $ */
     1/* $Id$ */
    22
    33/** @file
     
    4343    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HardDiskFormat)
    4444
    45     DECLARE_NOT_AGGREGATABLE(HardDiskFormat)
     45    DECLARE_NOT_AGGREGATABLE (HardDiskFormat)
    4646
    4747    DECLARE_PROTECT_FINAL_CONSTRUCT()
    4848
    4949    BEGIN_COM_MAP(HardDiskFormat)
    50         COM_INTERFACE_ENTRY(ISupportErrorInfo)
    51         COM_INTERFACE_ENTRY(IHardDiskFormat)
     50        COM_INTERFACE_ENTRY (ISupportErrorInfo)
     51        COM_INTERFACE_ENTRY (IHardDiskFormat)
    5252    END_COM_MAP()
    5353
     
    6060
    6161    // public initializer/uninitializer for internal purposes only
    62     HRESULT init (VDBACKENDINFO *aVDInfo);
     62    HRESULT init (const VDBACKENDINFO *aVDInfo);
    6363    void uninit();
    6464
    6565    // IHardDiskFormat properties
    6666    STDMETHOD(COMGETTER(Id)) (BSTR *aId);
     67    STDMETHOD(COMGETTER(Name)) (BSTR *aName);
     68    STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
    6769
    68     STDMETHOD(COMGETTER(SupportUuid) (BOOL *aBool));
    69     STDMETHOD(COMGETTER(SupportCreateFixed) (BOOL *aBool));
    70     STDMETHOD(COMGETTER(SupportCreateDynamic) (BOOL *aBool));
    71     STDMETHOD(COMGETTER(SupportCreateSplit2G) (BOOL *aBool));
    72     STDMETHOD(COMGETTER(SupportDiff) (BOOL *aBool));
    73     STDMETHOD(COMGETTER(SupportASync) (BOOL *aBool));
    74     STDMETHOD(COMGETTER(SupportFile) (BOOL *aBool));
    75     STDMETHOD(COMGETTER(SupportConfig) (BOOL *aBool));
    76 
    77     STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
     70    STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
     71    STDMETHOD(COMGETTER(ConfigNames)) (ComSafeArrayOut (BSTR, aConfigNames));
    7872
    7973    // public methods only for internal purposes
     
    9488
    9589        const Bstr id;
     90        const Bstr name;
     91        const BstrList fileExtensions;
    9692        const uint64_t capabilities;
    97         const BstrList fileExtensions;
     93        const BstrList configNames;
    9894    };
    9995
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