65 lines
965 B
C++
65 lines
965 B
C++
|
/*
|
||
|
* This file is a part of Winix
|
||
|
* and is not publicly distributed
|
||
|
*
|
||
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#include "templates.h"
|
||
|
#include "core/misc.h"
|
||
|
|
||
|
|
||
|
namespace TemplatesFunctions
|
||
|
{
|
||
|
static std::string urlencode_tmp;
|
||
|
static std::string qencode_tmp;
|
||
|
|
||
|
|
||
|
void fil_urlencode(Info & i)
|
||
|
{
|
||
|
UrlEncode(i.in.Str(), urlencode_tmp);
|
||
|
i.out << R(urlencode_tmp);
|
||
|
}
|
||
|
|
||
|
|
||
|
void fil_qencode(Info & i)
|
||
|
{
|
||
|
QEncode(i.in.Str(), qencode_tmp);
|
||
|
i.out << R(qencode_tmp);
|
||
|
}
|
||
|
|
||
|
|
||
|
void fil_capitalize(Info & i)
|
||
|
{
|
||
|
const std::wstring & str = i.in.Str();
|
||
|
|
||
|
for(size_t a=0 ; a<str.size() ; ++a)
|
||
|
{
|
||
|
if( str[a]>='a' && str[a]<='z' )
|
||
|
i.out << R(wchar_t(str[a] - 'a' + 'A'));
|
||
|
else
|
||
|
i.out << R(str[a]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void fil_tosmall(Info & i)
|
||
|
{
|
||
|
const std::wstring & str = i.in.Str();
|
||
|
|
||
|
for(size_t a=0 ; a<str.size() ; ++a)
|
||
|
{
|
||
|
if( str[a]>='A' && str[a]<='Z' )
|
||
|
i.out << R(wchar_t(str[a] - 'A' + 'a'));
|
||
|
else
|
||
|
i.out << R(str[a]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
} // namespace
|