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:796
Represents a "Cc" header.
Definition headers.h:786
Represents a "Content-Description" header.
Definition headers.h:1235
Represents a "Content-Disposition" header.
Definition headers.h:1140
Represents a "Content-ID" header.
Definition headers.h:936
Represents a "Content-Location" header.
Definition headers.h:1244
Represents a "Content-Transfer-Encoding" header.
Definition headers.h:863
Represents a "Content-Type" header.
Definition headers.h:984
Represents a "Control" header.
Definition headers.h:1256
Represents a "Date" header.
Definition headers.h:1301
Represents a "Followup-To" header.
Definition headers.h:1374
Represent a "From" header.
Definition headers.h:756
Represents a "In-Reply-To" header.
Definition headers.h:962
Represents a "Keywords" header.
Definition headers.h:894
Represents a "Lines" header.
Definition headers.h:1388
Represents a "MIME-Version" header.
Definition headers.h:906
Represents a "Mail-Copies-To" header.
Definition headers.h:818
Represents a "Message-ID" header.
Definition headers.h:918
Represents a "Newsgroups" header.
Definition headers.h:1334
Represents a "Organization" header.
Definition headers.h:1227
Represents a "References" header.
Definition headers.h:972
Represents a "ReplyTo" header.
Definition headers.h:806
Represents the Return-Path header field.
Definition headers.h:732
Represents a "Sender" header.
Definition headers.h:766
Represents a "Subject" header.
Definition headers.h:1217
Represents a "Supersedes" header.
Definition headers.h:952
Represents a "To" header.
Definition headers.h:776
Represents a "User-Agent" header.
Definition headers.h:1418
This file is part of the API for handling MIME data and defines the various header classes:
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:30:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.