< previous page page_391 next page >

Page 391
As part of its interface, PostMasterMessage will need to talk with other types of messages, of course. You hope to be able to work closely with the other message providers, and to get their message format specifications, but for now you can make some smart guesses just by observing what is sent to your computer as you use their services.
In any case, you know that every PostMasterMessage will have a sender, a recipient, a date, and a subject, as well as the body of the message and perhaps attached files. This tells you that you'll need accessor methods for each of these attributes, as well as methods to report on the size of the attached files, the size of the messages, and so forth.
Some of the services to which you will connect will use rich textthat is, text with formatting instructions to set the font, character size, and attributes such as bold and italic. Other services do not support these attributes, and those that do may or may not use their own proprietary scheme for managing rich text. Your class will need conversion methods for turning rich text into plain ASCII, and perhaps for turning other formats into PostMaster formats.
The Application Programming Interface
An Application Programming Interface (API) is a set of documentation and routines for using a service. Many of the mail providers will give you an API so that PostMaster mail will be able to take advantage of their more advanced features, such as rich text and embedding files. You will also want to publish an API for PostMaster so that other providers can plan for working with PostMaster in the future.
Your PostMasterMessage class needs to have a well-designed public interface, and the conversion functions will be a principal component of PostMaster's API. Listing 22.2 illustrates what PostMasterMessage's interface looks like so far.
LISTING 22.2PostMasterMessage's INTERFACE

d5ef64f4d3250b96ba5c07ca5bbc2f56.gif
1:     class PostMasterMessage : public MailMessage
2:     {
3:     public:
4:        PostMasterMessage();
5:        PostMasterMessage(
6:           pAddress Sender,
7:           pAddress Recipient,
8:           pString Subject,
9:           pDate creationDate);
10:
11:        // other constructors here
12:        // remember to include copy constructor
d5ef64f4d3250b96ba5c07ca5bbc2f56.gif
continues

 
< previous page page_391 next page >

If you like this book, buy it!