libkmime

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 program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software Foundation,
14 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15*/
16#ifndef __KMIME_PARSERS__
17#define __KMIME_PARSERS__
18
19#include <tqvaluelist.h>
20#include <tqcstring.h>
21#include <tqstrlist.h>
22
23namespace KMime {
24
25namespace Parser {
26
31class MultiPart {
32
33public:
34 MultiPart(const TQCString &src, const TQCString &boundary);
35 ~MultiPart() {};
36
37 bool parse();
38 TQValueList<TQCString> parts() { return p_arts; }
39 TQCString preamble() { return p_reamble; }
40 TQCString epilouge() { return e_pilouge; }
41
42protected:
43 TQCString s_rc, b_oundary, p_reamble, e_pilouge;
44 TQValueList<TQCString> p_arts;
45};
46
47
53
54public:
55 NonMimeParser(const TQCString &src);
56 virtual ~NonMimeParser() {};
57 virtual bool parse() = 0;
58 bool isPartial() { return (p_artNr>-1 && t_otalNr>-1 && t_otalNr!=1); }
59 int partialNumber() { return p_artNr; }
60 int partialCount() { return t_otalNr; }
61 bool hasTextPart() { return (t_ext.length()>1); }
62 TQCString textPart() { return t_ext; }
63 TQStrList binaryParts() { return b_ins; }
64 TQStrList filenames() { return f_ilenames; }
65 TQStrList mimeTypes() { return m_imeTypes; }
66
67protected:
68 static TQCString guessMimeType(const TQCString& fileName);
69
70 TQCString s_rc, t_ext;
71 TQStrList b_ins, f_ilenames, m_imeTypes;
72 int p_artNr, t_otalNr;
73};
74
75
80class UUEncoded : public NonMimeParser {
81
82public:
83 UUEncoded(const TQCString &src, const TQCString &subject);
84
85 virtual bool parse();
86
87protected:
88 TQCString s_ubject;
89};
90
91
92
97class YENCEncoded : public NonMimeParser {
98
99public:
100 YENCEncoded(const TQCString &src);
101
102 virtual bool parse();
103 TQValueList<TQByteArray> binaryParts() { return b_ins; }
104
105protected:
106 TQValueList<TQByteArray> b_ins;
107 static bool yencMeta( TQCString& src, const TQCString& name, int* value);
108};
109
110
111} // namespace Parser
112
113} // namespace KMime
114
115#endif // __KMIME_PARSERS__
Helper-class: splits a multipart-message into single parts as described in RFC 2046.
Definition: kmime_parsers.h:31
Helper-class: abstract base class of all parsers for non-mime binary data (uuencoded,...
Definition: kmime_parsers.h:52
static TQCString guessMimeType(const TQCString &fileName)
try to guess the mimetype from the file-extension
Helper-class: tries to extract the data from a possibly uuencoded message.
Definition: kmime_parsers.h:80
Helper-class: tries to extract the data from a possibly yenc encoded message.
Definition: kmime_parsers.h:97