added: Patterns class (in templates)

ezc patterns are managed by this class
added: some work in groupitem plugin (not finished yet)
changed: ConfParser can read a string from memory now
         (need some testing yet)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@757 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-08-25 23:53:49 +00:00
parent ee6500ac65
commit 5b8a9c0108
46 changed files with 2896 additions and 1715 deletions

View File

@@ -16,11 +16,14 @@
#include "localefilter.h"
#include "ezc.h"
#include "htmltextstream.h"
#include "core/user.h"
class User;
namespace TemplatesFunctions
{
typedef Ezc::Functions<HtmlTextStream> EzcFun;
typedef Ezc::Generator<HtmlTextStream> EzcGen;
typedef Ezc::FunInfo<HtmlTextStream> Info;
@@ -32,54 +35,13 @@ HtmlTextStream::RawText<RawType> R(const RawType & par)
}
//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);
// table: [language][file]
typedef std::vector<std::vector<Ezc::Pattern> > Patterns;
void print_date_nice(Info & i, const tm & rtm);
void print_user_name(Info & i, const User * puser, const std::wstring & guest_name);
// those functions from here are used in the second thread too
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);
locale_filter.Filter(patterns[i][pat], locale, i);
}
}
}
} // namespace TemplatesFunctions
#endif