Listing 2
/* Interface. A program wishing to do an MDE Generate or Update operation
must provide an implementation of this interface. Furthermore, the program
must delete the files and directories used to provide data in at some later
point in time. An explanation of when this must happen and why is outside
the scope of this article. Operations return true if they were able to
write the requested parameter to the destination.
*/
class IDataProvider
{
public:
virtual bool ProvideHeader(string file) = 0;
virtual bool ProvideBody(string file) = 0;
virtual bool ProvideBodyInBuffer(string& buffer) = 0;
virtual bool ProvideXmlBody(string file) = 0;
virtual bool ProvideXmlBodyInBuffer(string& buffer) = 0;
virtual bool ProvideParsedBody(string file) = 0;
virtual bool ProvideMessage(string file) = 0;
virtual bool ProvideAttachments(string directory) = 0;
virtual bool ProvideMessageNumber(string& buffer) = 0;
virtual bool ProvideUserID(string& buffer) = 0;
virtual bool ProvideCustomData(string& buffer) = 0;
};
/* Interface. A program wishing to do an MDE Generate operation must provide
an implementation of this interface. The program may NOT delete the files
and directories. An explanation of why this is so is outside the scope of
this article. Operations return true if they were able to consume the data.
*/
class IDataConsumer
{
public:
virtual bool ConsumeHeader(string file) = 0;
virtual bool ConsumeBody(string file) = 0;
virtual bool ConsumeBodyInBuffer(string body) = 0;
virtual bool ConsumeMessage(string file) = 0;
virtual bool ConsumeAttachments(string directory) = 0;
};
// A place for operations to deliver their status text.
class IStatusTextConsumer
{
public:
enum Medium { IN_FILE, IN_BUFFER };
virtual bool ConsumeStatusText(string status, Medium medium) = 0;
};