Continued refinement of IMF objects.

This commit is contained in:
barant committed 2020-05-04 10:02:52 -07:00
1 parent 018c130df1
commit f4496fc682
2 files changed
+15 -5

No files matched your search

+12 -3
View File
@@ -9,14 +9,23 @@ namespace coreutils {
IMFHeader::IMFHeader(PString &in) {
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-");
if(key.length() != 0) {
if(!in.ifNext(":")) {
printf("%02X\n", in.str()[0]);
throw coreutils::Exception("Invalid character in expected header token.");
}
in.skipWhitespace();
value = in.getTokenExclude("\r\n");
if(!in.ifNext("\r\n"))
throw coreutils::Exception("Expected CRLF.");
value = in.str();
}
else if(in.skipWhitespace() > 0) {
}
else if(in.str() == "") {
}
}
IMFHeader::IMFHeader(std::string key, std::string value) {
+3 -2
View File
@@ -76,8 +76,9 @@ namespace coreutils {
return test;
}
void PString::skipWhitespace() {
cursor = pstring.find_first_not_of(" \t", cursor);
int PString::skipWhitespace() {
size_t found = pstring.find_first_not_of(" \t", cursor);
return found != cursor::npos ? cursor + found: 0;
}
int PString::size() {