[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 | #ifndef __DBDAO_H_
|
---|
| 7 | #define __DBDAO_H_
|
---|
| 8 |
|
---|
| 9 | #ifndef __cplusplus
|
---|
| 10 | #error This file can be used only in C++
|
---|
| 11 | #else
|
---|
| 12 |
|
---|
| 13 | class COleVariant;
|
---|
| 14 | class CdbBookmark;
|
---|
| 15 | class CdbException;
|
---|
| 16 | class CdbOleObject;
|
---|
| 17 | class CdbObject;
|
---|
| 18 | class CdbError;
|
---|
| 19 | class CdbProperty;
|
---|
| 20 | class CdbDBEngine;
|
---|
| 21 | class CdbWorkspace;
|
---|
| 22 | class CdbDatabase;
|
---|
| 23 | class CdbConnection;
|
---|
| 24 | class CdbRecordset;
|
---|
| 25 | class CdbGetRowsEx;
|
---|
| 26 | class CdbQueryDef;
|
---|
| 27 | class CdbTableDef;
|
---|
| 28 | class CdbField;
|
---|
| 29 | class CdbRelation;
|
---|
| 30 | class CdbIndex;
|
---|
| 31 | class CdbUser;
|
---|
| 32 | class CdbGroup;
|
---|
| 33 | class CdbDocument;
|
---|
| 34 | class CdbContainer;
|
---|
| 35 | class CdbParameter;
|
---|
| 36 | class CdbCollection;
|
---|
| 37 | class CdbErrors;
|
---|
| 38 | class CdbProperties;
|
---|
| 39 | class CdbWorkspaces;
|
---|
| 40 | class CdbDatabases;
|
---|
| 41 | class CdbConnections;
|
---|
| 42 | class CdbRecordsets;
|
---|
| 43 | class CdbQueryDefs;
|
---|
| 44 | class CdbTableDefs;
|
---|
| 45 | class CdbFields;
|
---|
| 46 | class CdbRelations;
|
---|
| 47 | class CdbIndexes;
|
---|
| 48 | class CdbUsers;
|
---|
| 49 | class CdbGroups;
|
---|
| 50 | class CdbDocuments;
|
---|
| 51 | class CdbContainers;
|
---|
| 52 | class CdbParameters;
|
---|
| 53 | class CdbBStr;
|
---|
| 54 |
|
---|
| 55 | const char szKEY[] = "mbmabptebkjcdlgtjmskjwtsdhjbmkmwtrak";
|
---|
| 56 |
|
---|
| 57 | #define DAO_MAXSEEKFIELDS 13
|
---|
| 58 |
|
---|
| 59 | class DLLEXPORT CdbBSTR {
|
---|
| 60 | public:
|
---|
| 61 | CONSTRUCTOR CdbBSTR(BSTR=NULL);
|
---|
| 62 | DESTRUCTOR ~CdbBSTR(VOID);
|
---|
| 63 | operator BSTR *(VOID);
|
---|
| 64 | operator LPCTSTR(VOID);
|
---|
| 65 | private:
|
---|
| 66 | BSTR m_bstr;
|
---|
| 67 | };
|
---|
| 68 |
|
---|
| 69 | class CdbVariant : public COleVariant {
|
---|
| 70 | public:
|
---|
| 71 | CONSTRUCTOR CdbVariant(LONG l);
|
---|
| 72 | CONSTRUCTOR CdbVariant(VOID);
|
---|
| 73 | CONSTRUCTOR CdbVariant(LPCTSTR pstr);
|
---|
| 74 | CONSTRUCTOR CdbVariant(SHORT s,WINBOOL bIsBool = FALSE);
|
---|
| 75 | CONSTRUCTOR CdbVariant(LPVARIANT pv);
|
---|
| 76 | CONSTRUCTOR CdbVariant(LPSAFEARRAY psa);
|
---|
| 77 | VOID operator =(LPVARIANT pv);
|
---|
| 78 | VOID operator =(LPCTSTR pstr);
|
---|
| 79 | VOID operator =(SHORT s);
|
---|
| 80 | VOID operator =(const int i);
|
---|
| 81 | VOID operator =(LONG l);
|
---|
| 82 | };
|
---|
| 83 |
|
---|
| 84 | inline CONSTRUCTOR CdbVariant::CdbVariant(VOID) : COleVariant() {
|
---|
| 85 | vt = VT_ERROR;
|
---|
| 86 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | inline CdbVariant::CdbVariant(LONG l) {
|
---|
| 90 | if(l==-1) {
|
---|
| 91 | vt = VT_ERROR;
|
---|
| 92 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 93 | } else {
|
---|
| 94 | vt = VT_I4;
|
---|
| 95 | lVal = l;
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | inline CONSTRUCTOR CdbVariant::CdbVariant(LPCTSTR pstr): COleVariant(pstr,VT_BSTRT) {
|
---|
| 100 | if(!pstr) {
|
---|
| 101 | VariantClear(this);
|
---|
| 102 | vt = VT_ERROR;
|
---|
| 103 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | inline CONSTRUCTOR CdbVariant::CdbVariant(SHORT s,WINBOOL bIsBool) : COleVariant(s) {
|
---|
| 108 | if(bIsBool) {
|
---|
| 109 | vt = VT_BOOL;
|
---|
| 110 | boolVal = s;
|
---|
| 111 | } else if(s==-1) {
|
---|
| 112 | vt = VT_ERROR;
|
---|
| 113 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | inline CONSTRUCTOR CdbVariant::CdbVariant(LPVARIANT pv) {
|
---|
| 118 | if(!pv) {
|
---|
| 119 | vt = VT_ERROR;
|
---|
| 120 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 121 | } else
|
---|
| 122 | VariantCopy(this,pv);
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | inline CONSTRUCTOR CdbVariant::CdbVariant(LPSAFEARRAY psa) {
|
---|
| 126 | if(!psa) {
|
---|
| 127 | vt = VT_ERROR;
|
---|
| 128 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 129 | } else {
|
---|
| 130 | vt = VT_ARRAY|VT_UI1;
|
---|
| 131 | parray = psa;
|
---|
| 132 | }
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | inline VOID CdbVariant::operator =(LPVARIANT pv) {
|
---|
| 136 | if(!pv) {
|
---|
| 137 | vt = VT_ERROR;
|
---|
| 138 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 139 | } else
|
---|
| 140 | VariantCopy(this,pv);
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | inline VOID CdbVariant::operator =(LPCTSTR pstr) {
|
---|
| 144 | if(!pstr) {
|
---|
| 145 | VariantClear(this);
|
---|
| 146 | vt = VT_ERROR;
|
---|
| 147 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 148 | } else {
|
---|
| 149 | #if defined(UNICODE)
|
---|
| 150 | bstrVal = SysAllocString(pstr);
|
---|
| 151 | #else
|
---|
| 152 | bstrVal = SysAllocStringByteLen(pstr,strlen(pstr));
|
---|
| 153 | #endif
|
---|
| 154 | vt = VT_BSTR;
|
---|
| 155 | }
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | inline VOID CdbVariant::operator =(SHORT s) {
|
---|
| 159 | if(s==-1) {
|
---|
| 160 | vt = VT_ERROR;
|
---|
| 161 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 162 | } else {
|
---|
| 163 | vt = VT_I2;
|
---|
| 164 | iVal = s;
|
---|
| 165 | }
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | inline VOID CdbVariant::operator =(const int i) {
|
---|
| 169 | if(i==-1) {
|
---|
| 170 | vt = VT_ERROR;
|
---|
| 171 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 172 | } else {
|
---|
| 173 | vt = VT_I2;
|
---|
| 174 | iVal =(SHORT)i;
|
---|
| 175 | }
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | inline VOID CdbVariant::operator =(LONG l) {
|
---|
| 179 | if(l==-1) {
|
---|
| 180 | vt = VT_ERROR;
|
---|
| 181 | scode = DISP_E_PARAMNOTFOUND;
|
---|
| 182 | } else {
|
---|
| 183 | vt = VT_I4;
|
---|
| 184 | lVal = l;
|
---|
| 185 | }
|
---|
| 186 | }
|
---|
| 187 |
|
---|
| 188 | HRESULT CdbWideFromAnsi(LPSTR,unsigned int,BSTR *);
|
---|
| 189 |
|
---|
| 190 | class CdbWide {
|
---|
| 191 | public:
|
---|
| 192 | CONSTRUCTOR CdbWide(LPSTR pstr,unsigned int cb=0) {
|
---|
| 193 | CdbWideFromAnsi(pstr,(pstr ? (cb==0 ? strlen(pstr) : cb) : 0),&m_bstr);
|
---|
| 194 | }
|
---|
| 195 | DESTRUCTOR ~CdbWide() {
|
---|
| 196 | SysFreeString(m_bstr);
|
---|
| 197 | }
|
---|
| 198 | operator LPWSTR() { return (LPWSTR)m_bstr; }
|
---|
| 199 | operator LPSTR() { return (LPSTR)m_bstr; }
|
---|
| 200 | ULONG cBytes() { return SysStringByteLen(m_bstr); }
|
---|
| 201 | private:
|
---|
| 202 | BSTR m_bstr;
|
---|
| 203 | };
|
---|
| 204 |
|
---|
| 205 | class DLLEXPORT CdbOleObject : public CObject {
|
---|
| 206 | public:
|
---|
| 207 | CONSTRUCTOR CdbOleObject(VOID);
|
---|
| 208 | virtual DESTRUCTOR ~CdbOleObject(VOID);
|
---|
| 209 | WINBOOL Exists(VOID);
|
---|
| 210 | CdbOleObject &operator = (CdbOleObject &o);
|
---|
| 211 | operator LPUNKNOWN(){ return GetInterface();}
|
---|
| 212 | VOID SetInterface(LPUNKNOWN punk,WINBOOL bAddRef=FALSE);
|
---|
| 213 | VOID SetInterface(REFIID riidClass,REFIID riidInterface);
|
---|
| 214 | VOID SetInterfaceLic(REFIID riidClass,REFIID riidInterface);
|
---|
| 215 | LPUNKNOWN GetInterface(WINBOOL bAddRef=FALSE,WINBOOL bThrowException=TRUE) const;
|
---|
| 216 | virtual VOID OnInterfaceChange(VOID);
|
---|
| 217 | VOID SetRichErrorInfo(LPOLESTR pstrSource,LPOLESTR pstrDescription,LPOLESTR pstrHelpFile,ULONG ulHelpID) const;
|
---|
| 218 | protected:
|
---|
| 219 | WINBOOL StartOLE(VOID);
|
---|
| 220 | LPUNKNOWN m_punkInterface;
|
---|
| 221 | };
|
---|
| 222 |
|
---|
| 223 | class DLLEXPORT CdbCollection : public CdbOleObject {
|
---|
| 224 | public:
|
---|
| 225 | virtual CdbObject ObItem(LONG i) = 0;
|
---|
| 226 | virtual CdbObject ObItem(LPCTSTR pstr) = 0;
|
---|
| 227 | virtual LONG GetCount(VOID) = 0;
|
---|
| 228 | virtual VOID ObAppend(CdbObject &obj) = 0;
|
---|
| 229 | virtual VOID Delete(LPCTSTR pstr) = 0;
|
---|
| 230 | virtual VOID Refresh(VOID) = 0;
|
---|
| 231 | };
|
---|
| 232 |
|
---|
| 233 | class DLLEXPORT CdbStaticCollection : public CdbCollection {
|
---|
| 234 | public:
|
---|
| 235 | CdbObject ObItem(LONG i);
|
---|
| 236 | CdbObject ObItem(LPCTSTR pstr);
|
---|
| 237 | LONG GetCount(VOID);
|
---|
| 238 | VOID ObAppend(CdbObject &obj);
|
---|
| 239 | VOID Delete(LPCTSTR pstr);
|
---|
| 240 | VOID Refresh(VOID);
|
---|
| 241 | };
|
---|
| 242 |
|
---|
| 243 | class DLLEXPORT CdbDynamicCollection : public CdbCollection {
|
---|
| 244 | public:
|
---|
| 245 | CdbObject ObItem(LONG i);
|
---|
| 246 | CdbObject ObItem(LPCTSTR pstr);
|
---|
| 247 | LONG GetCount(VOID);
|
---|
| 248 | VOID ObAppend(CdbObject &obj);
|
---|
| 249 | VOID Delete(LPCTSTR pstr);
|
---|
| 250 | VOID Refresh(VOID);
|
---|
| 251 | };
|
---|
| 252 |
|
---|
| 253 | #define DAOMFC_STATIC_COLLECTION_DECL(objColl,objSingle,intSingle) class DLLEXPORT objColl : public CdbStaticCollection { public: objSingle Item(LONG i); objSingle Item(LPCTSTR pstr); objSingle operator[](LONG i); objSingle operator[](LPCTSTR pstr); }
|
---|
| 254 | #define DAOMFC_DYNAMIC_COLLECTION_DECL(objColl,objSingle,intSingle) class DLLEXPORT objColl : public CdbDynamicCollection { public: objSingle Item(LONG i); objSingle Item(LPCTSTR pstr); VOID Append(objSingle &o); objSingle operator[](LONG i); objSingle operator[](LPCTSTR pstr); }
|
---|
| 255 |
|
---|
| 256 | DAOMFC_STATIC_COLLECTION_DECL(CdbErrors,CdbError,DAOError);
|
---|
| 257 | DAOMFC_STATIC_COLLECTION_DECL(CdbDatabases,CdbDatabase,DAODatabase);
|
---|
| 258 | DAOMFC_STATIC_COLLECTION_DECL(CdbRecordsets,CdbRecordset,DAORecordset);
|
---|
| 259 | DAOMFC_STATIC_COLLECTION_DECL(CdbParameters,CdbParameter,DAOParameter);
|
---|
| 260 | DAOMFC_STATIC_COLLECTION_DECL(CdbDocuments,CdbDocument,DAODocument);
|
---|
| 261 | DAOMFC_STATIC_COLLECTION_DECL(CdbContainers,CdbContainer,DAOContainer);
|
---|
| 262 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbProperties,CdbProperty,DAOProperty);
|
---|
| 263 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbFields,CdbField,DAOField);
|
---|
| 264 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbQueryDefs,CdbQueryDef,DAOQueryDef);
|
---|
| 265 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbTableDefs,CdbTableDef,DAOTableDef);
|
---|
| 266 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbIndexes,CdbIndex,DAOIndex);
|
---|
| 267 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbRelations,CdbRelation,DAORelation);
|
---|
| 268 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbUsers,CdbUser,DAOUser);
|
---|
| 269 | DAOMFC_DYNAMIC_COLLECTION_DECL(CdbGroups,CdbGroup,DAOGroup);
|
---|
| 270 |
|
---|
| 271 | class DLLEXPORT CdbWorkspaces : public CdbDynamicCollection {
|
---|
| 272 | friend CdbDBEngine;
|
---|
| 273 | private:
|
---|
| 274 | DAODBEngine *pDBEng;
|
---|
| 275 | WINBOOL m_bDontStart;
|
---|
| 276 | public:
|
---|
| 277 | CONSTRUCTOR CdbWorkspaces(VOID){pDBEng = NULL;}
|
---|
| 278 | CdbWorkspace Item(LONG i);
|
---|
| 279 | CdbWorkspace Item(LPCTSTR pstr);
|
---|
| 280 | VOID Append(CdbWorkspace &o);
|
---|
| 281 | CdbWorkspace operator[](LONG i);
|
---|
| 282 | CdbWorkspace operator[](LPCTSTR pstr);
|
---|
| 283 | VOID SetDBEngine(DAODBEngine *peng){pDBEng = peng;}
|
---|
| 284 | VOID GetDelayedInterface();
|
---|
| 285 | };
|
---|
| 286 |
|
---|
| 287 | class DLLEXPORT CdbConnections : public CdbStaticCollection {
|
---|
| 288 | public:
|
---|
| 289 | CONSTRUCTOR CdbConnections(CdbConnections &Connections);
|
---|
| 290 | CONSTRUCTOR CdbConnections() { pwrk = NULL; }
|
---|
| 291 | CdbConnection Item(LONG i);
|
---|
| 292 | CdbConnection Item(LPCTSTR pstr);
|
---|
| 293 | CdbConnection operator[](LONG i);
|
---|
| 294 | CdbConnection operator[](LPCTSTR pstr);
|
---|
| 295 | CdbConnections &operator = (CdbConnections &o);
|
---|
| 296 | LONG GetCount(VOID);
|
---|
| 297 | VOID Refresh(VOID);
|
---|
| 298 | VOID SetWorkspace(DAOWorkspace *pParent) { pwrk = pParent; }
|
---|
| 299 | private:
|
---|
| 300 | VOID CheckInterface();
|
---|
| 301 | DAOWorkspace *pwrk;
|
---|
| 302 | };
|
---|
| 303 |
|
---|
| 304 | class DLLEXPORT CdbObject : public CdbOleObject {
|
---|
| 305 | public:
|
---|
| 306 | CONSTRUCTOR CdbObject(VOID);
|
---|
| 307 | CONSTRUCTOR CdbObject(LPUNKNOWN punk,WINBOOL bAddRef=FALSE);
|
---|
| 308 | virtual CString GetName(VOID);
|
---|
| 309 | virtual VOID SetName(LPCTSTR pstr);
|
---|
| 310 | CdbProperties Properties;
|
---|
| 311 | };
|
---|
| 312 |
|
---|
| 313 | class DLLEXPORT CdbGetRowsEx : public CdbObject {
|
---|
| 314 | public:
|
---|
| 315 | CONSTRUCTOR CdbGetRowsEx(VOID);
|
---|
| 316 | CONSTRUCTOR CdbGetRowsEx(ICDAORecordset *pGetRows,WINBOOL bAddRef=FALSE);
|
---|
| 317 | CONSTRUCTOR CdbGetRowsEx(const CdbGetRowsEx &);
|
---|
| 318 | CdbGetRowsEx &operator =(const CdbGetRowsEx &);
|
---|
| 319 | VOID OnInterfaceChange(VOID);
|
---|
| 320 | };
|
---|
| 321 |
|
---|
| 322 | #define DAOVINIT(var) do { (var).vt = VT_ERROR; (var).scode = DISP_E_PARAMNOTFOUND; } while (0)
|
---|
| 323 | #define STV(pstr) CdbVariant(pstr)
|
---|
| 324 | #define STB(pstr) V_BSTR(((LPVARIANT)STV(pstr)))
|
---|
| 325 | #define LTV(l) CdbVariant(l)
|
---|
| 326 | #define OLTV(l) CdbVariant((l))
|
---|
| 327 | #define BTB(b) ((VARIANT_BOOL)(b?-1:0))
|
---|
| 328 | #define BTV(b) CdbVariant(BTB(b),TRUE)
|
---|
| 329 | #define SHTV(s) CdbVariant((SHORT)s)
|
---|
| 330 | #define VTV(pv) CdbVariant(pv)
|
---|
| 331 | #define ATV(psa,var) do { if(!psa) { var.vt = VT_ERROR; var.scode = DISP_E_PARAMNOTFOUND; } else { var.vt = VT_ARRAY|VT_UI1; SafeArrayCopy(psa,&var.parray); } } while (0)
|
---|
| 332 | #define DAOMFC_CALL(hr) do { HRESULT hresult = (hr); if(FAILED(hresult)) { TRACE0("\nDBDAO Call Failed.\n\t"); TRACE2("\nIn file %s on line %d\n",_T("DBDAO.CPP"),__LINE__); TRACE1("hResult = %X\n",hresult); if(GetScode(hresult)==E_OUTOFMEMORY) AfxThrowMemoryException(); else throw CdbException(hresult); } } while (0)
|
---|
| 333 | #define LPROPGET(intDAO,meth) do { intDAO *p = (intDAO *)GetInterface(); LONG l = 0; DAOMFC_CALL(p->meth(&l)); return l; } while (0)
|
---|
| 334 | #define LPROPSET(intDAO,meth,l) do { intDAO *p = (intDAO *)GetInterface(); DAOMFC_CALL(p->meth(l)); } while(0)
|
---|
| 335 | #define WPROPGET(intDAO,meth) do { intDAO *p = (intDAO *)GetInterface(); SHORT s = 0; DAOMFC_CALL(p->meth(&s)); return s; } while (0)
|
---|
| 336 | #define WPROPSET(intDAO,meth,s) do { intDAO *p = (intDAO *)GetInterface(); DAOMFC_CALL(p->meth(s)); } while(0)
|
---|
| 337 | #define SPROPGET(intDAO,meth) do { intDAO *p = (intDAO *)GetInterface(); CdbBSTR bstr; DAOMFC_CALL(p->meth(bstr)); return bstr; } while (0)
|
---|
| 338 | #define SPROPSET(intDAO,meth,s) do { intDAO *p = (intDAO *)GetInterface(); DAOMFC_CALL(p->meth(STB(s))); } while(0)
|
---|
| 339 | #define DPROPGET(intDAO,meth) do { intDAO *p = (intDAO *)GetInterface(); VARIANT Var; VariantInit(&Var); DAOMFC_CALL(p->meth(&Var)); return Var; } while (0)
|
---|
| 340 | #define DPROPSET(intDAO,meth,pv) do { intDAO *p = (intDAO *)GetInterface(); DAOMFC_CALL(p->meth(*pv)); } while(0)
|
---|
| 341 | #define BPROPGET(intDAO,meth) do { intDAO *p = (intDAO *)GetInterface(); VARIANT_BOOL vb = 0; DAOMFC_CALL(p->meth(&vb)); return(WINBOOL)vb; } while (0)
|
---|
| 342 | #define BPROPSET(intDAO,meth,b) do { intDAO *p = (intDAO *)GetInterface(); DAOMFC_CALL(p->meth(BTB(b))); } while(0)
|
---|
| 343 | #define VPROPGET(intDAO,meth) do { intDAO *p = (intDAO *)GetInterface(); COleVariant v; VariantInit(&v); DAOMFC_CALL(p->meth(&v)); return &v; } while (0)
|
---|
| 344 | #define VPROPSET(intDAO,meth,pv) do { intDAO *p = (intDAO *)GetInterface(); DAOMFC_CALL(p->meth(*pv)); } while(0)
|
---|
| 345 | #define DWPROPGET(intDAO,meth) do { intDAO *p = (intDAO *)GetInterface(); DWORD dw = 0; DAOMFC_CALL(p->meth(&dw)); return dw; } while (0)
|
---|
| 346 | #define DAOMFC_STATIC_COLLECTION_IMPL(objColl,objSingle,intColl,intSingle) objSingle objColl::Item(LONG i) { return (intSingle *)(ObItem(i).GetInterface(TRUE)); } objSingle objColl::Item(LPCTSTR pstr) { return (intSingle *)(ObItem(pstr).GetInterface(TRUE)); } objSingle objColl::operator[](LONG i) { return (intSingle *)(Item(i).GetInterface(TRUE)); } objSingle objColl::operator[](LPCTSTR pstr) { return (intSingle *)(Item(pstr).GetInterface(TRUE)); }
|
---|
| 347 | #define DAOMFC_DYNAMIC_COLLECTION_IMPL(objColl,objSingle,intColl,intSingle) objSingle objColl::Item(LONG i) { return (intSingle *)(ObItem(i).GetInterface(TRUE)); } objSingle objColl::Item(LPCTSTR pstr) { return (intSingle *)(ObItem(pstr).GetInterface(TRUE)); } VOID objColl::Append(objSingle &o) { ObAppend(o); } objSingle objColl::operator[](LONG i) { return (intSingle *)(Item(i).GetInterface(TRUE)); } objSingle objColl::operator[](LPCTSTR pstr) { return (intSingle *)(Item(pstr).GetInterface(TRUE)); }
|
---|
| 348 |
|
---|
| 349 | #undef INTERFACE
|
---|
| 350 | #define INTERFACE DAOMFCSCollection
|
---|
| 351 | DECLARE_INTERFACE_(DAOMFCSCollection,_DAOCollection) {
|
---|
| 352 | #ifndef __cplusplus
|
---|
| 353 | /* IUnknown methods */
|
---|
| 354 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppvObject) PURE;
|
---|
| 355 | STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
---|
| 356 | STDMETHOD_(ULONG, Release)(THIS) PURE;
|
---|
| 357 | /*** IDispatch methods ***/
|
---|
| 358 | STDMETHOD(GetTypeInfoCount)(THIS_ UINT *pctinfo);
|
---|
| 359 | STDMETHOD(GetTypeInfo)(THIS_ UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
|
---|
| 360 | STDMETHOD(GetIDsOfNames)(THIS_ REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
|
---|
| 361 | STDMETHOD(Invoke)(THIS_ DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
---|
| 362 | /*** _DAOCollection ***/
|
---|
| 363 | STDMETHOD(get_Count) (THIS_ short *c) PURE;
|
---|
| 364 | STDMETHOD(_NewEnum) (THIS_ IUnknown **ppunk) PURE;
|
---|
| 365 | STDMETHOD(Refresh) (THIS) PURE;
|
---|
| 366 | #endif
|
---|
| 367 | STDMETHOD(get_Item) (THIS_ VARIANT index,LPUNKNOWN *ppunk);
|
---|
| 368 | };
|
---|
| 369 |
|
---|
| 370 | #undef INTERFACE
|
---|
| 371 | #define INTERFACE DAOMFCDCollection
|
---|
| 372 | DECLARE_INTERFACE_(DAOMFCDCollection,_DAODynaCollection) {
|
---|
| 373 | #ifndef __cplusplus
|
---|
| 374 | /* IUnknown methods */
|
---|
| 375 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppvObject) PURE;
|
---|
| 376 | STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
---|
| 377 | STDMETHOD_(ULONG, Release)(THIS) PURE;
|
---|
| 378 | /*** IDispatch methods ***/
|
---|
| 379 | STDMETHOD(GetTypeInfoCount)(THIS_ UINT *pctinfo);
|
---|
| 380 | STDMETHOD(GetTypeInfo)(THIS_ UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
|
---|
| 381 | STDMETHOD(GetIDsOfNames)(THIS_ REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
|
---|
| 382 | STDMETHOD(Invoke)(THIS_ DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
---|
| 383 | /*** _DAOCollection ***/
|
---|
| 384 | STDMETHOD(get_Count) (THIS_ short *c) PURE;
|
---|
| 385 | STDMETHOD(_NewEnum) (THIS_ IUnknown **ppunk) PURE;
|
---|
| 386 | STDMETHOD(Refresh) (THIS) PURE;
|
---|
| 387 | /*** _DAODynaCollection ***/
|
---|
| 388 | STDMETHOD(Append) (THIS_ IDispatch *Object) PURE;
|
---|
| 389 | STDMETHOD(Delete) (THIS_ BSTR Name) PURE;
|
---|
| 390 | #endif
|
---|
| 391 | STDMETHOD(get_Item) (THIS_ VARIANT index,LPUNKNOWN *ppunk);
|
---|
| 392 | };
|
---|
| 393 |
|
---|
| 394 | #endif /* __cplusplus */
|
---|
| 395 |
|
---|
| 396 | #endif
|
---|