Work on the IMFHeader and IMFMessage.
This commit is contained in:
parent
2e8bb4a123
commit
01180021b4
@ -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() == "") {}
|
||||
|
@ -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");
|
||||
|
@ -20,8 +20,8 @@ namespace coreutils {
|
||||
public:
|
||||
IMFMessage();
|
||||
IMFMessage(ZString &in);
|
||||
virtual ~IMFMessage();
|
||||
|
||||
virtual ~IMFMessage();
|
||||
|
||||
void output(std::stringstream &out);
|
||||
|
||||
void addHeader(IMFHeader header);
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user