• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KMIME Library

kmime_parsers.h

00001 /*
00002     kmime_parsers.h
00003 
00004     KMime, the KDE internet mail/usenet news message library.
00005     Copyright (c) 2001 the KMime authors.
00006     See file AUTHORS for details
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, USA.
00022 */
00023 #ifndef __KMIME_PARSERS__
00024 #define __KMIME_PARSERS__
00025 
00026 #include<QByteArray>
00027 #include<QList>
00028 
00029 namespace KMime {
00030 
00031 namespace Parser {
00032 
00037 class MultiPart
00038 {
00039   public:
00040     MultiPart( const QByteArray &src, const QByteArray &boundary );
00041     ~MultiPart() {}
00042 
00043     bool parse();
00044     QList<QByteArray> parts()
00045       { return p_arts; }
00046     QByteArray preamble()
00047       { return p_reamble; }
00048     QByteArray epilouge()
00049       { return e_pilouge; }
00050 
00051   protected:
00052     QByteArray s_rc, b_oundary, p_reamble, e_pilouge;
00053     QList<QByteArray> p_arts;
00054 };
00055 
00060 class NonMimeParser
00061 {
00062   public:
00063     NonMimeParser( const QByteArray &src );
00064     virtual ~NonMimeParser() {}
00065     virtual bool parse() = 0;
00066     bool isPartial()
00067     {
00068       return ( p_artNr > -1 && t_otalNr > -1 && t_otalNr != 1 );
00069     }
00070     int partialNumber()
00071       { return p_artNr; }
00072     int partialCount()
00073       { return t_otalNr; }
00074     bool hasTextPart()
00075       { return ( t_ext.length() > 1 ); }
00076     QByteArray textPart()
00077       { return t_ext; }
00078     QList<QByteArray> binaryParts()
00079       { return b_ins; }
00080     QList<QByteArray> filenames()
00081       { return f_ilenames; }
00082     QList<QByteArray> mimeTypes()
00083       { return m_imeTypes; }
00084 
00085   protected:
00086     static QByteArray guessMimeType( const QByteArray &fileName );
00087 
00088     QByteArray s_rc, t_ext;
00089     QList<QByteArray> b_ins, f_ilenames, m_imeTypes;
00090     int p_artNr, t_otalNr;
00091 };
00092 
00097 class UUEncoded : public NonMimeParser
00098 {
00099   public:
00100     UUEncoded( const QByteArray &src, const QByteArray &subject );
00101 
00102     virtual bool parse();
00103 
00104   protected:
00105     QByteArray s_ubject;
00106 };
00107 
00112 class YENCEncoded : public NonMimeParser
00113 {
00114   public:
00115     YENCEncoded( const QByteArray &src );
00116 
00117     virtual bool parse();
00118     QList<QByteArray> binaryParts()
00119       { return b_ins; }
00120 
00121   protected:
00122     QList<QByteArray> b_ins;
00123     static bool yencMeta( QByteArray &src, const QByteArray &name, int *value );
00124 };
00125 
00126 } // namespace Parser
00127 
00128 } // namespace KMime
00129 
00130 #endif // __KMIME_PARSERS__

KMIME Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal