Still working out parsing buffer stuff.
This commit is contained in:
parent
ccfab5aecf
commit
d415e0abd3
@ -8,13 +8,25 @@ namespace coreutils {
|
||||
IMFHeader::IMFHeader(int fd) {}
|
||||
|
||||
virtual int parse() {
|
||||
char ch;
|
||||
int rc = ::read(fd, &ch, 1);
|
||||
while(ch != '\r') {
|
||||
IMFHeaderField *headerField = new IMFHeaderField(ch, fd);
|
||||
headers.push_back(headerField);
|
||||
switch(state) {
|
||||
case NAME:
|
||||
name << buffer.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789");
|
||||
if(buffer.ifNext(":"))
|
||||
state = FIELD;
|
||||
else
|
||||
return 2;
|
||||
case FIELD:
|
||||
field << buffer.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-;'\"0123456789");
|
||||
if(!buffer.ifNext("\r\n"))
|
||||
if(buffer.eod())
|
||||
return 2;
|
||||
// Right here is where we should check if next line is an extension to the previous line.
|
||||
|
||||
|
||||
|
||||
}
|
||||
rc = ::read(fd, &ch, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
# include "StreamReader.h"
|
||||
# include "Parser.h"
|
||||
# include "MString.h"
|
||||
# include "IMFHeaderField.h"
|
||||
# include <vector>
|
||||
|
||||
@ -16,7 +17,9 @@ namespace coreutils {
|
||||
virtual int parse();
|
||||
|
||||
private:
|
||||
std::vector<IMFHeaderField *> headers;
|
||||
MString name;
|
||||
MString field;
|
||||
std::map<MString, MString> headers;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user