home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample PMSAM / PMSAM Framework / Common / CQueueEnumerator.h < prev    next >
Encoding:
Text File  |  1995-07-28  |  2.0 KB  |  81 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CQueueEnumerator.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Tim Harnett
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     9/22/94    TMH        made this from stuff in TMSAMSlot::GetIncomingLetter
  13.                  9/22/94    TMH        xxx put comment here xxx
  14.  
  15.     To Do:
  16. */
  17.  
  18. //••• So far only the Out queue enumerator is implemented.
  19.  
  20. #ifndef __CQueueEnumerator__
  21. #define __CQueueEnumerator__
  22.  
  23.  
  24. #ifndef __OCEMAIL__
  25. #include <OCEMail.h>
  26. #endif
  27.  
  28.  
  29. //----------------------------------
  30. //    MSAMEnumerate helper-structures
  31. //----------------------------------
  32.  
  33. //
  34. // EnumInQReply:
  35. //
  36. // this structure is returned by the MSAMEnumerate call (in the data buffer).  It's the
  37. // number of messages enumerated (2 bytes) followed by each message. 
  38.  
  39. typedef struct EnumInQReply {
  40.     MailReply                reply;            // # of messages returned
  41.     MSAMEnumerateInQReply    message;        // message storage
  42. } EnumInQReply, *EnumInQReplyPtr;
  43.  
  44.  
  45. // EnumOutQReply:
  46. //
  47. // this structure is returned by the MSAMEnumerate call (in the data buffer).  It's the
  48. // number of messages enumerated (2 bytes) followed by each message. We ask for only
  49. // one letter each time we call MSAMEnumerate.
  50.  
  51. typedef struct EnumOutQReply {
  52.     MailReply                reply;            // just a short holding # of messages returned
  53.     MSAMEnumerateOutQReply    outQEnumReply;    // message storage
  54. } EnumOutQReply, *EnumOutQReplyPtr;
  55.  
  56.  
  57.  
  58.  
  59. //---------------------------------
  60. //    C O u t Q E n u m e r a t o r 
  61. //---------------------------------
  62.  
  63. //    Notes :
  64. //    1.    We enumerate only 1 letter at a time.
  65.  
  66. class COutQEnumerator {
  67. public:
  68.                             COutQEnumerator(MSAMQueueRef qRef);
  69.     MSAMEnumerateOutQReply*    FirstLetter();
  70.     Boolean                    More() { return (fPB.ioResult == 0) && (fPB.buffer.dataSize>sizeof(short)) && (fPB.startSeqNum!=0) ; };
  71.     MSAMEnumerateOutQReply*    NextLetter();
  72.     void                    Enumerate();
  73.     OSErr                    IOResult() { return fPB.ioResult; };
  74. private:
  75.     MSAMEnumeratePB     fPB;
  76.     EnumOutQReply         fEnumBlock;
  77.     
  78. };
  79.  
  80.  
  81. #endif __CQueueEnumerator__