winix/plugins/stats/templates.cpp

108 lines
1.7 KiB
C++
Raw Normal View History

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "templates.h"
#include "ezc.h"
#include "core/misc.h"
#include "stats.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 "templates/misc.h"
namespace Stats
{
using TemplatesFunctions::Info;
extern long current_item_id;
extern Stats stats;
void stats_from(Info & i)
{
i.out << DateToStrWithoutHours(stats.stats_start);
}
void stats_all(Info & i)
{
i.out << stats.global_all;
}
void stats_unique(Info & i)
{
i.out << stats.global_unique;
}
void stats_google(Info & i)
{
i.out << stats.global_google;
}
void stats_yahoo(Info & i)
{
i.out << stats.global_yahoo;
}
void stats_bing(Info & i)
{
i.out << stats.global_bing;
}
void stats_item_all(Info & i)
{
i.out << stats.stats_tab[current_item_id].all;
}
void stats_item_google(Info & i)
{
i.out << stats.stats_tab[current_item_id].google;
}
void stats_item_yahoo(Info & i)
{
i.out << stats.stats_tab[current_item_id].yahoo;
}
void stats_item_bing(Info & i)
{
i.out << stats.stats_tab[current_item_id].bing;
}
void CreateFunctions(PluginInfo & info)
{
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
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
fun->Insert("stats_from", stats_from);
fun->Insert("stats_all", stats_all);
fun->Insert("stats_unique", stats_unique);
fun->Insert("stats_google", stats_google);
fun->Insert("stats_yahoo", stats_yahoo);
fun->Insert("stats_bing", stats_bing);
fun->Insert("stats_item_all", stats_item_all);
fun->Insert("stats_item_google", stats_item_google);
fun->Insert("stats_item_yahoo", stats_item_yahoo);
fun->Insert("stats_item_bing", stats_item_bing);
}
} // namespace