libkdenetwork Library API Documentation

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 program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software Foundation, 00014 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US 00015 */ 00016 #ifndef __KMIME_PARSERS__ 00017 #define __KMIME_PARSERS__ 00018 00019 #include <qvaluelist.h> 00020 #include <qcstring.h> 00021 #include <qstrlist.h> 00022 00023 namespace KMime { 00024 00025 namespace Parser { 00026 00031 class MultiPart { 00032 00033 public: 00034 MultiPart(const QCString &src, const QCString &boundary); 00035 ~MultiPart() {}; 00036 00037 bool parse(); 00038 QValueList<QCString> parts() { return p_arts; } 00039 QCString preamble() { return p_reamble; } 00040 QCString epilouge() { return e_pilouge; } 00041 00042 protected: 00043 QCString s_rc, b_oundary, p_reamble, e_pilouge; 00044 QValueList<QCString> p_arts; 00045 }; 00046 00047 00052 class NonMimeParser { 00053 00054 public: 00055 NonMimeParser(const QCString &src); 00056 virtual ~NonMimeParser() {}; 00057 virtual bool parse() = 0; 00058 bool isPartial() { return (p_artNr>-1 && t_otalNr>-1 && t_otalNr!=1); } 00059 int partialNumber() { return p_artNr; } 00060 int partialCount() { return t_otalNr; } 00061 bool hasTextPart() { return (t_ext.length()>1); } 00062 QCString textPart() { return t_ext; } 00063 QStrList binaryParts() { return b_ins; } 00064 QStrList filenames() { return f_ilenames; } 00065 QStrList mimeTypes() { return m_imeTypes; } 00066 00067 protected: 00068 static QCString guessMimeType(const QCString& fileName); 00069 00070 QCString s_rc, t_ext; 00071 QStrList b_ins, f_ilenames, m_imeTypes; 00072 int p_artNr, t_otalNr; 00073 }; 00074 00075 00080 class UUEncoded : public NonMimeParser { 00081 00082 public: 00083 UUEncoded(const QCString &src, const QCString &subject); 00084 00085 virtual bool parse(); 00086 00087 protected: 00088 QCString s_ubject; 00089 }; 00090 00091 00092 00097 class YENCEncoded : public NonMimeParser { 00098 00099 public: 00100 YENCEncoded(const QCString &src); 00101 00102 virtual bool parse(); 00103 QValueList<QByteArray> binaryParts() { return b_ins; } 00104 00105 protected: 00106 QValueList<QByteArray> b_ins; 00107 static bool yencMeta( QCString& src, const QCString& name, int* value); 00108 }; 00109 00110 00111 } // namespace Parser 00112 00113 } // namespace KMime 00114 00115 #endif // __KMIME_PARSERS__
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:48:43 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003