#include "IMFRequest.h" #include "Exception.h" namespace coreutils { IMFRequest::IMFRequest() {} IMFRequest::IMFRequest(PString &in) { method = in.getTokenExclude(" "); if(!in.ifNext(" ")) throw coreutils::Exception("Expecting space after method."); uri = in.getTokenExclude(" "); if(!in.ifNext(" ")) throw coreutils::Exception("Expecting space after URI."); protocol = in.getTokenExclude("\r\n"); if(!in.ifNext("\r\n")) throw coreutils::Exception("Expecting CRLF after protocol."); } std::string IMFRequest::getMethod() { return method; } void IMFRequest::setMethod(std::string method) { this->method = method; } std::string IMFRequest::getURI() { return uri; } void IMFRequest::setURI(std::string uri) { this->uri = uri; } std::string IMFRequest::getProtocol() { return protocol; } void IMFRequest::setProtocol(std::string protocol) { this->protocol = protocol; } void IMFRequest::output(std::stringstream &out) { out << method << " " << uri << " " << protocol << "\r\n"; } }