changed: the way how plugins work
all your plugin functions can have signature either: void my_function(PluginInfo & info); or void my_function(); only the main Init should have: extern "C" void Init(PluginFunction & info); added: directory 'plugins' for plugins added: 'stats' plugin git-svn-id: svn://ttmath.org/publicrep/winix/trunk@624 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
91
plugins/stats/templates.cpp
Executable file
91
plugins/stats/templates.cpp
Executable file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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 "data.h"
|
||||
#include "core/misc.h"
|
||||
|
||||
|
||||
|
||||
namespace Stats
|
||||
{
|
||||
|
||||
|
||||
void stats_from(Ezc::Info & i)
|
||||
{
|
||||
i.out << DateToStrWithoutHours(stats_start);
|
||||
|
||||
}
|
||||
|
||||
void stats_all(Ezc::Info & i)
|
||||
{
|
||||
i.out << stat_global.all;
|
||||
}
|
||||
|
||||
void stats_unique(Ezc::Info & i)
|
||||
{
|
||||
i.out << stat_global.unique;
|
||||
}
|
||||
|
||||
void stats_google(Ezc::Info & i)
|
||||
{
|
||||
i.out << stat_global.google;
|
||||
}
|
||||
|
||||
void stats_yahoo(Ezc::Info & i)
|
||||
{
|
||||
i.out << stat_global.yahoo;
|
||||
}
|
||||
|
||||
|
||||
void stats_item_all(Ezc::Info & i)
|
||||
{
|
||||
i.out << stats_tab[ItemId()].all;
|
||||
}
|
||||
|
||||
|
||||
void stats_item_google(Ezc::Info & i)
|
||||
{
|
||||
i.out << stats_tab[ItemId()].google;
|
||||
}
|
||||
|
||||
void stats_item_yahoo(Ezc::Info & i)
|
||||
{
|
||||
i.out << stats_tab[ItemId()].yahoo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateFunctions(PluginInfo & info)
|
||||
{
|
||||
if( !info.p1 )
|
||||
{
|
||||
log << log1 << "S: functions object doesn't set" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
Ezc::Functions * fun = reinterpret_cast<Ezc::Functions*>(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_item_all", stats_item_all);
|
||||
fun->Insert("stats_item_google", stats_item_google);
|
||||
fun->Insert("stats_item_yahoo", stats_item_yahoo);
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user