1
0

JSAPI_ObjectArray.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <ocidl.h>
  3. #include <dispex.h>
  4. #include <vector>
  5. /* simulates an Array in javascript */
  6. namespace JSAPI
  7. {
  8. class ObjectArray : /*public IDispatch,*/
  9. public IDispatchEx
  10. {
  11. public:
  12. ObjectArray();
  13. ~ObjectArray();
  14. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  15. STDMETHOD_(ULONG, AddRef)(void);
  16. STDMETHOD_(ULONG, Release)(void);
  17. void AddObject(IDispatch *obj);
  18. private:
  19. // *** IDispatch Methods ***
  20. STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  21. STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  22. STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
  23. STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  24. // *** IDispatchEx Methods ***
  25. STDMETHOD (GetDispID)(BSTR bstrName, DWORD grfdex, DISPID *pid);
  26. STDMETHOD (InvokeEx)(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller);
  27. STDMETHOD (DeleteMemberByName)(BSTR bstrName, DWORD grfdex) ;
  28. STDMETHOD (DeleteMemberByDispID)(DISPID id);
  29. STDMETHOD (GetMemberProperties)(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex);
  30. STDMETHOD (GetMemberName)(DISPID id, BSTR *pbstrName);
  31. STDMETHOD (GetNextDispID)(DWORD grfdex, DISPID id, DISPID *pid);
  32. STDMETHOD (GetNameSpaceParent)(IUnknown **ppunk);
  33. private:
  34. typedef std::vector<IDispatch*> Objects;
  35. Objects objects;
  36. volatile LONG refCount;
  37. };
  38. }