|
|
|
@ -5,7 +5,7 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2008-2013, Tomasz Sowa
|
|
|
|
|
* Copyright (c) 2008-2017, Tomasz Sowa
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
@ -71,7 +71,6 @@ Space & Space::operator=(const Space & s)
|
|
|
|
|
Clear();
|
|
|
|
|
|
|
|
|
|
name = s.name;
|
|
|
|
|
table_single = s.table_single;
|
|
|
|
|
table = s.table;
|
|
|
|
|
parent = s.parent;
|
|
|
|
|
|
|
|
|
@ -93,7 +92,6 @@ return *this;
|
|
|
|
|
void Space::Clear()
|
|
|
|
|
{
|
|
|
|
|
name.clear();
|
|
|
|
|
table_single.clear();
|
|
|
|
|
table.clear();
|
|
|
|
|
|
|
|
|
|
for(size_t i=0 ; i<spaces.size() ; ++i)
|
|
|
|
@ -114,24 +112,15 @@ std::wstring * Space::GetValue(const wchar_t * name)
|
|
|
|
|
|
|
|
|
|
std::wstring * Space::GetValue(const std::wstring & name)
|
|
|
|
|
{
|
|
|
|
|
TableSingle::iterator i = table_single.find(name);
|
|
|
|
|
|
|
|
|
|
if( i != table_single.end() )
|
|
|
|
|
Table::iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( t == table.end() || t->second.empty() )
|
|
|
|
|
{
|
|
|
|
|
return &i->second;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Table::iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( t == table.end() || t->second.empty() )
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return &t->second[0];
|
|
|
|
|
}
|
|
|
|
|
return &t->second[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -139,24 +128,15 @@ std::wstring * Space::GetValue(const std::wstring & name)
|
|
|
|
|
|
|
|
|
|
const std::wstring * Space::GetValue(const std::wstring & name) const
|
|
|
|
|
{
|
|
|
|
|
TableSingle::const_iterator i = table_single.find(name);
|
|
|
|
|
Table::const_iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( i != table_single.end() )
|
|
|
|
|
if( t == table.end() || t->second.empty() )
|
|
|
|
|
{
|
|
|
|
|
return &i->second;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Table::const_iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( t == table.end() || t->second.empty() )
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return &t->second[0];
|
|
|
|
|
}
|
|
|
|
|
return &t->second[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -189,22 +169,13 @@ return HasValue(name, tmp_value_text);
|
|
|
|
|
|
|
|
|
|
bool Space::HasValue(const std::wstring & name, const std::wstring & value)
|
|
|
|
|
{
|
|
|
|
|
TableSingle::const_iterator i = table_single.find(name);
|
|
|
|
|
Table::const_iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( i != table_single.end() )
|
|
|
|
|
if( t != table.end() )
|
|
|
|
|
{
|
|
|
|
|
return i->second == value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Table::const_iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( t != table.end() )
|
|
|
|
|
{
|
|
|
|
|
for(size_t i=0 ; i < t->second.size() ; ++i)
|
|
|
|
|
if( t->second[i] == value )
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
for(size_t i=0 ; i < t->second.size() ; ++i)
|
|
|
|
|
if( t->second[i] == value )
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
@ -296,6 +267,7 @@ int Space::Int(const wchar_t * name, int def)
|
|
|
|
|
|
|
|
|
|
int Space::ToInt(const std::wstring & value)
|
|
|
|
|
{
|
|
|
|
|
// !! FIXME what if value is empty?
|
|
|
|
|
long res = (value[0] == '0')? wcstol(value.c_str() + 1, 0, 8) : wcstol(value.c_str(), 0, 10);
|
|
|
|
|
|
|
|
|
|
return static_cast<int>(res);
|
|
|
|
@ -332,6 +304,7 @@ long Space::Long(const wchar_t * name, long def)
|
|
|
|
|
|
|
|
|
|
long Space::ToLong(const std::wstring & value)
|
|
|
|
|
{
|
|
|
|
|
// !! FIXME what if value is empty?
|
|
|
|
|
return (value[0] == '0')? wcstol(value.c_str() + 1, 0, 8) : wcstol(value.c_str(), 0, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -365,6 +338,7 @@ size_t Space::Size(const wchar_t * name, size_t def)
|
|
|
|
|
|
|
|
|
|
size_t Space::ToSize(const std::wstring & value)
|
|
|
|
|
{
|
|
|
|
|
// !! FIXME what if value is empty?
|
|
|
|
|
unsigned long res = (value[0] == '0')? wcstoul(value.c_str() + 1, 0, 8) : wcstoul(value.c_str(), 0, 10);
|
|
|
|
|
|
|
|
|
|
return static_cast<size_t>(res);
|
|
|
|
@ -401,9 +375,9 @@ bool Space::Bool(const wchar_t * name, bool def)
|
|
|
|
|
|
|
|
|
|
bool Space::ToBool(const std::wstring & value)
|
|
|
|
|
{
|
|
|
|
|
return ( EqualNoCase(value.c_str(), L"true") ||
|
|
|
|
|
EqualNoCase(value.c_str(), L"yes") ||
|
|
|
|
|
EqualNoCase(value.c_str(), L"1")
|
|
|
|
|
return (EqualNoCase(value.c_str(), L"true") ||
|
|
|
|
|
EqualNoCase(value.c_str(), L"yes") ||
|
|
|
|
|
EqualNoCase(value.c_str(), L"1")
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -419,214 +393,255 @@ return def;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::FindAdd(const wchar_t * name)
|
|
|
|
|
// !! CHECKME
|
|
|
|
|
std::wstring & Space::FindAdd(const std::wstring & name)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
std::wstring * value = GetValue(tmp_name);
|
|
|
|
|
Value * value;
|
|
|
|
|
|
|
|
|
|
if( !value )
|
|
|
|
|
Table::iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( t != table.end() )
|
|
|
|
|
{
|
|
|
|
|
value = &table_single[tmp_name];
|
|
|
|
|
table.erase(tmp_name);
|
|
|
|
|
value = &t->second;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
value = &table[name];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( value->empty() )
|
|
|
|
|
value->push_back(std::wstring());
|
|
|
|
|
|
|
|
|
|
return *value;
|
|
|
|
|
return (*value)[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::FindAdd(const std::wstring & name)
|
|
|
|
|
// !! CHECKME
|
|
|
|
|
std::wstring & Space::FindAdd(const wchar_t * name)
|
|
|
|
|
{
|
|
|
|
|
std::wstring * value = GetValue(name);
|
|
|
|
|
|
|
|
|
|
if( !value )
|
|
|
|
|
{
|
|
|
|
|
value = &table_single[name];
|
|
|
|
|
table.erase(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return *value;
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return FindAdd(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// !! CHECKME
|
|
|
|
|
std::wstring & Space::FindAdd(const WTextStream & name)
|
|
|
|
|
{
|
|
|
|
|
name.to_string(tmp_name);
|
|
|
|
|
std::wstring * value = GetValue(tmp_name);
|
|
|
|
|
return FindAdd(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !value )
|
|
|
|
|
{
|
|
|
|
|
value = &table_single[tmp_name];
|
|
|
|
|
table.erase(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return *value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, bool value)
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* CHECKME !!
|
|
|
|
|
*/
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, const std::wstring & value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
if( value )
|
|
|
|
|
return Add(name, L"true");
|
|
|
|
|
Table::iterator i = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( i == table.end() )
|
|
|
|
|
{
|
|
|
|
|
Value & val = table[name];
|
|
|
|
|
val.push_back(value);
|
|
|
|
|
return val.back();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return Add(name, L"false");
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Value & val = i->second;
|
|
|
|
|
|
|
|
|
|
if( replace_existing )
|
|
|
|
|
val.clear();
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, bool value)
|
|
|
|
|
{
|
|
|
|
|
return Add(name.c_str(), value);
|
|
|
|
|
val.push_back(value);
|
|
|
|
|
return val.back();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, int value)
|
|
|
|
|
// CHECKME !!
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, const wchar_t * value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
wchar_t value_str[50];
|
|
|
|
|
tmp_value = value;
|
|
|
|
|
return Add(name, tmp_value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined _WIN32 || defined _WIN64
|
|
|
|
|
swprintf(value_str, L"%d", value);
|
|
|
|
|
#else
|
|
|
|
|
swprintf(value_str, sizeof(value_str)/sizeof(wchar_t), L"%d", value);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return Add(name, value_str);
|
|
|
|
|
// CHECKME !!
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, const wchar_t * value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
tmp_value = value;
|
|
|
|
|
return Add(tmp_name, tmp_value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, int value)
|
|
|
|
|
// CHECKME !!
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, const std::wstring & value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
return Add(name.c_str(), value);
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return Add(tmp_name, value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, long value)
|
|
|
|
|
{
|
|
|
|
|
wchar_t value_str[50];
|
|
|
|
|
|
|
|
|
|
#if defined _WIN32 || defined _WIN64
|
|
|
|
|
swprintf(value_str, L"%ld", value);
|
|
|
|
|
#else
|
|
|
|
|
swprintf(value_str, sizeof(value_str)/sizeof(wchar_t), L"%ld", value);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return Add(name, value_str);
|
|
|
|
|
// CHECKME !!
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, const WTextStream & value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
value.to_string(tmp_value);
|
|
|
|
|
return Add(tmp_name, tmp_value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, long value)
|
|
|
|
|
// CHECKME !!
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, const WTextStream & value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
return Add(name.c_str(), value);
|
|
|
|
|
value.to_string(tmp_value);
|
|
|
|
|
return Add(name, tmp_value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, size_t value)
|
|
|
|
|
// CHECKME !!
|
|
|
|
|
std::wstring & Space::Add(const WTextStream & name, const WTextStream & value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
wchar_t value_str[50];
|
|
|
|
|
name.to_string(tmp_name);
|
|
|
|
|
value.to_string(tmp_value);
|
|
|
|
|
return Add(tmp_name, tmp_value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined _WIN32 || defined _WIN64
|
|
|
|
|
// see http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.71%29.aspx
|
|
|
|
|
swprintf(value_str, L"%Iu", value);
|
|
|
|
|
#else
|
|
|
|
|
swprintf(value_str, sizeof(value_str)/sizeof(wchar_t), L"%zu", value);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return Add(name, value_str);
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
// CHECKME
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, bool value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
if( value )
|
|
|
|
|
return Add(name, L"true", replace_existing);
|
|
|
|
|
else
|
|
|
|
|
return Add(name, L"false", replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, size_t value)
|
|
|
|
|
// CHECKME
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, bool value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
return Add(name.c_str(), value);
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return Add(tmp_name, value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, const wchar_t * value)
|
|
|
|
|
// CHECKME
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, int value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
std::wstring & val = table_single[tmp_name];
|
|
|
|
|
val = value;
|
|
|
|
|
wchar_t value_str[50];
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
#if defined _WIN32 || defined _WIN64
|
|
|
|
|
swprintf(value_str, L"%d", value);
|
|
|
|
|
#else
|
|
|
|
|
swprintf(value_str, sizeof(value_str)/sizeof(wchar_t), L"%d", value);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return Add(name, value_str, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, const std::wstring & value)
|
|
|
|
|
// CHECKME
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, int value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
std::wstring & val = table_single[tmp_name];
|
|
|
|
|
val = value;
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
return Add(tmp_name, value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, const std::wstring & value)
|
|
|
|
|
{
|
|
|
|
|
std::wstring & val = table_single[name];
|
|
|
|
|
val = value;
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, const WTextStream & value)
|
|
|
|
|
// CHECKME
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, long value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
std::wstring & val = table_single[tmp_name];
|
|
|
|
|
value.to_string(val, true);
|
|
|
|
|
wchar_t value_str[50];
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
#if defined _WIN32 || defined _WIN64
|
|
|
|
|
swprintf(value_str, L"%ld", value);
|
|
|
|
|
#else
|
|
|
|
|
swprintf(value_str, sizeof(value_str)/sizeof(wchar_t), L"%ld", value);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return Add(name, value_str, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, const WTextStream & value)
|
|
|
|
|
// CHECKME
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, long value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
std::wstring & val = table_single[name];
|
|
|
|
|
value.to_string(val, true);
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return Add(tmp_name, value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const WTextStream & name, const WTextStream & value)
|
|
|
|
|
std::wstring & Space::Add(const std::wstring & name, size_t value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
name.to_string(tmp_name, true);
|
|
|
|
|
wchar_t value_str[50];
|
|
|
|
|
|
|
|
|
|
std::wstring & val = table_single[tmp_name];
|
|
|
|
|
value.to_string(val, true);
|
|
|
|
|
#if defined _WIN32 || defined _WIN64
|
|
|
|
|
// see http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.71%29.aspx
|
|
|
|
|
swprintf(value_str, L"%Iu", value);
|
|
|
|
|
#else
|
|
|
|
|
swprintf(value_str, sizeof(value_str)/sizeof(wchar_t), L"%zu", value);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
return Add(name, value_str, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring & Space::Add(const wchar_t * name, size_t value, bool replace_existing)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return Add(tmp_name, value, replace_existing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Space::Remove(const wchar_t * name)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
|
|
|
|
|
table_single.erase(tmp_name);
|
|
|
|
|
table.erase(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Space::Remove(const std::wstring & name)
|
|
|
|
|
{
|
|
|
|
|
table_single.erase(name);
|
|
|
|
|
table.erase(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Space::Remove(const wchar_t * name)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
Remove(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Space & Space::AddSpace(const wchar_t * name)
|
|
|
|
|
|
|
|
|
|
// CHECKME
|
|
|
|
|
Space & Space::AddSpace(const std::wstring & name)
|
|
|
|
|
{
|
|
|
|
|
spaces.push_back(new Space());
|
|
|
|
|
spaces.back()->name = name;
|
|
|
|
@ -636,21 +651,21 @@ return *spaces.back();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Space & Space::AddSpace(const std::wstring & name)
|
|
|
|
|
// CHECKME
|
|
|
|
|
Space & Space::AddSpace(const wchar_t * name)
|
|
|
|
|
{
|
|
|
|
|
spaces.push_back(new Space());
|
|
|
|
|
spaces.back()->name = name;
|
|
|
|
|
spaces.back()->parent = this;
|
|
|
|
|
|
|
|
|
|
return *spaces.back();
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return AddSpace(tmp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Space * Space::FindSpace(const wchar_t * name)
|
|
|
|
|
{
|
|
|
|
|
for(size_t i=0 ; i<spaces.size() ; ++i)
|
|
|
|
|
{
|
|
|
|
|
if( spaces[i]->name == name )
|
|
|
|
|
if( spaces[i]->name == name ) // there is a special == operator in string class taking c-string as an argument
|
|
|
|
|
return spaces[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -730,42 +745,38 @@ void Space::RemoveSpace(size_t child_index)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// in lists we don't use default values
|
|
|
|
|
bool Space::ListText(const wchar_t * name, std::vector<std::wstring> & list)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return ListText(tmp_name, list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Space::ListText(const std::wstring & name, std::vector<std::wstring> & list)
|
|
|
|
|
{
|
|
|
|
|
list.clear();
|
|
|
|
|
TableSingle::iterator i = table_single.find(name);
|
|
|
|
|
|
|
|
|
|
if( i != table_single.end() )
|
|
|
|
|
|
|
|
|
|
Table::iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( t != table.end() )
|
|
|
|
|
{
|
|
|
|
|
list.push_back(i->second);
|
|
|
|
|
list = t->second;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Table::iterator t = table.find(name);
|
|
|
|
|
|
|
|
|
|
if( t != table.end() )
|
|
|
|
|
{
|
|
|
|
|
list = t->second;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// in lists we don't use default values
|
|
|
|
|
bool Space::ListText(const wchar_t * name, std::vector<std::wstring> & list)
|
|
|
|
|
{
|
|
|
|
|
tmp_name = name;
|
|
|
|
|
return ListText(tmp_name, list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t Space::ToSmall(wchar_t c)
|
|
|
|
|
{
|
|
|
|
|
if( c>='A' && c<='Z' )
|
|
|
|
|
if( c >= 'A' && c <= 'Z' )
|
|
|
|
|
c = c - 'A' + 'a';
|
|
|
|
|
|
|
|
|
|
return c;
|
|
|
|
|