CoreUtils/IMFMultipart.cpp
Brad Arant 7e06591de6 Sync.
2021-01-09 18:27:48 -08:00

31 lines
693 B
C++

#include "IMFMultipart.h"
#include "PString.h"
namespace coreutils {
IMFMultipart::IMFMultipart(PString *in, std::string boundary) : IMFBody(in) {
buffer = in->str();
in->cursor -= 2;
sections = in->split("\r\n--" + boundary);
for(int ix = 0; ix < sections.size(); ++ix) {
if(sections[ix].str() == "--\r\n")
sections[ix] = PString("");
if(sections[ix].str().substr(0, 2) == "\r\n")
sections[ix].cursor += 2;
}
}
std::string IMFMultipart::toString() {
return buffer.str();
}
int IMFMultipart::getCount() {
return sections.size();
}
PString IMFMultipart::getSectionAt(int index) {
return sections[index];
}
}