kmime_parsers.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 }
00112
00113 }
00114
00115
#endif // __KMIME_PARSERS__
This file is part of the documentation for libkdenetwork Library Version 3.3.0.