-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebUrl.cpp
34 lines (31 loc) · 1023 Bytes
/
webUrl.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "webUrl.h"
webUrl::webUrl(string url){
int n,m;
if((n=url.find('?',1))!=string::npos){
m_map.insert(pair<string,string>("type",url.substr(1,n-1)));
}
else{
m_map.insert(pair<string,string>("type",url.substr(1,url.length()-1)));
}
m=n+1;
while((n=url.find('&',m))!=string::npos){
string ss=url.substr(m,n-m);
int p,q;
if((p=ss.find('=',0))!=string::npos){
m_map.insert(pair<string,string>(ss.substr(0,p),ss.substr(p+1,(ss.length()-p))));
}
else{
continue;
}
m=n+1;
}
int p;
string ss=url.substr(m,url.length()-m);
if((p=ss.find('=',0))!=string::npos){
m_map.insert(pair<string,string>(ss.substr(0,p),ss.substr(p+1,ss.length()-p)));
}
m=n+1;
}
string webUrl::getValue(string request){
return m_map[request];
}