changed: when there is reqtype:json parameter and there is not set request.ajax_serializer
then we are using a generic json serializer changed: we are sending the application/json header when returning an json string added: to config: log_server_answer (default false) when true we put the whole string (server's answer) to the log file added: to Request: use_200_status_for_not_found_and_permission_denied if this is true then if the server http code would be 403 or 404 then we return 200 OK (useful when using ajax) changed: System::RedirectTo() methods take as the last parameter: use_reqtype if this is true (default) then reqtype:type parameter is automatically added to the redirecting path git-svn-id: svn://ttmath.org/publicrep/winix/trunk@918 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
45
core/misc.h
45
core/misc.h
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* Copyright (c) 2008-2013, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -272,7 +272,24 @@ typename StringType::size_type i;
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void Trim(StringType & s, wchar_t c)
|
||||
void TrimFirst(StringType & s, wchar_t c)
|
||||
{
|
||||
typename StringType::size_type i;
|
||||
|
||||
if( s.empty() )
|
||||
return;
|
||||
|
||||
// looking for the 'c' characters at the beginning
|
||||
for(i=0 ; i<s.size() && s[i]==c ; ++i);
|
||||
|
||||
// deleting the 'c' characters at the beginning
|
||||
if( i != 0 )
|
||||
s.erase(0, i);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void TrimLast(StringType & s, wchar_t c)
|
||||
{
|
||||
typename StringType::size_type i;
|
||||
|
||||
@@ -292,16 +309,23 @@ typename StringType::size_type i;
|
||||
// deleting 'c' characters at the end
|
||||
if( i != s.size() - 1 )
|
||||
s.erase(i+1, StringType::npos);
|
||||
|
||||
// looking for the 'c' characters at the beginning
|
||||
for(i=0 ; i<s.size() && s[i]==c ; ++i);
|
||||
|
||||
// deleting the 'c' characters at the beginning
|
||||
if( i != 0 )
|
||||
s.erase(0, i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void Trim(StringType & s, wchar_t c)
|
||||
{
|
||||
if( s.empty() )
|
||||
return;
|
||||
|
||||
TrimLast(s, c);
|
||||
TrimFirst(s, c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void MaxSize(StringType & str, size_t max_size)
|
||||
{
|
||||
@@ -971,4 +995,7 @@ size_t i1, i2;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user