KMime

headerfactory.cpp
Go to the documentation of this file.
1/*
2 kmime_header_factory.cpp
3
4 KMime, the KDE Internet mail/usenet news message library.
5 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10/**
11 @file
12 This file is part of the API for handling MIME data and
13 defines the HeaderFactory class.
14
15 @brief
16 Defines the HeaderFactory class.
17
18 @authors Constantin Berzan <exit3219@gmail.com>
19*/
20
21#include "headerfactory_p.h"
22#include "headers.h"
23
24#include <algorithm>
25
26using namespace KMime;
27using namespace KMime::Headers;
28
29#define mk_header(hdr) \
30 if (type.compare(hdr::staticType(), Qt::CaseInsensitive) == 0) \
31 return new hdr;
32
33Headers::Base *HeaderFactory::createHeader(QByteArrayView type)
34{
35 Q_ASSERT(!type.isEmpty());
36 switch (type[0]) {
37 case 'b':
38 case 'B':
39 mk_header(Bcc);
40 break;
41 case 'c':
42 case 'C':
43 mk_header(Cc);
44 mk_header(ContentDescription);
45 mk_header(ContentDisposition);
46 mk_header(ContentID);
47 mk_header(ContentLocation);
48 mk_header(ContentTransferEncoding);
49 mk_header(ContentType);
50 mk_header(Control);
51 break;
52 case 'd':
53 case 'D':
54 mk_header(Date);
55 break;
56 case 'f':
57 case 'F':
58 mk_header(FollowUpTo);
59 mk_header(From);
60 break;
61 case 'i':
62 case 'I':
63 mk_header(InReplyTo);
64 break;
65 case 'k':
66 case 'K':
67 mk_header(Keywords);
68 break;
69 case 'l':
70 case 'L':
71 mk_header(Lines);
72 break;
73 case 'm':
74 case 'M':
75 mk_header(MailCopiesTo);
76 mk_header(MessageID);
77 mk_header(MIMEVersion);
78 break;
79 case 'n':
80 case 'N':
81 mk_header(Newsgroups);
82 break;
83 case 'o':
84 case 'O':
85 mk_header(Organization);
86 break;
87 case 'r':
88 case 'R':
89 mk_header(References);
90 mk_header(ReplyTo);
91 mk_header(ReturnPath);
92 break;
93 case 's':
94 case 'S':
95 mk_header(Sender);
96 mk_header(Subject);
97 mk_header(Supersedes);
98 break;
99 case 't':
100 case 'T':
101 mk_header(To);
102 break;
103 case 'u':
104 case 'U':
105 mk_header(UserAgent);
106 break;
107 }
108 return nullptr;
109}
110
111#undef mk_header
Baseclass of all header-classes.
Definition headers.h:97
Represents a "Bcc" header.
Definition headers.h:801
Represents a "Cc" header.
Definition headers.h:791
Represents a "Content-Description" header.
Definition headers.h:1240
Represents a "Content-Disposition" header.
Definition headers.h:1145
Represents a "Content-ID" header.
Definition headers.h:941
Represents a "Content-Location" header.
Definition headers.h:1249
Represents a "Content-Transfer-Encoding" header.
Definition headers.h:868
Represents a "Content-Type" header.
Definition headers.h:989
Represents a "Control" header.
Definition headers.h:1261
Represents a "Date" header.
Definition headers.h:1306
Represents a "Followup-To" header.
Definition headers.h:1379
Represent a "From" header.
Definition headers.h:761
Represents a "In-Reply-To" header.
Definition headers.h:967
Represents a "Keywords" header.
Definition headers.h:899
Represents a "Lines" header.
Definition headers.h:1393
Represents a "MIME-Version" header.
Definition headers.h:911
Represents a "Mail-Copies-To" header.
Definition headers.h:823
Represents a "Message-ID" header.
Definition headers.h:923
Represents a "Newsgroups" header.
Definition headers.h:1339
Represents a "Organization" header.
Definition headers.h:1232
Represents a "References" header.
Definition headers.h:977
Represents a "ReplyTo" header.
Definition headers.h:811
Represents the Return-Path header field.
Definition headers.h:737
Represents a "Sender" header.
Definition headers.h:771
Represents a "Subject" header.
Definition headers.h:1222
Represents a "Supersedes" header.
Definition headers.h:957
Represents a "To" header.
Definition headers.h:781
Represents a "User-Agent" header.
Definition headers.h:1423
This file is part of the API for handling MIME data and defines the various header classes:
Type type(const QSqlDatabase &db)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.