12#include "kmime_export.h"
13#include "kmime_types.h"
20template <
typename K,
typename V>
class QMap;
36namespace HeaderParsing
53[[nodiscard]] KMIME_EXPORT
bool
54parseEncodedWord(
const char *&scursor,
const char *
const send,
QString &result,
65[[nodiscard]] KMIME_EXPORT
bool parseAtom(
const char *&scursor,
66 const char *
const send,
68 bool allow8Bit =
false);
73[[nodiscard]] KMIME_EXPORT
bool parseAtom(
const char *&scursor,
74 const char *
const send,
75 QPair<const char *, int> &result,
76 bool allow8Bit =
false);
80 ParseTokenAllow8Bit = 1,
81 ParseTokenRelaxedTText = 2
83Q_DECLARE_FLAGS(ParseTokenFlags, ParseTokenFlag)
87[[nodiscard]] KMIME_EXPORT
bool
88parseToken(
const char *&scursor,
const char *
const send,
QByteArray &result,
89 ParseTokenFlags flags = ParseTokenNoFlag);
91[[nodiscard]] KMIME_EXPORT
bool
92parseToken(
const char *&scursor,
const char *
const send,
93 QPair<const char *, int> &result,
94 ParseTokenFlags flags = ParseTokenNoFlag);
97[[nodiscard]] KMIME_EXPORT
bool
98parseGenericQuotedString(
const char *&scursor,
const char *
const send,
100 const char openChar =
'"',
const char closeChar =
'"');
103[[nodiscard]] KMIME_EXPORT
bool
104parseComment(
const char *&scursor,
const char *
const send,
QString &result,
105 bool isCRLF =
false,
bool reallySave =
true);
122[[nodiscard]] KMIME_EXPORT
bool parsePhrase(
const char *&scursor,
123 const char *
const send,
125 bool isCRLF =
false);
139[[nodiscard]] KMIME_EXPORT
bool parseDotAtom(
const char *&scursor,
140 const char *
const send,
142 bool isCRLF =
false);
158KMIME_EXPORT
void eatCFWS(
const char *&scursor,
const char *
const send,
161[[nodiscard]] KMIME_EXPORT
bool parseDomain(
const char *&scursor,
162 const char *
const send,
164 bool isCRLF =
false);
166[[nodiscard]] KMIME_EXPORT
bool
167parseObsRoute(
const char *&scursor,
const char *
const send,
QStringList &result,
168 bool isCRLF =
false,
bool save =
false);
170[[nodiscard]] KMIME_EXPORT
bool parseAddrSpec(
const char *&scursor,
171 const char *
const send,
172 Types::AddrSpec &result,
173 bool isCRLF =
false);
175[[nodiscard]] KMIME_EXPORT
bool parseAngleAddr(
const char *&scursor,
176 const char *
const send,
177 Types::AddrSpec &result,
178 bool isCRLF =
false);
196KMIME_EXPORT
bool parseMailbox(
const char *&scursor,
const char *
const send,
197 Types::Mailbox &result,
bool isCRLF =
false);
199[[nodiscard]] KMIME_EXPORT
bool parseGroup(
const char *&scursor,
200 const char *
const send,
201 Types::Address &result,
202 bool isCRLF =
false);
204[[nodiscard]] KMIME_EXPORT
bool parseAddress(
const char *&scursor,
205 const char *
const send,
206 Types::Address &result,
207 bool isCRLF =
false);
209[[nodiscard]] KMIME_EXPORT
bool parseAddressList(
const char *&scursor,
210 const char *
const send,
211 Types::AddressList &result,
212 bool isCRLF =
false);
214[[nodiscard]] KMIME_EXPORT
bool
215parseParameterList(
const char *&scursor,
const char *
const send,
223[[nodiscard]] KMIME_EXPORT
bool
224parseParameterListWithCharset(
const char *&scursor,
const char *
const send,
235[[nodiscard]] KMIME_EXPORT
int parseDigits(
const char *&scursor,
236 const char *
const send,
int &result);
238[[nodiscard]] KMIME_EXPORT
bool
239parseTime(
const char *&scursor,
const char *
const send,
int &hour,
int &min,
240 int &sec,
long int &secsEastOfGMT,
bool &timeZoneKnown,
241 bool isCRLF =
false);
243[[nodiscard]] KMIME_EXPORT
bool parseDateTime(
const char *&scursor,
244 const char *
const send,
246 bool isCRLF =
false);
247[[nodiscard]] KMIME_EXPORT
bool parseQDateTime(
const char *&scursor,
248 const char *
const send,
250 bool isCRLF =
false);
258[[nodiscard]] KMIME_EXPORT std::unique_ptr<KMime::Headers::Base> parseNextHeader(
QByteArrayView &head);
270KMIME_EXPORT
void extractHeaderAndBody(
const QByteArray &content,