1/*
2 Copyright (c) 2007 Volker Krause <vkrause@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef KMIME_UTIL_P_H
21#define KMIME_UTIL_P_H
22
23// @cond PRIVATE
24
25/* Internal helper functions. Not part of the public API. */
26
27namespace KMime {
28
29/**
30 Finds the header end in @p src. Aligns the @p dataBegin if needed.
31 @param dataBegin beginning of the data part of the header
32 @param folded true if the headder is folded into multiple lines
33 @returns the end index of the header, -1 if the @p dataBegin was -1.
34*/
35extern int findHeaderLineEnd( const QByteArray &src, int &dataBegin, bool *folded = 0 );
36
37/**
38 Finds the first header of type @p name in @p src.
39 @param end The end index of the header.
40 @param dataBegin begin of the data part of the header, -1 if not found.
41 @param folded true if the headder is folded into multiple lines
42 @returns the begin index of the header, -1 if not found.
43*/
44extern int indexOfHeader( const QByteArray &src, const QByteArray &name, int &end, int &dataBegin, bool *folded = 0 );
45
46/**
47 Removes the first occurrence of the @p name from @p head.
48*/
49// This is used in zero places at the moment.
50extern void removeHeader( QByteArray &head, const QByteArray &name );
51
52/**
53 * Same as encodeRFC2047String(), but with a crucial difference: Instead of encoding the complete
54 * string as a single encoded word, the string will be split up at control characters, and only parts of
55 * the sentence that really need to be encoded will be encoded.
56 */
57extern QByteArray encodeRFC2047Sentence( const QString &src, const QByteArray &charset );
58
59}
60
61// @endcond
62
63#endif
64