VirtualBox

Changeset 37553 in vbox


Ignore:
Timestamp:
Jun 20, 2011 12:48:28 PM (14 years ago)
Author:
vboxsync
Message:

com: method for SafeArray -> RTCList

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/array.h

    r36186 r37553  
    168168#include "VBox/com/ptr.h"
    169169#include "VBox/com/assert.h"
     170#include "iprt/cpp/list.h"
    170171
    171172#ifdef VBOX_WITH_XPCOM
     
    10081009        return *this;
    10091010    }
     1011
     1012    /**
     1013     * Returns a copy of this SafeArray as RTCList<T>.
     1014     */
     1015        RTCList<T> toList()
     1016        {
     1017                RTCList<T> list(size());
     1018                for (size_t i = 0; i < size(); ++i)
     1019#ifdef VBOX_WITH_XPCOM
     1020                        list.append(m.arr[i]);
     1021#else
     1022                        list.append(m.raw[i]);
     1023#endif
     1024                return list;
     1025        }
    10101026
    10111027    inline void initFrom(const com::SafeArray<T> & aRef);
  • trunk/include/VBox/com/list.h

    r37547 r37553  
    196196};
    197197
    198 //template <typename T> RTCList<T> SafeArrayToRTCList(ComSafeArrayIn(T, other), T* = 0)
    199 //{
    200 //    com::SafeArray<T> sfaOther(ComSafeArrayInArg(other));
    201 //    RTCList<T> list(sfaOther.size());
    202 //    for (size_t i = 0; i < sfaOther.size(); ++i)
    203 //        list.append(sfaOther[i]);
    204 //    return list;
    205 //}
    206 
    207198#endif /* !___VBox_com_list_h */
    208199
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r37547 r37553  
    60836083    /* Convert the options. */
    60846084    RTCList<CloneOptions_T> optList;
    6085     if (options != NULL)
    6086     {
    6087          com::SafeArray<CloneOptions_T> sfaOpts(ComSafeArrayInArg(options));
    6088          for (size_t i = 0; i < sfaOpts.size(); ++i)
    6089              optList.append(sfaOpts[i]);
    6090 //        optList = SafeArrayToRTCList<CloneOptions_T>(ComSafeArrayInArg(options));
    6091     }
     6085        if (options != NULL)
     6086                optList = com::SafeArray<CloneOptions_T>(ComSafeArrayInArg(options)).toList();
     6087               
    60926088    AssertReturn(!optList.contains(CloneOptions_Link), E_NOTIMPL);
    60936089    AssertReturn(!(optList.contains(CloneOptions_KeepAllMACs) && optList.contains(CloneOptions_KeepNATMACs)), E_FAIL);
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