Work on the IMFHeader and IMFMessage.

This commit is contained in:
Brad Arant 2024-11-11 15:58:58 -08:00
parent 2e8bb4a123
commit 01180021b4
5 changed files with 22 additions and 5 deletions

View File

@ -1,16 +1,20 @@
#include "IMFHeader.h"
#include "Exception.h"
#include "Log.h"
#include <iostream>
namespace coreutils {
IMFHeader::IMFHeader(ZString &in) : ZString(in) {
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789");
std::cout << "key: [" << key << "]" << std::endl;
if(key.getLength() != 0) {
if(!in.ifNext(":"))
throw coreutils::Exception("Invalid character in expected header token.");
in.skipWhitespace();
value = in.goeol();
value = in.goeolwithContinuation();
std::cout << "header: [" << value << "]" << std::endl;
}
else if(in.skipWhitespace() > 0) {}
else if(in.str() == "") {}

View File

@ -9,8 +9,8 @@ namespace coreutils {
IMFMessage::IMFMessage() : ZString() {}
IMFMessage::IMFMessage(ZString &in) : ZString(in) {
while (!in.ifNext("\r\n"))
while (!in.ifNext("\r\n") && in.ifNext("\n"))
headers.emplace_back(in);
ZString type = getHeader("Content-Type");

View File

@ -20,8 +20,8 @@ namespace coreutils {
public:
IMFMessage();
IMFMessage(ZString &in);
virtual ~IMFMessage();
virtual ~IMFMessage();
void output(std::stringstream &out);
void addHeader(IMFHeader header);

View File

@ -455,6 +455,13 @@ namespace coreutils {
return ZString(temp, tempend - temp);
}
ZString ZString::goeolwithContinuation() {
ZString temp = goeol();
while(ifNextInclude(" \t"))
goeol();
return temp;
}
ZString ZString::trim() {
skipWhitespace();
return unparsed();

View File

@ -329,6 +329,12 @@ namespace coreutils {
ZString goeol();
///
///
///
ZString goeolwithContinuation();
///
///
///