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

KMIME Library

  • sources
  • kde-4.12
  • kdepimlibs
  • 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 
31 namespace KMime {
32 
33 class Message;
34 
40 KMIME_EXPORT extern QByteArray cachedCharset( const QByteArray &name );
41 
47 KMIME_EXPORT extern QByteArray cachedLanguage( const QByteArray &name );
48 
53 KMIME_EXPORT extern bool isUsAscii( const QString &s );
54 
62 KMIME_EXPORT extern QString nameForEncoding( KMime::Headers::contentEncoding enc );
63 
69 KMIME_EXPORT QList<KMime::Headers::contentEncoding> encodingsForData(
70  const QByteArray &data );
71 //@cond PRIVATE
72 extern const uchar specialsMap[16];
73 extern const uchar tSpecialsMap[16];
74 extern const uchar aTextMap[16];
75 extern const uchar tTextMap[16];
76 extern const uchar eTextMap[16];
77 
78 inline bool isOfSet( const uchar map[16], unsigned char ch )
79 {
80  return ( ch < 128 ) && ( map[ ch/8 ] & 0x80 >> ch%8 );
81 }
82 inline bool isSpecial( char ch )
83 {
84  return isOfSet( specialsMap, ch );
85 }
86 inline bool isTSpecial( char ch )
87 {
88  return isOfSet( tSpecialsMap, ch );
89 }
90 inline bool isAText( char ch )
91 {
92  return isOfSet( aTextMap, ch );
93 }
94 inline bool isTText( char ch )
95 {
96  return isOfSet( tTextMap, ch );
97 }
98 inline bool isEText( char ch )
99 {
100  return isOfSet( eTextMap, ch );
101 }
102 //@endcond
103 
113 KMIME_EXPORT extern void setFallbackCharEncoding( const QString& fallbackCharEnc );
114 
123 KMIME_EXPORT extern QString fallbackCharEncoding();
124 
136 KMIME_EXPORT extern void setUseOutlookAttachmentEncoding( bool violateStandard );
137 
141 KMIME_EXPORT extern bool useOutlookAttachmentEncoding();
154 KMIME_EXPORT extern QString decodeRFC2047String(
155  const QByteArray &src, QByteArray &usedCS, const QByteArray &defaultCS = QByteArray(),
156  bool forceCS = false );
157 
164 KMIME_EXPORT extern QString decodeRFC2047String( const QByteArray &src );
165 
183 KMIME_EXPORT extern QByteArray encodeRFC2047String(
184  const QString &src, const QByteArray &charset, bool addressHeader=false,
185  bool allow8bitHeaders=false );
186 
187 
199 KMIME_EXPORT extern QString decodeRFC2231String(
200  const QByteArray &src, QByteArray &usedCS, const QByteArray &defaultCS = QByteArray(),
201  bool forceCS = false );
202 
209 KMIME_EXPORT extern QString decodeRFC2231String( const QByteArray &src );
210 
211 
219 KMIME_EXPORT extern QByteArray encodeRFC2231String( const QString &src, const QByteArray &charset );
220 
229 KMIME_EXPORT extern QByteArray uniqueString();
230 
239 KMIME_EXPORT extern QByteArray multiPartBoundary();
240 
245 KMIME_EXPORT extern QByteArray unfoldHeader( const QByteArray &header );
246 
257 KMIME_EXPORT extern QByteArray extractHeader( const QByteArray &src,
258  const QByteArray &name );
259 
271 KMIME_EXPORT extern QList<QByteArray> extractHeaders( const QByteArray &src,
272  const QByteArray &name );
273 
286 KMIME_EXPORT extern QByteArray CRLFtoLF( const QByteArray &s );
287 
300 KMIME_EXPORT extern QByteArray CRLFtoLF( const char *s );
301 
315 KMIME_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"
326 KMIME_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"
337 KMIME_EXPORT extern void removeQuots( QString &str );
338 
346 KMIME_EXPORT extern void addQuotes( QByteArray &str, bool forceQuotes );
347 
354 KMIME_EXPORT extern void addQuotes( QString &str, bool forceQuotes );
355 
397 KMIME_EXPORT QString balanceBidiState( const QString &input );
398 
407 KMIME_EXPORT QString removeBidiControlChars( const QString &input );
408 
414 KMIME_EXPORT bool hasAttachment( Content* content );
415 
422 KMIME_EXPORT bool isSigned( Message* message );
423 
430 KMIME_EXPORT bool isEncrypted( Message* message );
431 
438 KMIME_EXPORT bool isInvitation( Content* content );
439 
440 } // namespace KMime
441 
442 #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: ...
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:11 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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