Rename EscapeUrl to EncodeUrl

This commit is contained in:
Birunthan Mohanathas 2014-01-04 21:47:45 +02:00
parent 39c6c62abd
commit 27164b8e75
4 changed files with 9 additions and 9 deletions

View File

@ -78,7 +78,7 @@ void EscapeRegExp(std::wstring& str)
/*
** Escapes reserved URL characters.
*/
void EscapeUrl(std::wstring& str)
void EncodeUrl(std::wstring& str)
{
size_t pos = 0;
while ((pos = str.find_first_of(L" !*'();:@&=+$,/?#[]", pos)) != std::wstring::npos)

View File

@ -38,7 +38,7 @@ inline std::wstring WidenUTF8(const std::string& str) { return Widen(str.c_str()
void EscapeRegExp(std::wstring& str);
void EscapeUrl(std::wstring& str);
void EncodeUrl(std::wstring& str);
} // namespace StringUtil

View File

@ -47,10 +47,10 @@ public:
Assert::AreEqual(L"\\\\\\^\\$\\|\\(test\\)\\[\\{\\. ing\\+\\*\\?", str.c_str());
}
TEST_METHOD(TestEscapeUrl)
TEST_METHOD(TestEncodeUrl)
{
std::wstring str = L" !*'();:@test&=+$,/?#[ing]";
EscapeUrl(str);
EncodeUrl(str);
Assert::AreEqual(L"%20%21%2A%27%28%29%3B%3A%40test%26%3D%2B%24%2C%2F%3F%23%5Bing%5D", str.c_str());
}
};

View File

@ -238,7 +238,7 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s
Max,
Min,
EscapeRegExp,
EscapeUrl
EncodeUrl
} valueType = ValueType::Raw;
if (isKeySelector)
@ -255,9 +255,9 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s
{
valueType = ValueType::EscapeRegExp;
}
else if (_wcsicmp(selectorSz, L"EscapeUrl") == 0)
else if (_wcsicmp(selectorSz, L"EncodeUrl") == 0)
{
valueType = ValueType::EscapeUrl;
valueType = ValueType::EncodeUrl;
}
else
{
@ -304,10 +304,10 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s
StringUtil::EscapeRegExp(strValue);
return true;
}
else if (valueType == ValueType::EscapeUrl)
else if (valueType == ValueType::EncodeUrl)
{
strValue = measure->GetStringValue();
StringUtil::EscapeUrl(strValue);
StringUtil::EncodeUrl(strValue);
return true;
}