1/**********************************************************************
2 *
3 * rfccodecs - handler for various rfc/mime encodings
4 * Copyright (C) 2000 s.carstens@gmx.de
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 *********************************************************************/
22/**
23 * @file
24 * This file is part of the IMAP support library and defines the
25 * RfcCodecs class.
26 *
27 * @brief
28 * Provides handlers for various RFC/MIME encodings.
29 *
30 * @author Sven Carstens
31 */
32
33#ifndef KIMAP_RFCCODECS_H
34#define KIMAP_RFCCODECS_H
35
36#include <QtCore/QString>
37
38#include "kimap_export.h"
39
40class QTextCodec;
41
42namespace KIMAP {
43
44 /**
45 Converts an Unicode IMAP mailbox to a QByteArray which can be used in
46 IMAP communication.
47 @param src is the QByteArray containing the IMAP mailbox.
48 @since 4.3
49 */
50 KIMAP_EXPORT QByteArray encodeImapFolderName( const QByteArray &src );
51
52 /**
53 Converts an UTF-7 encoded IMAP mailbox to a QByteArray
54 @param inSrc is the QByteArray containing the Unicode path.
55 @since 4.3
56 */
57 KIMAP_EXPORT QByteArray decodeImapFolderName( const QByteArray &inSrc );
58 /**
59 Converts an Unicode IMAP mailbox to a QString which can be used in
60 IMAP communication.
61 @param src is the QString containing the IMAP mailbox.
62 */
63 KIMAP_EXPORT QString encodeImapFolderName( const QString &src );
64
65 /**
66 Converts an UTF-7 encoded IMAP mailbox to a Unicode QString.
67 @param inSrc is the QString containing the Unicode path.
68 */
69 KIMAP_EXPORT QString decodeImapFolderName( const QString &inSrc );
70
71 /**
72 Replaces " with \" and \ with \\ " and \ characters.
73 @param src is the QString to quote.
74 */
75 KIMAP_EXPORT QString quoteIMAP( const QString &src );
76
77 /**
78 Replaces " with \" and \ with \\ " and \ characters.
79 @param src is the QString to quote.
80 @since 4.3
81 */
82 KIMAP_EXPORT QByteArray quoteIMAP( const QByteArray &src );
83
84 /**
85 Fetches a Codec by @p name.
86 @param name is the QString version of the Codec name.
87 @return Text Codec object
88 */
89 KIMAP_EXPORT QTextCodec *codecForName( const QString &name );
90
91 /**
92 Decodes a RFC2047 string @p str.
93 @param str is the QString to decode.
94 @param charset is the character set to use when decoding.
95 @param language is the language found in the charset.
96 */
97 KIMAP_EXPORT const QString decodeRFC2047String( const QString &str,
98 QString &charset,
99 QString &language );
100 /**
101 Decodes a RFC2047 string @p str.
102 @param str is the QString to decode.
103 @param charset is the character set to use when decoding.
104 */
105 KIMAP_EXPORT const QString decodeRFC2047String( const QString &str,
106 QString &charset );
107
108 /**
109 Decodes a RFC2047 string @p str.
110 @param str is the QString to decode.
111 */
112 KIMAP_EXPORT const QString decodeRFC2047String( const QString &str );
113
114 /**
115 Encodes a RFC2047 string @p str.
116 @param str is the QString to encode.
117 */
118 KIMAP_EXPORT const QString encodeRFC2047String( const QString &str );
119
120 /**
121 Encodes a RFC2047 string @p str.
122 @param str is the QString to encode.
123 */
124 KIMAP_EXPORT const QByteArray encodeRFC2047String( const QByteArray &str );
125
126 /**
127 Encodes a RFC2231 string @p str.
128 @param str is the QString to encode.
129 */
130 KIMAP_EXPORT const QString encodeRFC2231String( const QString &str );
131
132 /**
133 Decodes a RFC2231 string @p str.
134 @param str is the QString to decode.
135 */
136 KIMAP_EXPORT const QString decodeRFC2231String( const QString &str );
137}
138
139#endif
140