/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2010, Tomasz Sowa * All rights reserved. * */ #ifndef headerfilecmslutemplatesindexpatterns #define headerfilecmslutemplatesindexpatterns #include #include #include #include "ezc.h" #include "misc.h" #include "localefilter.h" #include "locale.h" #include "core/config.h" class IndexPatterns { public: IndexPatterns(); void SetConfig(Config * pconfig); void SetEzcFunctions(TemplatesFunctions::EzcFun * fun); // can return null pointer if there is not such a pattern Ezc::Pattern * GetPattern(const std::wstring & file, Locale::Lang lang); void AddPattern(const std::wstring & file, Locale & locale, LocaleFilter & locale_filter, bool delete_white); void AddPatternIfNotExists(const std::wstring & file, Locale & locale, LocaleFilter & locale_filter, bool delete_white); // adding a file name without reading the pattern // the pattern will be read during ReloadPatterns() void AddFileName(const std::wstring & file); void ReloadPatterns(Locale & locale, LocaleFilter & locale_filter, bool delete_white); void MarkAllToDelete(); void DeleteMarked(); private: Config * config; // can be null (not set directly) TemplatesFunctions::EzcFun * ezc_fun; struct Template { bool to_delete; // table[lang] std::vector patterns; }; typedef std::map Tab; Tab tab; void ReadPattern(Tab::iterator & i, Locale & locale, LocaleFilter & locale_filter, bool delete_white); }; #endif