//+--------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992 - 1992.
//
//  File:	expiter.hxx
//
//  Contents:	CExposedIterator header file
//
//  Classes:	CExposedIterator
//
//  History:	12-Mar-92	DrewB	Created
//
//---------------------------------------------------------------

#ifndef __EXPITER_HXX__
#define __EXPITER_HXX__

#include <dfmsp.hxx>
#include <lock.hxx>
#ifndef REF
#include <dfbasis.hxx>
#endif //!REF
#include <peiter.hxx>

#ifndef REF
class CDFBasis;
#endif //!REF
class CDirectStream;

//+--------------------------------------------------------------
//
//  Class:	CExposedIterator (ei)
//
//  Purpose:	Iterator for wrapped DocFiles
//
//  Interface:	See below
//
//  History:	12-Mar-92	DrewB	Created
//
//---------------------------------------------------------------

interface CExposedIterator
    : public IEnumSTATSTG, public PExposedIterator
{
public:
#ifndef REF
    CExposedIterator(CPubDocFile *ppdf,
            CDfName *pdfnKey,
            CDFBasis *pdfb,
            CPerContext *ppc,
            BOOL fOwnContext);
#else
    CExposedIterator(CPubDocfile *ppdf, ULONG ulOffset);
#endif //!REF
    ~CExposedIterator(void);

    // From IUnknown
    STDMETHOD(QueryInterface)(REFIID iid, void **ppvObj);
    STDMETHOD_(ULONG,AddRef)(void);
    STDMETHOD_(ULONG,Release)(void);

    // New methods
    STDMETHOD(Next)(ULONG celt, STATSTG FAR *rgelt, ULONG *pceltFetched);
#ifndef OLEWIDECHAR
    SCODE Next(ULONG celt, STATSTGW FAR *rgelt, ULONG *pceltFetched);
#endif    
    STDMETHOD(Skip)(ULONG celt);
    STDMETHOD(Reset)(void);
    STDMETHOD(Clone)(IEnumSTATSTG **ppenm);

    inline SCODE Validate(void) const;
};

SAFE_INTERFACE_PTR(SafeCExposedIterator, CExposedIterator);

// DocFileIter signatures
#define CEXPOSEDITER_SIG LONGSIG('E', 'D', 'F', 'I')
#define CEXPOSEDITER_SIGDEL LONGSIG('E', 'd', 'F', 'i')

//+--------------------------------------------------------------
//
//  Member:	CExposedIterator::Validate, public
//
//  Synopsis:	Validates the signature
//
//  Returns:	Returns STG_E_INVALIDHANDLE if the signature doesn't match
//
//  History:	12-Mar-92	DrewB	Created
//
//---------------------------------------------------------------

inline SCODE CExposedIterator::Validate(void) const
{
    return (this == NULL || _sig != CEXPOSEDITER_SIG) ? STG_E_INVALIDHANDLE :
	S_OK;
}

#endif
