updated: to the new EZC api (ezc functions can be methods of some special objects)

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1012 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2015-06-14 18:24:08 +00:00
parent d8451ceaa0
commit f54df8d600
20 changed files with 948 additions and 836 deletions

View File

@@ -59,6 +59,7 @@ PatternCacher pattern_cacher; // patterns for user items (files with an exec
Locale locale;
EzcFun ezc_functions;
Ezc::Blocks ezc_blocks;
Ezc::Objects<HtmlTextStream> ezc_objects;
LocaleFilter locale_filter;
HTMLFilter html_filter;
@@ -735,8 +736,25 @@ void Templates::CreateFunctions()
ezc_functions.Insert("content", content);
plugin.Call((Session*)0, WINIX_TEMPLATES_CREATEFUNCTIONS, &ezc_functions);
log << log3 << "Templates: there are " << ezc_functions.Size() << " ezc functions" << logend;
plugin.Call((Session*)0, WINIX_TEMPLATES_CREATEFUNCTIONS, &ezc_functions, &ezc_objects);
Ezc::Objects<HtmlTextStream>::Iterator i = ezc_objects.Begin();
size_t objects_size = 0, methods_size = 0;
for( ; i != ezc_objects.End() ; ++i)
{
objects_size += 1;
(*i)->ClearFunctions();
(*i)->AddFunctions();
methods_size += (*i)->FunctionsSize();
}
log << log3 << "Templates: there are " << ezc_functions.Size() << " global ezc functions" << logend;
log << log3 << "Templates: there are " << objects_size << " ezc objects with " << methods_size << " ezc methods" << logend;
}
@@ -912,8 +930,9 @@ using namespace TemplatesFunctions;
plugin.Call((Session*)0, WINIX_ADD_TEMPLATE);
patterns.RebuildCache();
ezc_blocks.CacheBlocks(ezc_blocks);
ezc_blocks.CacheObjects(ezc_objects);
ezc_blocks.CacheFunctions(ezc_functions);
ezc_blocks.CacheBlocks(ezc_blocks);
pattern_cacher.RebuildCache();
SetHtmlFilter();
@@ -1113,12 +1132,17 @@ Templates::Templates()
{
using namespace TemplatesFunctions;
patterns.SetEzcObjects(&ezc_objects);
patterns.SetEzcFunctions(&ezc_functions);
patterns.SetEzcBlocks(&ezc_blocks);
patterns.SetLocale(&locale);
patterns.SetLocaleFilter(&locale_filter);
index_patterns.SetPatterns(&patterns);
change_patterns.SetPatterns(&patterns);
pattern_cacher.SetEzcObjects(&ezc_objects);
pattern_cacher.SetEzcFunctions(&ezc_functions);
pattern_cacher.SetEzcBlocks(&ezc_blocks);
}