2010-01-28 16:39:01 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2010-01-28 16:39:01 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_templates_misc
|
|
|
|
#define headerfile_winix_templates_misc
|
2010-01-28 16:39:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include "localefilter.h"
|
|
|
|
#include "ezc.h"
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
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);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
#include "htmltextstream.h"
|
2010-10-19 02:31:20 +02:00
|
|
|
#include "core/user.h"
|
2010-01-28 16:39:01 +01:00
|
|
|
|
|
|
|
|
2010-07-04 22:27:14 +02:00
|
|
|
namespace TemplatesFunctions
|
2010-01-28 16:39:01 +01:00
|
|
|
{
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
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);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
typedef Ezc::Functions<HtmlTextStream> EzcFun;
|
|
|
|
typedef Ezc::Generator<HtmlTextStream> EzcGen;
|
|
|
|
typedef Ezc::FunInfo<HtmlTextStream> Info;
|
|
|
|
|
|
|
|
template<class RawType>
|
|
|
|
HtmlTextStream::RawText<RawType> R(const RawType & par)
|
|
|
|
{
|
|
|
|
return HtmlTextStream::RawText<RawType>(par);
|
|
|
|
}
|
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
|
|
|
|
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
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);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
//void HtmlEscape(TextStream<std::wstring> & out, const std::wstring & in);
|
|
|
|
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in);
|
|
|
|
//std::wstring HtmlEscape(const std::wstring & in);
|
|
|
|
//std::wstring HtmlEscapeFormTxt(const std::wstring & in);
|
2010-11-21 01:19:17 +01:00
|
|
|
|
|
|
|
|
2010-02-15 01:31:14 +01:00
|
|
|
// table: [language][file]
|
2010-01-28 16:39:01 +01:00
|
|
|
typedef std::vector<std::vector<Ezc::Pattern> > Patterns;
|
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
void print_date_nice(Info & i, const tm & rtm);
|
|
|
|
void print_user_name(Info & i, const User * puser, const std::wstring & guest_name);
|
2010-10-19 02:31:20 +02:00
|
|
|
|
2010-07-05 17:21:06 +02:00
|
|
|
int ParseCKeditorFun();
|
2010-02-15 01:31:14 +01:00
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
|
2010-11-25 23:42:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
// those functions from here are used in the second thread too
|
|
|
|
|
2010-11-25 23:42:24 +01:00
|
|
|
template<class StreamType>
|
|
|
|
void Read(Patterns & patterns, size_t pat, Locale & locale, LocaleFilter & locale_filter,
|
|
|
|
Ezc::Functions<StreamType> & ezc_fun, const wchar_t * file, bool read_file_as_utf8,
|
|
|
|
const std::wstring & templates_dir, const std::wstring & templates_dir_default,
|
|
|
|
bool delete_white = false)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
size_t len = patterns.size();
|
|
|
|
|
|
|
|
for(i=0 ; i<len ; ++i)
|
|
|
|
{
|
|
|
|
if( pat < patterns[i].size() )
|
|
|
|
{
|
|
|
|
patterns[i][pat].UTF8(read_file_as_utf8);
|
|
|
|
patterns[i][pat].DeleteWhiteTextItems(delete_white);
|
|
|
|
patterns[i][pat].Directory(templates_dir, templates_dir_default);
|
|
|
|
patterns[i][pat].ParseFile(file);
|
|
|
|
patterns[i][pat].CacheFunctions(ezc_fun);
|
|
|
|
|
2011-02-24 18:06:12 +01:00
|
|
|
locale_filter.Filter(patterns[i][pat], locale, i);
|
2010-11-25 23:42:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-04 22:27:14 +02:00
|
|
|
} // namespace TemplatesFunctions
|
2010-01-28 16:39:01 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|