Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
mime-printbody.cc
Go to the documentation of this file.
1
7#include "mime.h"
8#include "mime-utils.h"
9#include "mime-inputsource.h"
10
11#include "convert.h"
12#include "iodevice.h"
13#include "iofactory.h"
14
15#include <string>
16#include <vector>
17#include <map>
18#include <exception>
19#include <iostream>
20
21#include <string.h>
22#include <ctype.h>
23#include <stdio.h>
24#include <errno.h>
25
26using namespace ::std;
27
28//------------------------------------------------------------------------
30 unsigned int startoffset,
31 unsigned int length) const
32{
33 if (!mimeSource || mimeSource->getFileDescriptor() != fd) {
34 delete mimeSource;
36 }
37
39 mimeSource->seek(bodystartoffsetcrlf + startoffset);
40
41 if (startoffset + length > bodylength)
42 length = bodylength - startoffset;
43
44 char c = '\0';
45 for (unsigned int i = 0; i < length; ++i) {
46 if (!mimeSource->getChar(&c))
47 break;
48
49 output << (char)c;
50 }
51}
The IODevice class provides a framework for reading and writing to device.
Definition: iodevice.h:31
virtual void reset(void)
int getFileDescriptor(void) const
void seek(unsigned int offset)
void printBody(int fd, Binc::IODevice &output, unsigned int startoffset, unsigned int length) const
unsigned int bodylength
Definition: mime.h:61
unsigned int bodystartoffsetcrlf
Definition: mime.h:60
Declaration of miscellaneous convertion functions.
Declaration of the IODevice class.
Declaration of the IOFactory class.
The base class of the MIME input source.
Binc::MimeInputSource * mimeSource
Declaration of main mime parser components.