[ Home | Syllabus |Course Notes]
class CMessage : public CObject
{
DECLARE_SERIAL (CMessage)
public:
//************** constructors and desctructors
// Default constructor builds an empty message
CMessage();
CMessage(const CMessage& Msg);
~CMessage();
//************** Operations
void SetTopic(const CString&);
// Sets the message topic
//POST: Topic of this message is set to string
CString GetTopic() const;
// Gets the message topic
// POST: returns topic of this message
void SetText(const CString&);
// Sets text of message
CString GetText() const;
// returns text of message
virtual void Serialize(CArchive&);
// Read/Write message to already open file
private:
CString topic, text;
};
#include "Message.h"
IMPLEMENT_SERIAL (CMessage, CObject, 1)
CMessage::CMessage()
{
}
CMessage::CMessage(const CMessage& msg)
{
topic = msg.topic;
text = msg.text;
}
CMessage::~CMessage()
{ // nothing to do
}
void CMessage::SetTopic(const CString& thisTopic)
{
topic = thisTopic;
}
// Gets the message topic
CString CMessage::GetTopic() const
{
return topic;
}
void CMessage::SetText(const CString& thisMsg)
{
text = thisMsg;
}
CString CMessage::GetText() const
{
return text;
}
void CMessage::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if(ar.IsStoring( )
ar << topic << text;
else
ar >> topic >> text;
}
Copyright chris wild 1997.
For problems or questions regarding this web contact [Dr. Wild].
Last updated: October 23, 1997.