You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.0 KiB
97 lines
3.0 KiB
15 years ago
|
/*
|
||
|
qutf7codec.h
|
||
|
|
||
15 years ago
|
A TQTextCodec for UTF-7 (rfc2152).
|
||
15 years ago
|
Copyright (c) 2001 Marc Mutz <mutz@kde.org>
|
||
|
See file COPYING for details
|
||
|
|
||
|
This program is free software; you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License, version 2.0,
|
||
|
as published by the Free Software Foundation.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program; if not, write to the Free Software
|
||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||
|
02110-1301, US
|
||
|
|
||
|
As a special exception, permission is granted to use this plugin
|
||
14 years ago
|
with any version of TQt by TrollTech AS, Norway. In this case, the
|
||
15 years ago
|
use of this plugin doesn't cause the resulting executable to be
|
||
|
covered by the GNU General Public License.
|
||
14 years ago
|
This exception does not however tqinvalidate any other reasons why the
|
||
15 years ago
|
executable file might be covered by the GNU General Public License.
|
||
|
*/
|
||
|
|
||
14 years ago
|
#ifndef TQUTF7CODEC_H
|
||
|
#define TQUTF7CODEC_H
|
||
15 years ago
|
|
||
15 years ago
|
#include "tqtextcodec.h"
|
||
15 years ago
|
|
||
13 years ago
|
#include <tdepimmacros.h>
|
||
15 years ago
|
|
||
14 years ago
|
#ifndef TQT_NO_TEXTCODEC
|
||
15 years ago
|
|
||
15 years ago
|
/** @short A TQTextCodec for the UTF-7 transformation of Unicode.
|
||
15 years ago
|
|
||
15 years ago
|
This is a TQTextCodec for the UTF-7 transformation of Unicode,
|
||
15 years ago
|
described in RFC2152.
|
||
|
|
||
15 years ago
|
Use it as you would use any other TQTextCodec. Only if you use the
|
||
15 years ago
|
encoder directly (via makeEncoder), you should bear in mind
|
||
|
that if your application needs the encoder to return to ASCII mode
|
||
|
(like it's the case for RFC2047 mail header encoded words), you
|
||
|
have to tell the encoder by requesting the encoding of a @em null
|
||
15 years ago
|
TQString.
|
||
15 years ago
|
|
||
|
@author Marc Mutz <mutz@kde.org> */
|
||
|
|
||
14 years ago
|
class KDE_EXPORT TQUtf7Codec : public TQTextCodec {
|
||
15 years ago
|
bool encOpt, encLwsp;
|
||
|
public:
|
||
14 years ago
|
TQUtf7Codec() : TQTextCodec() {}
|
||
15 years ago
|
|
||
|
int mibEnum() const;
|
||
|
const char* name() const;
|
||
|
const char* mimeName() const;
|
||
|
|
||
15 years ago
|
TQTextDecoder* makeDecoder() const;
|
||
|
TQTextEncoder* makeEncoder() const;
|
||
15 years ago
|
|
||
15 years ago
|
bool canEncode( TQChar ) const;
|
||
|
bool canEncode( const TQString& ) const;
|
||
15 years ago
|
|
||
|
int heuristicContentMatch( const char* chars, int len ) const;
|
||
|
};
|
||
|
|
||
14 years ago
|
/** This is a version of @ref TQUtf7Codec, which should only be used in
|
||
|
MIME transfer. It differs from @ref TQUtf7Codec only in that the
|
||
15 years ago
|
encoder escapes additional characters (the RFC2152 "optional
|
||
|
direct set"), which might not be allowed in RFC822/RFC2047 header
|
||
|
fields.
|
||
|
|
||
|
You should only use this codec for @em encoding, since it's output
|
||
14 years ago
|
is pure UTF-7 and can equally well be decoded by @ref TQUtf7Codec's
|
||
15 years ago
|
decoder.
|
||
|
|
||
|
To distinguish between the two variants, this class has MIB enum
|
||
|
-1012 (the nagative of UTF-7) and the somewhat awkward name
|
||
|
"X-QT-UTF-7-STRICT". The MIME preferred charset name is still
|
||
|
"UTF-7", though.
|
||
|
|
||
14 years ago
|
@short A variant of @ref TQUtf7Codec, which protectes certain
|
||
15 years ago
|
characters in MIME transport
|
||
|
@author Marc Mutz <mutz@kde.org> */
|
||
14 years ago
|
class KDE_EXPORT TQStrictUtf7Codec : public TQUtf7Codec {
|
||
15 years ago
|
public:
|
||
14 years ago
|
TQStrictUtf7Codec() : TQUtf7Codec() {}
|
||
15 years ago
|
|
||
|
const char* name() const;
|
||
|
int mibEnum() const;
|
||
|
|
||
15 years ago
|
TQTextEncoder* makeEncoder() const;
|
||
15 years ago
|
};
|
||
|
|
||
14 years ago
|
#endif // TQT_NO_TEXTCODEC
|
||
15 years ago
|
|
||
14 years ago
|
#endif // TQUTF7CODEC_H
|