32 #include "kmime_codec_identity.h" 35 #include <tdeglobal.h> 40 using namespace KMime; 47 friend class IdentityCodec; 48 IdentityEnDecoder( bool withCRLF ) 51 kdWarning( withCRLF, 5100 ) << "IdentityEnDecoder: withCRLF isn't yet supported!" << endl; 55 ~IdentityEnDecoder() {} 57 bool encode( const char* & scursor, const char * const send, 58 char* & dcursor, const char * const dend ) { 59 return decode( scursor, send, dcursor, dend ); 61 bool decode( const char* & scursor, const char * const send, 62 char* & dcursor, const char * const dend ); 63 bool finish( char* & , const char * const ) { return true; } 67 Encoder * IdentityCodec::makeEncoder( bool withCRLF ) const { 68 return new IdentityEnDecoder( withCRLF ); 71 Decoder * IdentityCodec::makeDecoder( bool withCRLF ) const { 72 return new IdentityEnDecoder( withCRLF ); 82 bool IdentityEnDecoder::decode( const char* & scursor, const char * const send, 83 char* & dcursor, const char * const dend ) 85 const int size = kMin( send - scursor, dcursor - dend ); 87 std::memmove( dcursor, scursor, size ); 91 return scursor == send; 94 TQByteArray IdentityCodec::encode( const TQByteArray & src, bool withCRLF ) const { 95 kdWarning( withCRLF, 5100 ) << "IdentityCodec::encode(): withCRLF not yet supported!" << endl; 99 TQByteArray IdentityCodec::decode( const TQByteArray & src, bool withCRLF ) const { 100 kdWarning( withCRLF, 5100 ) << "IdentityCodec::decode(): withCRLF not yet supported!" << endl; 104 TQCString IdentityCodec::encodeToTQCString( const TQByteArray & src, bool withCRLF ) const { 105 kdWarning( withCRLF, 5100 ) << "IdentityCodec::encodeToTQCString(): withCRLF not yet supported!" << endl; 106 return TQCString( src.data(), src.size() + 1 ); Stateful encoder class, modelled after TQTextEncoder.
Stateful decoder class, modelled after TQTextDecoder.
|