class DW_CORE_EXPORT DwEncodedWord : public DwMessageComponent { public: DwEncodedWord(); DwEncodedWord(const DwEncodedWord& aWord); DwEncodedWord(const DwString& aStr, DwMessageComponent* aParent=0); virtual ~DwEncodedWord(); const DwEncodedWord& operator = (const DwEncodedWord& aWord); virtual void Parse(); virtual void Assemble(); virtual DwMessageComponent* Clone() const; const DwString& Charset() const; void SetCharset(const DwString& aCharset); char EncodingType() const; void SetEncodingType(char anEncodingType); const DwString& EncodedText() const; void SetEncodedText(const DwString& aStr); const DwString& DecodedText() const; void SetDecodedText(const DwString& aStr); static DwEncodedWord* NewEncodedWord(const DwString& aStr, DwMessageComponent* aParent); static DwEncodedWord* (*sNewEncodedWord)(const DwString&, DwMessageComponent*); void PrintDebugInfo(DW_STD ostream& aStrm, int aDepth) const; void CheckInvariants() const; protected: void _PrintDebugInfo(DW_STD ostream& aStrm) const; protected: DwString mCharset; char mEncodingType; DwString mEncodedText; DwString mDecodedText; };
The first constructor is the default constructor, which assigns empty string to all the string attributes and sets the encoding type to NUL.
The second constructor is the copy constructor. The parent of the new DwEncodedWord object is set to NULL. The third constructor sets aStr as the DwEncodedWord object's string representation and sets aParent as its parent. The virtual member function Parse() should be called after this constructor to perform the decoding operation. Unless it is NULL, aParent should point to an object of a class derived from DwText.
const DwEncodedWord& operator = (const DwEncodedWord& aWord)
This is the assignment operator, which sets this DwEncodedWord object to the same value as aEncodedWord.
virtual void Parse()
This virtual function, inherited from DwMessageComponent, executes the parse method for DwEncodedWord objects. The parse method creates or updates the broken-down representation from the string representation. For DwEncodedWord objects, the parse method parses the string representation to extract the charset, encoding type, the encoded text, and the decoded text.
This function clears the is-modified flag.
virtual void Assemble()
This virtual function, inherited from DwMessageComponent, executes the assemble method for DwEncodedWord objects. It should be called whenever one of the object's attributes is changed in order to assemble the string representation from its broken-down representation. It will be called automatically for this object by the parent object's Assemble() member function if the is-modified flag is set.
This function clears the is-modified flag.
virtual DwMessageComponent* Clone() const
This virtual function, inherited from DwMessageComponent, creates a new DwEncodedWord on the free store that has the same value as this DwEncodedWord object. The basic idea is that of a virtual copy constructor.
const DwString& Charset() const
Returns the charset for this DwEncodedWord object. The charset must be one that is registered with the IANA, such as ISO-8859-1.
void SetCharset(const DwString& aCharset)
Sets the charset for this DwEncodedWord object.
char EncodingType() const
Returns the encoding type for this DwEncodedWord object.
void SetEncodingType(char anEncodingType)
Sets the encoding type for this DwEncodedWord object. The encoding type must be one of: 'Q', 'q', 'B', 'b', or NUL. 'Q' and 'q' are equivalent and indicate the quoted-printable encoding. 'B' and 'b' are equivalent, and indicate the base64 encoding. The NUL character indicates no encoding, making this a pseudo-encoded word.
const DwString& EncodedText() const
Returns the encoded text part of an encoded word.
void SetEncodedText(const DwString& aStr)
Sets the encoded text part of an encoded word.
const DwString& DecodedText() const
Returns the decoded text in a DwEncodedWords.
void SetDecodedText(const DwString& aStr)
Sets the decoded text in a DwEncodedWords.
static DwEncodedWord* NewEncodedWord(const DwString& aStr, DwMessageComponent* aParent)
Creates a new DwEncodedWord object on the free store. If the static data member sNewDwEncodedWord is NULL, this member function will create a new DwEncodedWord and return it. Otherwise, NewEncodedWord() will call the user-supplied function pointed to by sNewEncodedWord, which is assumed to return an object from a class derived from DwEncodedWord, and return that object.
void PrintDebugInfo(DW_STD ostream& aStrm, int aDepth) const
This virtual function, inherited from DwMessageComponent, prints debugging information about this object to aStrm. It will also call PrintDebugInfo() for any of its child components down to a level of aDepth.
This member function is available only in the debug version of the library.
void CheckInvariants() const
Aborts if one of the invariants of the object fails. Use this member function to track down bugs.
This member function is available only in the debug version of the library.
If sNewEncodedWord is not NULL, it is assumed to point to a user-supplied function that returns an object from a class derived from DwEncodedWord.