Added vscode
This commit is contained in:
1 parent
6894968732
commit
c00476719c
10 files changed
+183
-158
No files matched your search
+27
-36
@@ -3,46 +3,37 @@
|
||||
#include "Log.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.str();
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
parse(in);
|
||||
}
|
||||
|
||||
void IMFRequest::output(std::stringstream &out) {
|
||||
out << method << " " << uri << " " << protocol << "\r\n";
|
||||
bool IMFRequest::parse(PString &in) {
|
||||
parts = in.split(" ");
|
||||
return parts.size() == 3;
|
||||
}
|
||||
|
||||
std::string IMFRequest::getMethod() {
|
||||
if(parts.size() == 3)
|
||||
return parts[0].str();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string IMFRequest::getURI() {
|
||||
if(parts.size() == 3)
|
||||
return parts[1].str();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string IMFRequest::getProtocol() {
|
||||
if(parts.size() == 3)
|
||||
return parts[2].str();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user