diff options
Diffstat (limited to 'libmail/autodecoder.H')
| -rw-r--r-- | libmail/autodecoder.H | 62 | 
1 files changed, 62 insertions, 0 deletions
| diff --git a/libmail/autodecoder.H b/libmail/autodecoder.H new file mode 100644 index 0000000..d8d59ec --- /dev/null +++ b/libmail/autodecoder.H @@ -0,0 +1,62 @@ +/* +** Copyright 2002, Double Precision Inc. +** +** See COPYING for distribution information. +*/ +#ifndef libmail_autodecoder_H +#define libmail_autodecoder_H + +#include "decoder.H" +#include "base64.H" +#include "qp.H" +#include "namespace.H" + +// +// Generic MIME decoder.  A mail::decoder subclass that uses either base64 +// or qp, where appropriate. + +LIBMAIL_START + +class autodecoder : public decoder { + +	// Declare both base64 and qp decoding members. + +	class base64 : public decodebase64 { + +		autodecoder &me; + +	public: +		base64(autodecoder &meArg); +		~base64(); +	private: +		void decoded(std::string); +	}; + +	class qp : public decodeqp { +		autodecoder &me; + +	public: +		qp(autodecoder &meArg); +		~qp(); +	private: +		void decoded(std::string); +	}; + +	base64 base64Decoder; +	qp qpDecoder; + +	decoder *decoder;	// Points to one of these two, or NULL + +public: +	autodecoder(std::string contentTransferEncoding); +	~autodecoder(); + +	void decode(std::string s); + +	virtual void decoded(std::string)=0; + +}; + +LIBMAIL_END + +#endif | 
