added: to Space:
const std::wstring * GetValue(const std::wstring & name) const; std::wstring & Add(const wchar_t * name, size_t value); std::wstring & Add(const std::wstring & name, size_t value); git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@418 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
39a1ea1007
commit
bff2ecb147
|
@ -136,6 +136,30 @@ 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);
|
||||||
|
|
||||||
|
if( i != table_single.end() )
|
||||||
|
{
|
||||||
|
return &i->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Table::const_iterator t = table.find(name);
|
||||||
|
|
||||||
|
if( t == table.end() || t->second.empty() )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return &t->second[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring & Space::Text(const wchar_t * name)
|
std::wstring & Space::Text(const wchar_t * name)
|
||||||
|
@ -427,6 +451,29 @@ std::wstring & Space::Add(const std::wstring & name, long value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::wstring & Space::Add(const wchar_t * name, size_t value)
|
||||||
|
{
|
||||||
|
wchar_t value_str[50];
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::wstring & Space::Add(const std::wstring & name, size_t value)
|
||||||
|
{
|
||||||
|
return Add(name.c_str(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring & Space::Add(const wchar_t * name, const wchar_t * value)
|
std::wstring & Space::Add(const wchar_t * name, const wchar_t * value)
|
||||||
{
|
{
|
||||||
tmp_name = name;
|
tmp_name = name;
|
||||||
|
|
|
@ -179,6 +179,7 @@ public:
|
||||||
// they can return a null pointer if there is not such a 'name'
|
// they can return a null pointer if there is not such a 'name'
|
||||||
std::wstring * GetValue(const wchar_t * name);
|
std::wstring * GetValue(const wchar_t * name);
|
||||||
std::wstring * GetValue(const std::wstring & name);
|
std::wstring * GetValue(const std::wstring & name);
|
||||||
|
const std::wstring * GetValue(const std::wstring & name) const;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -217,13 +218,12 @@ public:
|
||||||
|
|
||||||
std::wstring & Add(const wchar_t * name, bool value);
|
std::wstring & Add(const wchar_t * name, bool value);
|
||||||
std::wstring & Add(const std::wstring & name, bool value);
|
std::wstring & Add(const std::wstring & name, bool value);
|
||||||
|
|
||||||
std::wstring & Add(const wchar_t * name, int value);
|
std::wstring & Add(const wchar_t * name, int value);
|
||||||
std::wstring & Add(const std::wstring & name, int value);
|
std::wstring & Add(const std::wstring & name, int value);
|
||||||
|
|
||||||
std::wstring & Add(const wchar_t * name, long value);
|
std::wstring & Add(const wchar_t * name, long value);
|
||||||
std::wstring & Add(const std::wstring & name, long value);
|
std::wstring & Add(const std::wstring & name, long value);
|
||||||
|
std::wstring & Add(const wchar_t * name, size_t value);
|
||||||
|
std::wstring & Add(const std::wstring & name, size_t value);
|
||||||
std::wstring & Add(const wchar_t * name, const wchar_t * value);
|
std::wstring & Add(const wchar_t * name, const wchar_t * value);
|
||||||
std::wstring & Add(const wchar_t * name, const std::wstring & value);
|
std::wstring & Add(const wchar_t * name, const std::wstring & value);
|
||||||
std::wstring & Add(const std::wstring & name, const std::wstring & value);
|
std::wstring & Add(const std::wstring & name, const std::wstring & value);
|
||||||
|
|
Loading…
Reference in New Issue