• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KMIME Library

  • kmime
kmime_util.h
1/* -*- c++ -*-
2 kmime_util.h
3
4 KMime, the KDE Internet mail/usenet news message library.
5 Copyright (c) 2001 the KMime authors.
6 See file AUTHORS for details
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22*/
23#ifndef __KMIME_UTIL_H__
24#define __KMIME_UTIL_H__
25
26#include <QtCore/QString>
27#include "kmime_export.h"
28#include "kmime_headers.h"
29#include "kmime_content.h"
30
31namespace KMime {
32
33class Message;
34
40KMIME_EXPORT extern QByteArray cachedCharset( const QByteArray &name );
41
47KMIME_EXPORT extern QByteArray cachedLanguage( const QByteArray &name );
48
53KMIME_EXPORT extern bool isUsAscii( const QString &s );
54
62KMIME_EXPORT extern QString nameForEncoding( KMime::Headers::contentEncoding enc );
63
69KMIME_EXPORT QList<KMime::Headers::contentEncoding> encodingsForData(
70 const QByteArray &data );
71//@cond PRIVATE
72extern const uchar specialsMap[16];
73extern const uchar tSpecialsMap[16];
74extern const uchar aTextMap[16];
75extern const uchar tTextMap[16];
76extern const uchar eTextMap[16];
77
78inline bool isOfSet( const uchar map[16], unsigned char ch )
79{
80 return ( ch < 128 ) && ( map[ ch/8 ] & 0x80 >> ch%8 );
81}
82inline bool isSpecial( char ch )
83{
84 return isOfSet( specialsMap, ch );
85}
86inline bool isTSpecial( char ch )
87{
88 return isOfSet( tSpecialsMap, ch );
89}
90inline bool isAText( char ch )
91{
92 return isOfSet( aTextMap, ch );
93}
94inline bool isTText( char ch )
95{
96 return isOfSet( tTextMap, ch );
97}
98inline bool isEText( char ch )
99{
100 return isOfSet( eTextMap, ch );
101}
102//@endcond
103
113KMIME_EXPORT extern void setFallbackCharEncoding( const QString& fallbackCharEnc );
114
123KMIME_EXPORT extern QString fallbackCharEncoding();
124
136KMIME_EXPORT extern void setUseOutlookAttachmentEncoding( bool violateStandard );
137
141KMIME_EXPORT extern bool useOutlookAttachmentEncoding();
154KMIME_EXPORT extern QString decodeRFC2047String(
155 const QByteArray &src, QByteArray &usedCS, const QByteArray &defaultCS = QByteArray(),
156 bool forceCS = false );
157
164KMIME_EXPORT extern QString decodeRFC2047String( const QByteArray &src );
165
183KMIME_EXPORT extern QByteArray encodeRFC2047String(
184 const QString &src, const QByteArray &charset, bool addressHeader=false,
185 bool allow8bitHeaders=false );
186
187
199KMIME_EXPORT extern QString decodeRFC2231String(
200 const QByteArray &src, QByteArray &usedCS, const QByteArray &defaultCS = QByteArray(),
201 bool forceCS = false );
202
209KMIME_EXPORT extern QString decodeRFC2231String( const QByteArray &src );
210
211
219KMIME_EXPORT extern QByteArray encodeRFC2231String( const QString &src, const QByteArray &charset );
220
229KMIME_EXPORT extern QByteArray uniqueString();
230
239KMIME_EXPORT extern QByteArray multiPartBoundary();
240
245KMIME_EXPORT extern QByteArray unfoldHeader( const QByteArray &header );
246
257KMIME_EXPORT extern QByteArray extractHeader( const QByteArray &src,
258 const QByteArray &name );
259
271KMIME_EXPORT extern QList<QByteArray> extractHeaders( const QByteArray &src,
272 const QByteArray &name );
273
286KMIME_EXPORT extern QByteArray CRLFtoLF( const QByteArray &s );
287
300KMIME_EXPORT extern QByteArray CRLFtoLF( const char *s );
301
315KMIME_EXPORT extern QByteArray LFtoCRLF( const QByteArray &s );
316
324//AK_REVIEW: add correctly spelled methods and deprecated the wrongly spelled
325// TODO: KDE5: BIC: rename to "removeQuotes"
326KMIME_EXPORT extern void removeQuots( QByteArray &str );
327
335//AK_REVIEW: add correctly spelled methods and deprecated the wrongly spelled
336// TODO: KDE5: BIC: rename to "removeQuotes"
337KMIME_EXPORT extern void removeQuots( QString &str );
338
346KMIME_EXPORT extern void addQuotes( QByteArray &str, bool forceQuotes );
347
354KMIME_EXPORT extern void addQuotes( QString &str, bool forceQuotes );
355
397KMIME_EXPORT QString balanceBidiState( const QString &input );
398
407KMIME_EXPORT QString removeBidiControlChars( const QString &input );
408
414KMIME_EXPORT bool hasAttachment( Content* content );
415
422KMIME_EXPORT bool hasInvitation( Content* content );
423
430KMIME_EXPORT bool isSigned( Message* message );
431
438KMIME_EXPORT bool isEncrypted( Message* message );
439
446KMIME_EXPORT bool isInvitation( Content* content );
447
448} // namespace KMime
449
450#endif /* __KMIME_UTIL_H__ */
kmime_content.h
This file is part of the API for handling MIME data and defines the Content class.
kmime_headers.h
This file is part of the API for handling MIME data and defines the various header classes:
KMime::Headers::contentEncoding
contentEncoding
Various possible values for the "Content-Transfer-Encoding" header.
Definition: kmime_headers.h:74
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMIME Library

Skip menu "KMIME Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal