57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
#include "IMFHeader.h"
|
|
#include "Exception.h"
|
|
|
|
namespace coreutils {
|
|
|
|
IMFHeader::IMFHeader() {
|
|
|
|
}
|
|
|
|
IMFHeader::IMFHeader(PString &in) {
|
|
printf("in='%s'\n", in.str().c_str());
|
|
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789");
|
|
if(key.length() != 0) {
|
|
if(!in.ifNext(":")) {
|
|
printf("key=%s %02X\n", key.c_str(), in.str()[0]);
|
|
throw coreutils::Exception("Invalid character in expected header token.");
|
|
}
|
|
in.skipWhitespace();
|
|
value = in.str();
|
|
}
|
|
else if(in.skipWhitespace() > 0) {
|
|
|
|
|
|
|
|
}
|
|
else if(in.str() == "") {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IMFHeader::IMFHeader(std::string key, std::string value) {
|
|
this->key = key;
|
|
this->value = value;
|
|
}
|
|
|
|
std::string IMFHeader::getKey() {
|
|
return key;
|
|
}
|
|
|
|
void IMFHeader::setKey(std::string key) {
|
|
this->key = key;
|
|
}
|
|
|
|
std::string IMFHeader::getValue() {
|
|
return value;
|
|
}
|
|
|
|
void IMFHeader::setValue(std::string value) {
|
|
this->value = value;
|
|
}
|
|
|
|
void IMFHeader::output(std::stringstream &out) {
|
|
out << key << ": " << value << "\r\n";
|
|
}
|
|
|
|
} |