Line 1... |
Line 1... |
// $Id: RparseUrl.cpp 492 2013-02-24 22:14:47Z mueller $
|
// $Id: RparseUrl.cpp 516 2013-05-05 21:24:52Z mueller $
|
//
|
//
|
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
//
|
//
|
// This program is free software; you may redistribute and/or modify it under
|
// This program is free software; you may redistribute and/or modify it under
|
// the terms of the GNU General Public License as published by the Free
|
// the terms of the GNU General Public License as published by the Free
|
Line 17... |
Line 17... |
// 2013-02-03 481 1.0 Initial version, extracted from RlinkPort
|
// 2013-02-03 481 1.0 Initial version, extracted from RlinkPort
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RparseUrl.cpp 492 2013-02-24 22:14:47Z mueller $
|
\version $Id: RparseUrl.cpp 516 2013-05-05 21:24:52Z mueller $
|
\brief Implemenation of RparseUrl.
|
\brief Implemenation of RparseUrl.
|
*/
|
*/
|
|
|
#include <iostream>
|
#include <iostream>
|
|
|
Line 95... |
Line 95... |
key.push_back(c);
|
key.push_back(c);
|
} else {
|
} else {
|
if (c == '\\') {
|
if (c == '\\') {
|
if (i+1 >= url.length()) {
|
if (i+1 >= url.length()) {
|
emsg.Init("RparseUrl::ParseUrl()",
|
emsg.Init("RparseUrl::ParseUrl()",
|
string("invalid trailing \\ in url '") + url +
|
string("invalid trailing \\ in url '") + url + "'");
|
string("'"));
|
|
return false;
|
return false;
|
}
|
}
|
i += 1;
|
i += 1;
|
switch (url[i]) {
|
switch (url[i]) {
|
case '\\' : c = '\\'; break;
|
case '\\' : c = '\\'; break;
|
case ';' : c = ';'; break;
|
case ';' : c = ';'; break;
|
default : emsg.Init("RparseUrl::ParseUrl()",
|
default : emsg.Init("RparseUrl::ParseUrl()",
|
string("invalid \\ escape in url '") +
|
string("invalid \\ escape in url '") +
|
url + string("'"));
|
url + "'");
|
return false;
|
return false;
|
}
|
}
|
}
|
}
|
val.push_back(c);
|
val.push_back(c);
|
}
|
}
|
Line 206... |
Line 205... |
lkey += key;
|
lkey += key;
|
if (hasval) lkey += "=";
|
if (hasval) lkey += "=";
|
lkey += "|";
|
lkey += "|";
|
if (optlist.find(lkey) == string::npos) {
|
if (optlist.find(lkey) == string::npos) {
|
emsg.Init("RparseUrl::AddOpt()",
|
emsg.Init("RparseUrl::AddOpt()",
|
string("invalid field name '") + lkey + string("'"));
|
string("invalid field name '") + lkey + "'; allowed: '" +
|
|
optlist + "'");
|
return false;
|
return false;
|
}
|
}
|
|
|
fOptMap.insert(omap_val_t(key, hasval ? val : "1"));
|
fOptMap.insert(omap_val_t(key, hasval ? val : "1"));
|
return true;
|
return true;
|