added: to Requst:

std::wstring * PostVarp(const std::wstring & var);
added: to misc:
       template<class CharType>
       bool Toa(unsigned/signed long/int value, CharType * buffer);
       some Toa methods which don't get the buffer len
       (the buffer has to be sufficient big)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@845 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2012-06-04 17:51:43 +00:00
parent 86d6c96aeb
commit 0d0f12b394
3 changed files with 53 additions and 1 deletions

View File

@ -120,14 +120,55 @@ bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10)
}
/*
these methos don't take the buffer size
make sure the buffer size is sufficient big
2^64 - 1 = 18446744073709551615 = 20 characters (plus minus sign and plus terminating zero)
so the buffer should have at least 22 characters
!! CHECK ME check the size whether is correct
*/
template<class CharType>
bool Toa(unsigned long value, CharType * buffer)
{
size_t sufficient_space = 25;
return Toa(value, buffer, sufficient_space);
}
template<class CharType>
bool Toa(long value, CharType * buffer)
{
size_t sufficient_space = 25;
return Toa(value, buffer, sufficient_space);
}
template<class CharType>
bool Toa(unsigned int value, CharType * buffer)
{
size_t sufficient_space = 25;
return Toa(value, buffer, sufficient_space);
}
template<class CharType>
bool Toa(int value, CharType * buffer)
{
size_t sufficient_space = 25;
return Toa(value, buffer, sufficient_space);
}
// warning: it uses its own static buffer
// one buffer for both these functions
// !! REMOVE ME they are deprecated (don't use it)
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);

View File

@ -234,6 +234,16 @@ return &p->second;
}
std::wstring * Request::PostVarp(const std::wstring & var)
{
PostTab::iterator p = post_tab.find(var);
if( p == post_tab.end() )
return 0;
return &p->second;
}

View File

@ -167,6 +167,7 @@ struct Request
bool PostVar(const std::wstring & var, std::wstring & result);
std::wstring * PostVarp(const wchar_t * var);
std::wstring * PostVarp(const std::wstring & var);
bool AllPostVarEmpty(); // returning true if all post vars are empty