|
|
|
@ -149,6 +149,53 @@ const Space::Value * Space::GetValue(const std::wstring & name) const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Space::Value * Space::GetValueNoCase(const wchar_t * name)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return GetValueNoCase(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Space::Value * Space::GetValueNoCase(const std::wstring & name)
|
|
|
|
|
{
|
|
|
|
|
Table::iterator t = table.begin();
|
|
|
|
|
|
|
|
|
|
for( ; t != table.end() ; ++t)
|
|
|
|
|
{
|
|
|
|
|
if( PT::EqualNoCase(t->first, name) )
|
|
|
|
|
{
|
|
|
|
|
return &t->second;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Space::Value * Space::GetValueNoCase(const wchar_t * name) const
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return GetValueNoCase(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Space::Value * Space::GetValueNoCase(const std::wstring & name) const
|
|
|
|
|
{
|
|
|
|
|
Table::const_iterator t = table.begin();
|
|
|
|
|
|
|
|
|
|
for( ; t != table.end() ; ++t)
|
|
|
|
|
{
|
|
|
|
|
if( PT::EqualNoCase(t->first, name) )
|
|
|
|
|
{
|
|
|
|
|
return &t->second;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring * Space::GetFirstValue(const wchar_t * name)
|
|
|
|
|
{
|
|
|
|
@ -461,9 +508,9 @@ bool Space::ToBool(const std::wstring & value)
|
|
|
|
|
const wchar_t * str_begin = SkipWhite(value.c_str());
|
|
|
|
|
const wchar_t * str_end = SkipWhiteFromBack(str_begin);
|
|
|
|
|
|
|
|
|
|
return (EqualNoCase(str_begin, str_end, L"true") ||
|
|
|
|
|
EqualNoCase(str_begin, str_end, L"yes") ||
|
|
|
|
|
EqualNoCase(str_begin, str_end, L"1")
|
|
|
|
|
return (PT::EqualNoCase(str_begin, str_end, L"true") ||
|
|
|
|
|
PT::EqualNoCase(str_begin, str_end, L"yes") ||
|
|
|
|
|
PT::EqualNoCase(str_begin, str_end, L"1")
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1007,55 +1054,6 @@ bool Space::ListText(const wchar_t * name, std::vector<std::wstring> & list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t Space::ToSmall(wchar_t c)
|
|
|
|
|
{
|
|
|
|
|
if( c >= 'A' && c <= 'Z' )
|
|
|
|
|
c = c - 'A' + 'a';
|
|
|
|
|
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// IMPROVE ME
|
|
|
|
|
// move me to a better place
|
|
|
|
|
bool Space::EqualNoCase(const wchar_t * str1, const wchar_t * str2)
|
|
|
|
|
{
|
|
|
|
|
while( *str1 && *str2 && ToSmall(*str1) == ToSmall(*str2) )
|
|
|
|
|
{
|
|
|
|
|
++str1;
|
|
|
|
|
++str2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( *str1 == 0 && *str2 == 0 )
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* the first string is trimmed
|
|
|
|
|
* str1_end is pointing one character after the last valid character
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
// IMPROVE ME
|
|
|
|
|
// move me to a better place
|
|
|
|
|
bool Space::EqualNoCase(const wchar_t * str1_begin, const wchar_t * str1_end, const wchar_t * str2)
|
|
|
|
|
{
|
|
|
|
|
while( str1_begin < str1_end && *str2 && ToSmall(*str1_begin) == ToSmall(*str2) )
|
|
|
|
|
{
|
|
|
|
|
++str1_begin;
|
|
|
|
|
++str2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( str1_begin == str1_end && *str2 == 0 )
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
those white characters here should be the same as in spaceparser.cpp
|
|
|
|
|
*/
|
|
|
|
|