• Skip to content
  • Skip to link menu
KDE 4.5 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<QtCore/QByteArray>
00027 #include<QtCore/QList>
00028 #include<QtCore/QRegExp>
00029 
00030 namespace KMime {
00031 
00032 namespace Parser {
00033 
00038 class MultiPart
00039 {
00040   public:
00041     MultiPart( const QByteArray &src, const QByteArray &boundary );
00042     ~MultiPart() {}
00043 
00044     bool parse();
00045     QList<QByteArray> parts()
00046       { return p_arts; }
00047     QByteArray preamble()
00048       { return p_reamble; }
00049     QByteArray epilouge()
00050       { return e_pilouge; }
00051 
00052   protected:
00053     QByteArray s_rc, b_oundary, p_reamble, e_pilouge;
00054     QList<QByteArray> p_arts;
00055 };
00056 
00061 class NonMimeParser
00062 {
00063   public:
00064     NonMimeParser( const QByteArray &src );
00065     virtual ~NonMimeParser() {}
00066     virtual bool parse() = 0;
00067     bool isPartial()
00068     {
00069       return ( p_artNr > -1 && t_otalNr > -1 && t_otalNr != 1 );
00070     }
00071     int partialNumber()
00072       { return p_artNr; }
00073     int partialCount()
00074       { return t_otalNr; }
00075     bool hasTextPart()
00076       { return ( t_ext.length() > 1 ); }
00077     QByteArray textPart()
00078       { return t_ext; }
00079     QList<QByteArray> binaryParts()
00080       { return b_ins; }
00081     QList<QByteArray> filenames()
00082       { return f_ilenames; }
00083     QList<QByteArray> mimeTypes()
00084       { return m_imeTypes; }
00085 
00086   protected:
00087     static QByteArray guessMimeType( const QByteArray &fileName );
00088 
00089     QByteArray s_rc, t_ext;
00090     QList<QByteArray> b_ins, f_ilenames, m_imeTypes;
00091     int p_artNr, t_otalNr;
00092 };
00093 
00098 class UUEncoded : public NonMimeParser
00099 {
00100   public:
00101     UUEncoded( const QByteArray &src, const QByteArray &subject );
00102 
00103     virtual bool parse();
00104 
00105   protected:
00106     QByteArray s_ubject;
00107 
00108   private:
00109     QRegExp m_beginRegExp;
00110     QRegExp m_numberRegExp;
00111 };
00112 
00117 class YENCEncoded : public NonMimeParser
00118 {
00119   public:
00120     YENCEncoded( const QByteArray &src );
00121 
00122     virtual bool parse();
00123     QList<QByteArray> binaryParts()
00124       { return b_ins; }
00125 
00126   protected:
00127     QList<QByteArray> b_ins;
00128     static bool yencMeta( QByteArray &src, const QByteArray &name, int *value );
00129 };
00130 
00131 } // namespace Parser
00132 
00133 } // namespace KMime
00134 
00135 #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"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.1
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