• 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.14
  • kdepimlibs
  • kmime
kmime_parsers.h
1 /*
2  kmime_parsers.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_PARSERS__
24 #define __KMIME_PARSERS__
25 
26 #include<QByteArray>
27 #include<QList>
28 
29 namespace KMime {
30 
31 namespace Parser {
32 
37 class MultiPart
38 {
39  public:
40  MultiPart( const QByteArray &src, const QByteArray &boundary );
41  ~MultiPart() {}
42 
43  bool parse();
44  QList<QByteArray> parts()
45  { return p_arts; }
46  QByteArray preamble()
47  { return p_reamble; }
48  QByteArray epilouge()
49  { return e_pilouge; }
50 
51  protected:
52  QByteArray s_rc, b_oundary, p_reamble, e_pilouge;
53  QList<QByteArray> p_arts;
54 };
55 
60 class NonMimeParser
61 {
62  public:
63  explicit NonMimeParser( const QByteArray &src );
64  virtual ~NonMimeParser() {}
65  virtual bool parse() = 0;
66  bool isPartial()
67  {
68  return ( p_artNr > -1 && t_otalNr > -1 && t_otalNr != 1 );
69  }
70  int partialNumber()
71  { return p_artNr; }
72  int partialCount()
73  { return t_otalNr; }
74  bool hasTextPart()
75  { return ( t_ext.length() > 1 ); }
76  QByteArray textPart()
77  { return t_ext; }
78  QList<QByteArray> binaryParts()
79  { return b_ins; }
80  QList<QByteArray> filenames()
81  { return f_ilenames; }
82  QList<QByteArray> mimeTypes()
83  { return m_imeTypes; }
84 
85  protected:
86  static QByteArray guessMimeType( const QByteArray &fileName );
87 
88  QByteArray s_rc, t_ext;
89  QList<QByteArray> b_ins, f_ilenames, m_imeTypes;
90  int p_artNr, t_otalNr;
91 };
92 
97 class UUEncoded : public NonMimeParser
98 {
99  public:
100  UUEncoded( const QByteArray &src, const QByteArray &subject );
101 
102  virtual bool parse();
103 
104  protected:
105  QByteArray s_ubject;
106 };
107 
112 class YENCEncoded : public NonMimeParser
113 {
114  public:
115  explicit YENCEncoded( const QByteArray &src );
116 
117  virtual bool parse();
118  QList<QByteArray> binaryParts()
119  { return b_ins; }
120 
121  protected:
122  QList<QByteArray> b_ins;
123  static bool yencMeta( QByteArray &src, const QByteArray &name, int *value );
124 };
125 
126 } // namespace Parser
127 
128 } // namespace KMime
129 
130 #endif // __KMIME_PARSERS__
QByteArray
KMime::Parser::UUEncoded
Helper-class: tries to extract the data from a possibly uuencoded message.
Definition: kmime_parsers.h:97
QByteArray::length
int length() const
KMime::Parser::MultiPart
Helper-class: splits a multipart-message into single parts as described in RFC 2046.
Definition: kmime_parsers.h:37
QList< QByteArray >
KMime::Parser::NonMimeParser::guessMimeType
static QByteArray guessMimeType(const QByteArray &fileName)
try to guess the mimetype from the file-extension
Definition: kmime_parsers.cpp:119
KMime::Parser::YENCEncoded
Helper-class: tries to extract the data from a possibly yenc encoded message.
Definition: kmime_parsers.h:112
KMime::Parser::NonMimeParser
Helper-class: abstract base class of all parsers for non-mime binary data (uuencoded, yenc)
Definition: kmime_parsers.h:60
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:18 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
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

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