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:781
Represents a "Cc" header.
Definition headers.h:771
Represents a "Content-Description" header.
Definition headers.h:1220
Represents a "Content-Disposition" header.
Definition headers.h:1125
Represents a "Content-ID" header.
Definition headers.h:921
Represents a "Content-Location" header.
Definition headers.h:1229
Represents a "Content-Transfer-Encoding" header.
Definition headers.h:848
Represents a "Content-Type" header.
Definition headers.h:969
Represents a "Control" header.
Definition headers.h:1241
Represents a "Date" header.
Definition headers.h:1286
Represents a "Followup-To" header.
Definition headers.h:1359
Represent a "From" header.
Definition headers.h:741
Represents a "In-Reply-To" header.
Definition headers.h:947
Represents a "Keywords" header.
Definition headers.h:879
Represents a "Lines" header.
Definition headers.h:1373
Represents a "MIME-Version" header.
Definition headers.h:891
Represents a "Mail-Copies-To" header.
Definition headers.h:803
Represents a "Message-ID" header.
Definition headers.h:903
Represents a "Newsgroups" header.
Definition headers.h:1319
Represents a "Organization" header.
Definition headers.h:1212
Represents a "References" header.
Definition headers.h:957
Represents a "ReplyTo" header.
Definition headers.h:791
Represents the Return-Path header field.
Definition headers.h:717
Represents a "Sender" header.
Definition headers.h:751
Represents a "Subject" header.
Definition headers.h:1202
Represents a "Supersedes" header.
Definition headers.h:937
Represents a "To" header.
Definition headers.h:761
Represents a "User-Agent" header.
Definition headers.h:1403
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 Mon Nov 18 2024 12:18:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.