从C/C ++解析简单的MIME文件? [英] Parsing simple MIME files from C/C++?

查看:310
本文介绍了从C/C ++解析简单的MIME文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上搜索了几天,但似乎找不到解决我问题的好方法:

I have searched the web for days now but I can't seem to find a good solution to my problem:

对于我的一个项目,我正在寻找一个好的(轻量级)MIME解析器.我的客户提供了MIME格式的文件(线性,无层次结构),其中包含3-4个部分".该应用程序必须能够拆分这些部分并独立处理它们.

For one of my projects I'm looking for a good (lightweight) MIME parser. My customer provides MIME formatted files (linear, no hierarchy) which contain 3-4 "parts". The application must be able to split those parts and process them independently.

基本上,这些MIME文件就像原始的电子邮件一样,但是没有SMTP标头.取而代之的是,它们以MIME标题"MIME版本:1.0"开头,然后是各部分.

Basically those MIME files are like raw E-Mail messages, but without the SMTP-headers. Instead they begin with the MIME-Header "MIME-Version: 1.0" and after that the parts follow.

我正在为应用程序使用C ++,因此欢迎使用C ++库.也欢迎使用标准C库.但应符合以下条件:

I am using C++ for the application, so a C++ library is welcome. A standard C library is welcome, too; but it should fit the following criteria:

  • 开放(至少是LGPL),而不是财产
  • 紧凑-我只需要解析器,不支持SMTP/POP3
  • 跨平台(定位于Windows,Mac OS X和Linux)

经过几天的搜索,我发现了以下库以及为何使用它们的原因:

After days of searching I found the following libs and reasons why to not use them:

  • 模仿 (C ++)-尽管该库似乎完整且可用于C ++,它基于 glib ,无法在Windows上正确编译.
  • Vmime (C ++)-似乎完整,但是没有Windows官方支持.他们还提供双重许可"(商业LGPL" + GPL).似乎包含在Ubuntu和Debian中,但许可令人困惑.
  • mime ++ ---商业用途,不支持Mac.
  • Chilkat软件MIME C ++库 --商业并专注于Windows.
  • mimetic (C++) --- Although this library seems complete and for C++ usage, it is based on glib, which won't properly compile on Windows.
  • Vmime (C++) --- Seems complete, but there is no official Windows support. Also they provide "dual licensing" ("commerical LGPL" + GPL). Seems to be included with Ubuntu and Debian, but the licensing is confusing.
  • mime++ --- Commerical, no Mac support.
  • Chilkat Software MIME C++ Library --- Commerical and focused on Windows.

我真的不想编写自己的MIME解析器. MIME如此广泛,以至于必须有一些开放库才能以理智的方式处理这种文件格式.

I don't really want to write my own MIME parser. MIME is so widespread that there must be some open library to handle this file format in a sane way.

那么,你们有什么想法,建议或链接吗?

So, do you guys have any ideas, suggestions or links?

提前谢谢!

推荐答案

已经有一段时间了.因此,我将回答我自己的问题.

It's been a while. So I'll just answer my own question.

在花了更多时间之后,我最终编写了自己的实现. MIME确实非常简单,如果您阅读文档,便可以在短时间内启动并运行它.

After spending some more time on this, I ended up writing my own implementation. MIME is quite simple indeed, and if you read the documentation, you have something up and running in a short time.

但是,我认为应该有vMime之类的东西,但是应该是开源的.我不敢相信有这么多人必须处理MIME结构,因为这是一个真正的标准.

However, I think there should be something like vMime, but open source. I can't believe that so few people have to deal with MIME structures as it's a real standard.

这篇关于从C/C ++解析简单的MIME文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆