1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#if !defined(AFX_RECORDSETOBJECT_H__3DCAE528_1138_4312_BCD9_052B5750324A__INCLUDED_) #define AFX_RECORDSETOBJECT_H__3DCAE528_1138_4312_BCD9_052B5750324A__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif /
/ template<class T> class CRecordsetObject { public: inline BOOL operator==(const T *p2) { return __pTaskGunInfo == p2; } inline T*& operator->() { return __pTaskGunInfo; } public: CRecordsetObject(CDatabase* pDatabase); virtual ~CRecordsetObject(); private: T *__pTaskGunInfo; private: CRecordsetObject(const CRecordsetObject&); CRecordsetObject operator =(const CRecordsetObject&); }; template<class T> CRecordsetObject<T>::CRecordsetObject(CDatabase* pDatabase) :__pTaskGunInfo(NULL) { __pTaskGunInfo = new T(pDatabase); } template<class T> CRecordsetObject<T>::~CRecordsetObject() { if (NULL != __pTaskGunInfo) { if (__pTaskGunInfo->IsOpen()) { __pTaskGunInfo->Close(); } delete __pTaskGunInfo; __pTaskGunInfo = NULL; } } #endif
|