VirtualBox

Changeset 22305 in vbox for trunk/include


Ignore:
Timestamp:
Aug 17, 2009 5:37:41 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
51179
Message:

Main: generic callback wrappers mechanism

Location:
trunk/include/VBox/com
Files:
3 edited

Legend:

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

    r8155 r22305  
    5555// for convenience
    5656#include "VBox/com/defs.h"
     57#include "VBox/com/ptr.h"
    5758
     59template <class I>
     60inline HRESULT createCallbackWrapper(I* aInstance,
     61                                     I** paWrapper)
     62{
     63    ComPtr<ILocalOwner> ptr;
     64
     65    HRESULT rc = ptr.createInprocObject(CLSID_VirtualBoxCallback);
     66    if (FAILED(rc))
     67        return rc;
     68
     69    rc = ptr->SetLocalObject(aInstance);
     70    if (FAILED(rc))
     71        return rc;
     72
     73    ComPtr<I> ptr2 = ptr;
     74    if (ptr2.isNull())
     75        return E_FAIL;
     76
     77    rc = ptr2.queryInterfaceTo(paWrapper);
     78    return rc;
     79}
    5880#endif
  • trunk/include/VBox/com/defs.h

    r21521 r22305  
    608608#define VBOX_SCRIPTABLE_IMPL(iface)                     \
    609609    public iface
    610 #define VBOX_SCRIPTABLE_DISPATCH_IMPL(iface)               
     610#define VBOX_SCRIPTABLE_DISPATCH_IMPL(iface)
    611611#endif
    612612
  • trunk/include/VBox/com/ptr.h

    r17911 r22305  
    541541    }
    542542};
    543 
    544543#endif
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