added: to Space:
bool HasValue(const wchar_t * name, const wchar_t * value); bool HasValue(const wchar_t * name, const std::wstring & value); bool HasValue(const std::wstring & name, const wchar_t * value); bool HasValue(const std::wstring & name, const std::wstring & value); useful when testing whether a value is in a list (or in simple table too) git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@433 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
02abfe62fa
commit
1e48455942
|
@ -163,6 +163,57 @@ const std::wstring * Space::GetValue(const std::wstring & name) const
|
|||
|
||||
|
||||
|
||||
bool Space::HasValue(const wchar_t * name, const wchar_t * value)
|
||||
{
|
||||
tmp_name = name;
|
||||
tmp_value_text = value;
|
||||
|
||||
return HasValue(tmp_name, tmp_value_text);
|
||||
}
|
||||
|
||||
bool Space::HasValue(const wchar_t * name, const std::wstring & value)
|
||||
{
|
||||
tmp_name = name;
|
||||
|
||||
return HasValue(tmp_name, value);
|
||||
}
|
||||
|
||||
|
||||
bool Space::HasValue(const std::wstring & name, const wchar_t * value)
|
||||
{
|
||||
tmp_value_text = value;
|
||||
|
||||
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);
|
||||
|
||||
if( i != table_single.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;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::wstring & Space::Text(const wchar_t * name)
|
||||
{
|
||||
tmp_name = name;
|
||||
|
|
|
@ -184,6 +184,16 @@ public:
|
|||
const std::wstring * GetValue(const std::wstring & name) const;
|
||||
|
||||
|
||||
/*
|
||||
returns true if such an option has 'value'
|
||||
useful when testing lists (they don't have to be copied out)
|
||||
*/
|
||||
bool HasValue(const wchar_t * name, const wchar_t * value);
|
||||
bool HasValue(const wchar_t * name, const std::wstring & value);
|
||||
bool HasValue(const std::wstring & name, const wchar_t * value);
|
||||
bool HasValue(const std::wstring & name, const std::wstring & value);
|
||||
|
||||
|
||||
/*
|
||||
those methods are used to extract information from space.table or space.table_single
|
||||
as a parameter they take the name of an option
|
||||
|
@ -299,6 +309,8 @@ public:
|
|||
// null means a root space
|
||||
Space * parent;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
those methods are used to extract lists
|
||||
note: if there is one option in table_single they will return it
|
||||
|
|
Loading…
Reference in New Issue