Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Private Attributes
CMapiFolderContents Class Reference

#include <MapiApi.h>

List of all members.

Public Member Functions

 CMapiFolderContents (LPMDB lpMdb, ULONG cbEID, LPENTRYID lpEid)
 ~CMapiFolderContents ()
BOOL GetNext (ULONG *pcbEid, LPENTRYID *ppEid, ULONG *poType, BOOL *pDone)
ULONG GetCount (void)

Protected Member Functions

BOOL SetUpIter (void)

Private Attributes

HRESULT m_lastError
BOOL m_failure
LPMDB m_lpMdb
LPMAPIFOLDER m_lpFolder
LPMAPITABLE m_lpTable
ULONG m_fCbEid
BYTEm_fLpEid
ULONG m_count
ULONG m_iterCount
BYTEm_lastLpEid
ULONG m_lastCbEid

Detailed Description

Definition at line 239 of file MapiApi.h.


Constructor & Destructor Documentation

CMapiFolderContents::CMapiFolderContents ( LPMDB  lpMdb,
ULONG  cbEID,
LPENTRYID  lpEid 
)

Definition at line 1747 of file MapiApi.cpp.

{
       m_lpMdb = lpMdb;
       m_fCbEid = cbEid;
       m_fLpEid = new BYTE[cbEid];
       memcpy( m_fLpEid, lpEid, cbEid);
       m_count = 0;
       m_iterCount = 0;
       m_failure = FALSE;
       m_lastError = 0;
       m_lpFolder = NULL;
       m_lpTable = NULL;
       m_lastLpEid = NULL;
       m_lastCbEid = 0;
}

Here is the call graph for this function:

Definition at line 1763 of file MapiApi.cpp.

{
       if (m_lastLpEid)
              delete m_lastLpEid;
       delete m_fLpEid;
       if (m_lpTable)
              m_lpTable->Release();
       if (m_lpFolder)
              m_lpFolder->Release();
}

Member Function Documentation

Definition at line 246 of file MapiApi.h.

{ return( m_count);}
BOOL CMapiFolderContents::GetNext ( ULONG pcbEid,
LPENTRYID *  ppEid,
ULONG poType,
BOOL pDone 
)

Definition at line 1829 of file MapiApi.cpp.

{
       *pDone = FALSE;
       if (m_failure)
              return( FALSE);
       if (!m_lpFolder) {
              if (!SetUpIter()) {
                     m_failure = TRUE;
                     return( FALSE);
              }
              if (!m_count) {
                     *pDone = TRUE;
                     return( TRUE);
              }
       }

       int                  cNumRows = 0;        
       LPSRowSet     lpRow = NULL;
       HRESULT              hr = m_lpTable->QueryRows( 1, 0, &lpRow);

       if(HR_FAILED( hr)) {
              m_lastError = hr;
              m_failure = TRUE;
              MAPI_TRACE2( "CMapiFolderContents - QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr);
              return( FALSE);
       }

       if(lpRow) {
              cNumRows = lpRow->cRows;
              if (cNumRows) {
            LPENTRYID       lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
            ULONG           cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
                     ULONG         oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
                     
                     if (m_lastCbEid != cbEID) {
                            if (m_lastLpEid)
                                   delete m_lastLpEid;
                            m_lastLpEid = new BYTE[cbEID];
                            m_lastCbEid = cbEID;
                     }
                     memcpy( m_lastLpEid, lpEID, cbEID);

                     *ppEid = (LPENTRYID) m_lastLpEid;
                     *pcbEid = cbEID;
                     *poType = oType;
              }
              else
                     *pDone = TRUE;
              CMapiApi::FreeProws( lpRow);              
    }
       else
              *pDone = TRUE;

       return( TRUE);
}

Here is the call graph for this function:

Definition at line 1775 of file MapiApi.cpp.

{
       // First, open up the MAPIFOLDER object
       ULONG         ulObjType;
       HRESULT              hr;
       hr = m_lpMdb->OpenEntry( m_fCbEid, (LPENTRYID) m_fLpEid, NULL, 0, &ulObjType, (LPUNKNOWN *) &m_lpFolder);

       if (FAILED(hr) || !m_lpFolder) {
              m_lpFolder = NULL;
              m_lastError = hr;
              MAPI_TRACE2( "CMapiFolderContents OpenEntry failed: 0x%lx, %d\n", (long)hr, (int)hr);
              return( FALSE);
       }

       if (ulObjType != MAPI_FOLDER) {
              m_lastError = -1;
              MAPI_TRACE0( "CMapiFolderContents - bad object type, not a folder.\n");
              return( FALSE);
       }


       hr = m_lpFolder->GetContentsTable( 0, &m_lpTable);
       if (FAILED(hr) || !m_lpTable) {
              m_lastError = hr;
              m_lpTable = NULL;
              MAPI_TRACE2( "CMapiFolderContents - GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr);
              return( FALSE);
       }

       hr = m_lpTable->GetRowCount( 0, &m_count);
       if (FAILED(hr)) {
              m_lastError = hr;
              MAPI_TRACE0( "CMapiFolderContents - GetRowCount failed\n");
              return( FALSE);
       }

       hr = m_lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
       if (FAILED(hr)) {
              m_lastError = hr;
              MAPI_TRACE2( "CMapiFolderContents - SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr);
              return( FALSE);
       }

       hr = m_lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
       if (FAILED(hr)) {
              m_lastError = hr;
              MAPI_TRACE2( "CMapiFolderContents - SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr);
              return( FALSE);
       }
       
       return( TRUE);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 259 of file MapiApi.h.

Definition at line 253 of file MapiApi.h.

Definition at line 257 of file MapiApi.h.

Definition at line 258 of file MapiApi.h.

Definition at line 260 of file MapiApi.h.

Definition at line 262 of file MapiApi.h.

Definition at line 252 of file MapiApi.h.

Definition at line 261 of file MapiApi.h.

LPMAPIFOLDER CMapiFolderContents::m_lpFolder [private]

Definition at line 255 of file MapiApi.h.

Definition at line 254 of file MapiApi.h.

LPMAPITABLE CMapiFolderContents::m_lpTable [private]

Definition at line 256 of file MapiApi.h.


The documentation for this class was generated from the following files: