GME
13
|
00001 00002 #ifndef INTERFACECOLL_INCLUDED 00003 #define INTERFACECOLL_INCLUDED 00004 00005 // included as C++ 00006 cpp_quote("#ifndef INTERFACECOLL_INCLUDED") 00007 cpp_quote("#define INTERFACECOLL_INCLUDED") 00008 cpp_quote("extern \"C++\" ") 00009 cpp_quote("{ ") 00010 cpp_quote(" template<class COLL> struct TypeName_MgaColl2Elem ") 00011 cpp_quote(" { ") 00012 cpp_quote(" typedef IUnknown element_type; ") 00013 cpp_quote(" typedef IUnknown collection_type; ") 00014 cpp_quote(" }; ") 00015 cpp_quote(" template<class ELEM> struct TypeName_MgaElem2Coll ") 00016 cpp_quote(" { ") 00017 cpp_quote(" typedef IUnknown element_type; ") 00018 cpp_quote(" typedef IUnknown collection_type; ") 00019 cpp_quote(" }; ") 00020 cpp_quote("} ") 00021 00022 cpp_quote("#define TYPENAME_COLL2ELEM(COLL) typename ::TypeName_MgaColl2Elem<COLL>::element_type") 00023 cpp_quote("#define TYPENAME_ELEM2COLL(ELEM) typename ::TypeName_MgaElem2Coll<ELEM>::collection_type") 00024 00025 #define MAKESTRING(ARG) #ARG 00026 00027 #define MGACOLL_INTERFACE2(IID, COLL, ELEM) \ 00028 [ \ 00029 object, \ 00030 uuid(IID), \ 00031 dual, \ 00032 helpstring(MAKESTRING(COLL Interface)), \ 00033 pointer_default(unique) \ 00034 ] \ 00035 interface COLL : IDispatch \ 00036 { \ 00037 [propget, helpstring("property Count")] \ 00038 HRESULT Count([out, retval] long *p); \ 00039 \ 00040 [propget, id(DISPID_VALUE), helpstring("property Item")] \ 00041 HRESULT Item([in] long n, [out, retval] ELEM **p); \ 00042 \ 00043 [propget, id(DISPID_NEWENUM), helpstring("property NewEnum")] \ 00044 HRESULT _NewEnum([out, retval] IUnknown **p); \ 00045 \ 00046 [helpstring("method GetAll")] \ 00047 HRESULT GetAll([in] long count, [out, size_is(count)] ELEM **p); \ 00048 \ 00049 [helpstring("method Insert, index starts with 1, element may already be contained")] \ 00050 HRESULT Insert([in] ELEM *p, [in] long at); \ 00051 \ 00052 [helpstring("method Append, add to the end, may already be contained")] \ 00053 HRESULT Append([in] ELEM *p); \ 00054 \ 00055 [helpstring("method Find, returns 0 if none found after pos start")] \ 00056 HRESULT Find([in] ELEM *p, [in] long start, [out, retval] long *res); \ 00057 \ 00058 [helpstring("method Remove, index starts with 1")] \ 00059 HRESULT Remove([in] long n); \ 00060 }; \ 00061 cpp_quote("#ifdef __cplusplus") \ 00062 cpp_quote("extern \"C++\" ") \ 00063 cpp_quote("{ ") \ 00064 cpp_quote(MAKESTRING(template<> struct ::TypeName_MgaColl2Elem<COLL>)) \ 00065 cpp_quote(MAKESTRING({ typedef COLL collection_type; typedef ELEM element_type; };)) \ 00066 cpp_quote(MAKESTRING(template<> struct ::TypeName_MgaElem2Coll<ELEM>)) \ 00067 cpp_quote(MAKESTRING({ typedef COLL collection_type; typedef ELEM element_type; };)) \ 00068 cpp_quote("} ") \ 00069 cpp_quote("#endif") 00070 00071 00072 00073 #define MGACOLL_COCLASS2(CLASSID, COCLASS, COLL) \ 00074 [ \ 00075 uuid(CLASSID), \ 00076 helpstring(MAKESTRING(COCLASS Class)), \ 00077 noncreatable \ 00078 ] \ 00079 coclass COCLASS \ 00080 { \ 00081 [default] interface COLL; \ 00082 interface ISupportErrorInfo; \ 00083 }; 00084 00085 #define MGACOLL_INTERFACE(IID, NAME) \ 00086 MGACOLL_INTERFACE2(IID, I##NAME##s, I##NAME) 00087 00088 #define MGACOLL_COCLASS(CLASSID, NAME) \ 00089 MGACOLL_COCLASS2(CLASSID, NAME##s, I##NAME##s) 00090 00091 00092 cpp_quote("#endif") 00093 00094 #endif//INTERFACECOLL_INCLUDED