KWWidgets
tkOleDND_TEnumFormatEtc.h
Go to the documentation of this file.
1 /*
2  *----------------------------------------------------------------------
3  * File: tenumformatetc.h
4  *
5  * This file defines the TEnumFormatEtc, an enerator class for the
6  * IEnumFORMATETC object. The IEnumFORMATETC object has the standard
7  * enumerator interface. The only creation oddity it has it the
8  * IUnknown interface it takes as its first parameter. This allows
9  * the object to increase the reference count of the object that is
10  * being enumerated. Only after this enumerator is destroyed can the
11  * object that created it be destroyed. This object should only be
12  * created by the IDataObject::EnumFormatEtc function.
13  *----------------------------------------------------------------------
14  */
15 
16 #ifndef _TENUMFORMATETC_H_
17 #define _TENUMFORMATETC_H_
18 
19 class TEnumFormatEtc;
21 
22 class TEnumFormatEtc: public IEnumFORMATETC
23 {
24  private:
25  ULONG m_refCnt; /* Reference count */
26  LPUNKNOWN m_pUnknownObj; /* IUnknown for ref counting */
27  ULONG m_currElement; /* Current element */
28  ULONG m_numFormats; /* Number of FORMATETCs in us */
29  LPFORMATETC m_formatList; /* List of formats */
30 
31  public:
32  TEnumFormatEtc(LPUNKNOWN, ULONG, LPFORMATETC);
33  ~TEnumFormatEtc(void);
34 
35  /* IUnknown members */
36  STDMETHODIMP QueryInterface(REFIID, LPVOID *);
37  STDMETHODIMP_(ULONG) AddRef(void);
38  STDMETHODIMP_(ULONG) Release(void);
39 
40  /* IEnumFORMATETC members */
41  STDMETHODIMP Next(ULONG, LPFORMATETC, ULONG *);
42  STDMETHODIMP Skip(ULONG);
43  STDMETHODIMP Reset(void);
44  STDMETHODIMP Clone(IEnumFORMATETC **);
45 };
46 
47 extern LPENUMFORMATETC
48 CreateFormatEtcEnumerator(LPUNKNOWN, ULONG, LPFORMATETC);
49 
50 #endif /* _TENUMFORMATETC_H_ */