29 #include "kmime_export.h"
30 #include "kmime_header_parsing.h"
33 #include <QStringList>
49 enum contentCategory {
80 #define kmime_mk_trivial_ctor( subclass ) \
85 #define kmime_mk_dptr_ctor( subclass ) \
87 explicit subclass( subclass##Private *d );
89 #define kmime_mk_trivial_ctor_with_name( subclass ) \
90 kmime_mk_trivial_ctor( subclass ) \
91 const char *type() const override; \
92 static const char *staticType();
125 virtual void from7BitString(
const char *s,
size_t len);
126 virtual void from7BitString(
const QByteArray &s) = 0;
132 Q_REQUIRED_RESULT
virtual QByteArray as7BitString(
bool withHeaderType =
true)
const = 0;
137 Q_REQUIRED_RESULT
QByteArray rfc2047Charset()
const;
159 virtual QString asUnicodeString()
const = 0;
164 virtual void clear() = 0;
169 virtual bool isEmpty()
const = 0;
174 virtual const char *type()
const;
179 Q_REQUIRED_RESULT
bool is(
const char *t)
const;
184 Q_REQUIRED_RESULT
bool isMimeHeader()
const;
194 kmime_mk_dptr_ctor(
Base)
198 Q_DECLARE_PRIVATE(
Base)
211 class UnstructuredPrivate;
236 void from7BitString(
const QByteArray &s)
override;
237 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
240 QString asUnicodeString()
const override;
242 void clear()
override;
244 bool isEmpty()
const override;
250 class StructuredPrivate;
288 void from7BitString(
const char *s,
size_t len)
override;
289 void from7BitString(
const QByteArray &s)
override;
290 QString asUnicodeString()
const override;
302 virtual bool parse(
const char *&scursor,
const char *
const send,
303 bool isCRLF =
false) = 0;
313 class AddressPrivate;
331 class MailboxListPrivate;
346 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
348 QString asUnicodeString()
const override;
350 void clear()
override;
351 bool isEmpty()
const override;
393 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
399 class SingleMailboxPrivate;
411 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
416 class AddressListPrivate;
436 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
438 QString asUnicodeString()
const override;
440 void clear()
override;
441 bool isEmpty()
const override;
481 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
497 kmime_mk_trivial_ctor(
Ident)
498 kmime_mk_dptr_ctor(
Ident)
501 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
502 void clear()
override;
503 bool isEmpty()
const override;
508 void fromIdent(
const Ident* ident);
525 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
528 Q_DECLARE_PRIVATE(
Ident)
531 class SingleIdentPrivate;
558 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
572 kmime_mk_trivial_ctor(
Token)
573 kmime_mk_dptr_ctor(
Token)
576 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
577 void clear()
override;
578 bool isEmpty()
const override;
591 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
594 Q_DECLARE_PRIVATE(
Token)
597 class PhraseListPrivate;
608 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
609 QString asUnicodeString()
const override;
610 void clear()
override;
611 bool isEmpty()
const override;
619 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
625 class DotAtomPrivate;
636 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
637 QString asUnicodeString()
const override;
638 void clear()
override;
639 bool isEmpty()
const override;
642 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
648 class ParametrizedPrivate;
660 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
662 bool isEmpty()
const override;
663 void clear()
override;
679 bool hasParameter(
const QString &key)
const;
689 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
703 class ReturnPathPrivate;
716 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
717 void clear()
override;
718 bool isEmpty()
const override;
721 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
737 kmime_mk_trivial_ctor_with_name(
From)
747 kmime_mk_trivial_ctor_with_name(
Sender)
757 kmime_mk_trivial_ctor_with_name(
To)
767 kmime_mk_trivial_ctor_with_name(
Cc)
777 kmime_mk_trivial_ctor_with_name(
Bcc)
787 kmime_mk_trivial_ctor_with_name(
ReplyTo)
790 class MailCopiesToPrivate;
803 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
804 QString asUnicodeString()
const override;
806 void clear()
override;
807 bool isEmpty()
const override;
812 bool alwaysCopy()
const;
817 void setAlwaysCopy();
822 bool neverCopy()
const;
830 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
836 class ContentTransferEncodingPrivate;
849 void clear()
override;
864 bool isDecoded()
const;
872 void setDecoded(
bool isDecoded =
true);
878 bool needToEncode()
const;
881 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
894 kmime_mk_trivial_ctor_with_name(
Keywords)
919 kmime_mk_trivial_ctor_with_name(
MessageID)
929 class ContentIDPrivate;
937 kmime_mk_trivial_ctor_with_name(
ContentID)
942 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
962 kmime_mk_trivial_ctor_with_name(
InReplyTo)
975 class ContentTypePrivate;
988 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
989 void clear()
override;
990 bool isEmpty()
const override;
1012 void setMimeType(
const QByteArray &mimeType);
1017 bool isMediatype(
const char *mediatype)
const;
1022 bool isSubtype(
const char *subtype)
const;
1027 bool isMimeType(
const char *mimeType)
const;
1032 bool isText()
const;
1037 bool isPlainText()
const;
1042 bool isHTMLText()
const;
1047 bool isImage()
const;
1052 bool isMultipart()
const;
1058 bool isPartial()
const;
1104 int partialNumber()
const;
1110 int partialCount()
const;
1117 void setPartialParams(
int total,
int number);
1120 contentCategory category()
const;
1122 void setCategory(contentCategory c);
1125 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
1131 class ContentDispositionPrivate;
1144 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
1145 bool isEmpty()
const override;
1146 void clear()
override;
1172 void setFilename(
const QString &filename);
1175 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
1187 class GenericPrivate;
1198 Generic(
const char *t,
int len = -1);
1201 void clear()
override;
1203 bool isEmpty()
const override;
1205 const char *type()
const override;
1207 void setType(
const char *type,
int len = -1);
1221 kmime_mk_trivial_ctor_with_name(
Subject)
1250 class ControlPrivate;
1260 kmime_mk_trivial_ctor_with_name(
Control)
1263 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
1264 void clear()
override;
1265 bool isEmpty()
const override;
1281 bool isCancel()
const;
1290 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
1306 kmime_mk_trivial_ctor_with_name(
Date)
1309 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
1310 void clear()
override;
1311 bool isEmpty()
const override;
1326 int ageInDays()
const;
1329 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
1332 Q_DECLARE_PRIVATE(
Date)
1335 class NewsgroupsPrivate;
1348 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
1350 QString asUnicodeString()
const override;
1351 void clear()
override;
1352 bool isEmpty()
const override;
1368 bool isCrossposted()
const;
1371 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
1399 kmime_mk_trivial_ctor_with_name(
Lines)
1402 QByteArray as7BitString(
bool withHeaderType =
true)
const override;
1403 QString asUnicodeString()
const override;
1404 void clear()
override;
1405 bool isEmpty()
const override;
1410 int numberOfLines()
const;
1415 void setNumberOfLines(
int lines);
1418 bool parse(
const char *&scursor,
const char *
const send,
bool isCRLF =
false)
override;
1421 Q_DECLARE_PRIVATE(
Lines)
1429 kmime_mk_trivial_ctor_with_name(
UserAgent)
1441 #undef kmime_mk_trivial_ctor
1442 #undef kmime_mk_dptr_ctor
1443 #undef kmime_mk_trivial_ctor_with_name