36 lines
875 B
C++
36 lines
875 B
C++
#include "IMFMultipart.h"
|
|
#include "Log.h"
|
|
|
|
namespace coreutils {
|
|
|
|
IMFMultipart::IMFMultipart() {}
|
|
|
|
IMFMultipart::IMFMultipart(ZString &in, ZString &boundary) {
|
|
Log(LOG_DEBUG_1) << in;
|
|
std::stringstream temp;
|
|
temp << "--" << boundary;
|
|
sections = in.split(temp.str().c_str());
|
|
for(int ix = 0; ix < sections.size(); ++ix) {
|
|
sections[ix].ifNext("\r\n");
|
|
sections[ix].trimCRLF();
|
|
Log(LOG_DEBUG_1) << "[" << sections[ix] << "].";
|
|
if(sections[ix].equals("--"))
|
|
sections[ix] = ZString("");
|
|
sections[ix].ifNext("\r\n");
|
|
}
|
|
}
|
|
|
|
std::string IMFMultipart::toString() {
|
|
return std::string(getData(), getLength());
|
|
}
|
|
|
|
int IMFMultipart::getCount() {
|
|
return sections.size();
|
|
}
|
|
|
|
ZString IMFMultipart::getSectionAt(int index) {
|
|
return sections[index];
|
|
}
|
|
|
|
}
|