⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ghswatchcursor.h

📁 VC开发环境下
💻 H
字号:
// GHSwatchCursor.h : Declaration of the CGHSwatchCursor

#pragma once
#include "resource.h"       // main symbols

#include "GHSwatchSystem.h"
#include <vector>
#include "GHRow.h"
#include "GHSwatch.h"

// CGHSwatchCursor
typedef void (*NextFunc) (std::list<CSwatchData*>::iterator& pos);

class ATL_NO_VTABLE CGHSwatchCursor : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CGHSwatchCursor, &CLSID_GHSwatchCursor>,
	public IDispatchImpl<IGHSwatchCursor, &IID_IGHSwatchCursor, &LIBID_GHSwatchSystemLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
	CGHSwatchCursor():m_bRecycling(TRUE),m_bReadOnly(TRUE),m_pGHSwatch(NULL),m_pRecyclingRow(NULL)
	{
		m_mfNextFunc=0;
	}

DECLARE_REGISTRY_RESOURCEID(IDR_GHSWATCHCURSOR)


BEGIN_COM_MAP(CGHSwatchCursor)
	COM_INTERFACE_ENTRY(IGHSwatchCursor)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()


	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}
	
	void FinalRelease() 
	{
		if (m_pRecyclingRow)  //Release Recycling IGHRow
			m_pRecyclingRow->Release();

		if(m_pGHSwatch)
			m_pGHSwatch->Release();
	}
	
public:
	STDMETHOD(NextRow)(IGHRow** row);
	STDMETHOD(InsertRow)(IGHRow* row);
	STDMETHOD(DeleteRow)();
	STDMETHOD(Flush)(void);
	STDMETHOD(Reset)(void);

public:
	HRESULT Initial(CComObject<CGHSwatch>* pGHSwatch,
					BOOL bReadOnly=TRUE,BOOL bRecyling=TRUE);
private:
	BOOL    IsEOF();
	
private:
	NextFunc                          m_mfNextFunc;
	std::list<CSwatchData*>::iterator m_Cursor;	
	CComObject<CGHRow>               *m_pRecyclingRow;    //Recycling IGHRow
	CComObject<CGHSwatch>            *m_pGHSwatch;
	BOOL							 m_bReadOnly;  //Is ReadOnly Cursor

	BOOL						     m_bRecycling;
	/************************************************************************/
	/* The m_bRecycling parameter controls row object allocation behavior.
	Recycling cursors rehydrate a single row object m_pRecyclingRow on each fetch and 
	can be used to optimize read-only access. It is illegal to maintain a reference 
	on a row object returned by a recycling cursor across multiple calls to NextRow
	on the cursor.Row objects returned by a recycling cursor should not be modified. 

	Non-recycling cursors return a separate row object on each fetch. The objects 
	returned by a non-recycling cursor may be modified and stored with polymorphic behavior.
	If the row object to be retrieved by a call to search has already been instantiated and 
	is being referenced by the calling application, then a reference to the existing row object is returned.
	/************************************************************************/
};

OBJECT_ENTRY_NON_CREATEABLE_EX_AUTO(__uuidof(GHSwatchCursor), CGHSwatchCursor)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -