summaryrefslogtreecommitdiff
path: root/src/mime-printdoc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mime-printdoc.cc')
-rw-r--r--src/mime-printdoc.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/mime-printdoc.cc b/src/mime-printdoc.cc
new file mode 100644
index 0000000..bef673b
--- /dev/null
+++ b/src/mime-printdoc.cc
@@ -0,0 +1,47 @@
+/** --------------------------------------------------------------------
+ * @file mime-printdoc.cc
+ * @brief Implementation of main mime parser components
+ * @author Andreas Aardal Hanssen
+ * @date 2002-2005
+ * ----------------------------------------------------------------- **/
+#include "mime.h"
+#include "mime-utils.h"
+#include "mime-inputsource.h"
+#include "convert.h"
+#include "iodevice.h"
+#include "iofactory.h"
+
+#include <string>
+#include <vector>
+#include <map>
+#include <exception>
+#include <iostream>
+
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <errno.h>
+
+using namespace ::std;
+
+//------------------------------------------------------------------------
+void Binc::MimePart::printDoc(int fd, IODevice &output,
+ unsigned int startoffset,
+ unsigned int length) const
+{
+ if (!mimeSource || mimeSource->getFileDescriptor() != fd) {
+ delete mimeSource;
+ mimeSource = new MimeInputSource(fd);
+ }
+
+ mimeSource->reset();
+ mimeSource->seek(headerstartoffsetcrlf);
+
+ char c;
+ for (unsigned int i = 0; i < length; ++i) {
+ if (!mimeSource->getChar(&c))
+ break;
+
+ output << (char)c;
+ }
+}