//******************************************************* // MessageFolder Object: Keeps a folder of CMessage objects // Using the three constructors, folders can be stored either // 1) default folder: "c:\MsgFldr // 2) user chosen folder name in current directory // 3) User chosen folder name in given path // AUTHOR: Chris Wild // DATE: July 25, 1997 //******************************************************* #ifndef MESSAGEFOLDER_H #define MESSAGEFOLDER_H #include "Message.h" #include "ListMsgs.h" #include typedef int msgID; //typedef int bool; const int NULL_ID = 0; class CMsgFolder { public: //************* constructors and destructors CMsgFolder(); // default // opens (or creates a folder called "folderName" in current directory CMsgFolder(const char* folderName); // opens (or creates) a folder called "folderName in "path" CMsgFolder(const char* path, const char* folderName); // Writes out open messages and folder information ~CMsgFolder(); // Puts a message in the folder bool PostMsg(const CMessage& msg); // PRE: message with "messageID" exists // gets message with ID "messageId" CMessage GetMsg(msgID messageId) const; // PRE: message with "messageID" exists // topic points to a string big enough to hold topic string // POST: if exists, returns true and topic of this message // else returns false bool GetMsgTopic(msgID messageId, char* topic) const; // PRE: message with "messageID" exists // POST: deletes this message (renumbering messages) bool DeleteMsg(msgID messageID); // POST: returns the number of messages in this folder int NumMsgs() const; // POST: Closes this folder making it undefined // returns false if problem closing folder else true bool CloseMsgFolder(); // POST: Open folder with "folderName" // returns true is opened successfully else false bool OpenMsgFolder(const char* folderName); private: char* folderName; HANDLE messages; // handle to open message folder CListMsgs msgList; // list of available messages int nextMsgNum; // unique number for next message bool verifyFolder(const char*); // opens(creates) message folder }; #endif