Back to index

lightning-sunbird  0.9+nobinonly
nsXPCDispSimple.h
Go to the documentation of this file.
00001 // nsXPCDispSimple.h: Definition of the nsXPCDispSimple class
00002 //
00004 
00005 #if !defined(AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_)
00006 #define AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #include "resource.h"       // main symbols
00013 
00015 // nsXPCDispSimple
00016 
00017 class nsXPCDispSimple : 
00018     public ISupportErrorInfo,
00019     public CComObjectRoot,
00020     public CComCoClass<nsXPCDispSimple,&CLSID_nsXPCDispSimple>,
00021     public IDispatchImpl<nsIXPCDispSimple, &IID_nsIXPCDispSimple, &LIBID_IDispatchTestLib>
00022 {
00023 public:
00024     nsXPCDispSimple() : mNumber(5) {}
00025 BEGIN_CATEGORY_MAP(nsXPCDispSimple)
00026     IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
00027 END_CATEGORY_MAP()
00028 BEGIN_COM_MAP(nsXPCDispSimple)
00029     COM_INTERFACE_ENTRY(IDispatch)
00030     COM_INTERFACE_ENTRY(ISupportErrorInfo)
00031     COM_INTERFACE_ENTRY(nsIXPCDispSimple)
00032 END_COM_MAP()
00033 DECLARE_NOT_AGGREGATABLE(nsXPCDispSimple) 
00034 
00035 DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispSimple)
00036 // ISupportsErrorInfo
00037     STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
00038 
00039 // nsIXPCDispSimple
00040 public:
00041 // nsIXPCDispSimple
00042     STDMETHOD(ClassName)(BSTR * name);
00043     STDMETHOD(get_Number)(LONG * result);
00044     STDMETHOD(put_Number)(LONG result);
00045     template <class T>
00046     static HRESULT CreateInstance(T ** result)
00047     {
00048         return CoCreateInstance(CLSID_nsXPCDispSimple, 0, CLSCTX_ALL,
00049                                 __uuidof(T),
00050                                 reinterpret_cast<void**>(result));
00051     }
00052 private:
00053     long mNumber;
00054 };
00055 
00056 #endif // !defined(AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_)