40 #ifndef __KMIME_HEADERS_H__
41 #define __KMIME_HEADERS_H__
43 #include "kmime_export.h"
44 #include "kmime_header_parsing.h"
46 #include <QtCore/QString>
47 #include <QtCore/QStringList>
48 #include <QtCore/QRegExp>
49 #include <QtCore/QDateTime>
50 #include <QtCore/QMap>
51 #include <QtCore/QList>
52 #include <QtCore/QByteArray>
54 #include <kdatetime.h>
64 enum contentCategory {
74 enum contentEncoding {
86 enum contentDisposition {
95 static const QByteArray Latin1(
"ISO-8859-1" );
99 #define kmime_mk_trivial_ctor( subclass ) \
101 explicit subclass( Content *parent = 0 ); \
102 subclass( Content *parent, const QByteArray &s ); \
103 subclass( Content *parent, const QString &s, const QByteArray &charset ); \
106 #define kmime_mk_dptr_ctor( subclass ) \
108 explicit subclass( subclass##Private *d, KMime::Content *parent = 0 );
110 #define kmime_mk_trivial_ctor_with_name( subclass ) \
111 kmime_mk_trivial_ctor( subclass ) \
112 const char *type() const; \
113 static const char *staticType();
156 virtual void from7BitString(
const QByteArray &s ) = 0;
162 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const = 0;
173 void setRFC2047Charset(
const QByteArray &cs );
183 bool forceDefaultCharset()
const;
199 virtual QString asUnicodeString()
const = 0;
204 virtual void clear() = 0;
209 virtual bool isEmpty()
const = 0;
214 virtual const char *type()
const;
219 bool is(
const char *t )
const;
224 bool isMimeHeader()
const;
229 bool isXHeader()
const;
239 kmime_mk_dptr_ctor(
Base )
243 Q_DECLARE_PRIVATE(
Base )
244 Q_DISABLE_COPY(
Base )
255 class UnstructuredPrivate;
281 virtual void from7BitString(
const QByteArray &s );
282 virtual QByteArray as7BitString(
bool withHeaderType=
true )
const;
284 virtual void fromUnicodeString(
const QString &s,
286 virtual QString asUnicodeString()
const;
288 virtual void clear();
290 virtual bool isEmpty()
const;
297 class StructuredPrivate;
337 virtual void from7BitString(
const QByteArray &s );
338 virtual QString asUnicodeString()
const;
350 virtual bool parse(
const char* &scursor,
const char *
const send,
351 bool isCRLF =
false ) = 0;
361 class AddressPrivate;
381 class MailboxListPrivate;
396 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
398 virtual QString asUnicodeString()
const;
400 virtual void clear();
401 virtual bool isEmpty()
const;
444 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
450 class SingleMailboxPrivate;
462 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
467 class AddressListPrivate;
487 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
489 virtual QString asUnicodeString()
const;
491 virtual void clear();
492 virtual bool isEmpty()
const;
532 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
548 kmime_mk_trivial_ctor(
Ident )
549 kmime_mk_dptr_ctor(
Ident )
552 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
553 virtual void clear();
554 virtual bool isEmpty()
const;
568 void appendIdentifier(
const QByteArray &
id );
571 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
574 Q_DECLARE_PRIVATE(
Ident )
577 class SingleIdentPrivate;
604 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
618 kmime_mk_trivial_ctor(
Token )
619 kmime_mk_dptr_ctor(
Token )
622 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
623 virtual void clear();
624 virtual bool isEmpty()
const;
637 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
640 Q_DECLARE_PRIVATE(
Token )
643 class PhraseListPrivate;
654 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
655 virtual QString asUnicodeString()
const;
656 virtual void clear();
657 virtual bool isEmpty()
const;
665 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
671 class DotAtomPrivate;
679 kmime_mk_trivial_ctor(
DotAtom )
682 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
683 virtual QString asUnicodeString()
const;
684 virtual void clear();
685 virtual bool isEmpty()
const;
688 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
694 class ParametrizedPrivate;
706 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
708 virtual bool isEmpty()
const;
709 virtual void clear();
725 bool hasParameter(
const QString &key )
const;
735 virtual bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
749 class ReturnPathPrivate;
762 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
763 virtual void clear();
764 virtual bool isEmpty()
const;
767 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
783 kmime_mk_trivial_ctor_with_name(
From )
793 kmime_mk_trivial_ctor_with_name(
Sender )
803 kmime_mk_trivial_ctor_with_name(
To )
813 kmime_mk_trivial_ctor_with_name(
Cc )
823 kmime_mk_trivial_ctor_with_name(
Bcc )
833 kmime_mk_trivial_ctor_with_name(
ReplyTo )
837 class MailCopiesToPrivate;
850 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
851 virtual QString asUnicodeString()
const;
853 virtual void clear();
854 virtual bool isEmpty()
const;
859 bool alwaysCopy()
const;
864 void setAlwaysCopy();
869 bool neverCopy()
const;
877 virtual bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
883 class ContentTransferEncodingPrivate;
896 virtual void clear();
901 contentEncoding encoding()
const;
906 void setEncoding( contentEncoding e );
912 bool decoded()
const;
920 void setDecoded(
bool decoded =
true );
926 bool needToEncode()
const;
929 virtual bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
942 kmime_mk_trivial_ctor_with_name(
Keywords )
967 kmime_mk_trivial_ctor_with_name(
MessageID )
977 class ContentIDPrivate;
985 kmime_mk_trivial_ctor_with_name(
ContentID )
990 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
1000 kmime_mk_trivial_ctor_with_name(
Supersedes )
1010 kmime_mk_trivial_ctor_with_name(
InReplyTo )
1020 kmime_mk_trivial_ctor_with_name(
References )
1024 class ContentTypePrivate;
1037 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
1038 virtual void clear();
1039 virtual bool isEmpty()
const;
1061 void setMimeType(
const QByteArray &mimeType );
1066 bool isMediatype(
const char *mediatype )
const;
1071 bool isSubtype(
const char *subtype )
const;
1076 bool isText()
const;
1081 bool isPlainText()
const;
1086 bool isHTMLText()
const;
1091 bool isImage()
const;
1096 bool isMultipart()
const;
1102 bool isPartial()
const;
1148 int partialNumber()
const;
1154 int partialCount()
const;
1161 void setPartialParams(
int total,
int number );
1164 contentCategory category()
const;
1166 void setCategory( contentCategory c );
1169 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
1175 class ContentDispositionPrivate;
1188 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
1189 virtual bool isEmpty()
const;
1190 virtual void clear();
1195 contentDisposition disposition()
const;
1201 void setDisposition( contentDisposition disp );
1216 void setFilename(
const QString &filename );
1219 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF=
false );
1232 class GenericPrivate;
1249 virtual void clear();
1251 virtual bool isEmpty()
const;
1253 virtual const char *type()
const;
1255 void setType(
const char *type );
1269 kmime_mk_trivial_ctor_with_name(
Subject )
1272 bool isReply()
const;
1300 class ControlPrivate;
1310 kmime_mk_trivial_ctor_with_name(
Control )
1313 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
1314 virtual void clear();
1315 virtual bool isEmpty()
const;
1331 bool isCancel()
const;
1340 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF =
false );
1356 kmime_mk_trivial_ctor_with_name(
Date )
1359 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
1360 virtual void clear();
1361 virtual bool isEmpty()
const;
1366 KDateTime dateTime()
const;
1371 void setDateTime(
const KDateTime &dt );
1376 int ageInDays()
const;
1379 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF =
false );
1382 Q_DECLARE_PRIVATE(
Date )
1386 class NewsgroupsPrivate;
1396 kmime_mk_trivial_ctor_with_name(
Newsgroups )
1399 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
1401 virtual QString asUnicodeString()
const;
1402 virtual void clear();
1403 virtual bool isEmpty()
const;
1419 bool isCrossposted()
const;
1422 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF =
false );
1436 kmime_mk_trivial_ctor_with_name(
FollowUpTo )
1451 kmime_mk_trivial_ctor_with_name(
Lines )
1454 virtual QByteArray as7BitString(
bool withHeaderType =
true )
const;
1455 virtual QString asUnicodeString()
const;
1456 virtual void clear();
1457 virtual bool isEmpty()
const;
1462 int numberOfLines()
const;
1467 void setNumberOfLines(
int lines );
1470 bool parse(
const char* &scursor,
const char *
const send,
bool isCRLF =
false );
1473 Q_DECLARE_PRIVATE(
Lines )
1481 kmime_mk_trivial_ctor_with_name(
UserAgent )
1493 #undef kmime_mk_trivial_ctor
1494 #undef kmime_mk_dptr_ctor
1495 #undef kmime_mk_trivial_ctor_with_name
1497 #endif // __KMIME_HEADERS_H__
Represents an (email address, display name) pair according RFC 2822, section 3.4. ...
A class that encapsulates MIME encoded Content.