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:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -14,10 +14,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "ezc.h"
|
||||
#include "misc.h"
|
||||
#include "localefilter.h"
|
||||
#include "locale.h"
|
||||
#include "core/config.h"
|
||||
#include "patterns.h"
|
||||
|
||||
|
||||
|
||||
@@ -25,43 +22,50 @@ class IndexPatterns
|
||||
{
|
||||
public:
|
||||
|
||||
IndexPatterns();
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetEzcFunctions(TemplatesFunctions::EzcFun * fun);
|
||||
void SetPatterns(Patterns * ppatterns);
|
||||
|
||||
// can return null pointer if there is not such a pattern
|
||||
Ezc::Pattern * GetPattern(const std::wstring & file, size_t 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);
|
||||
/*
|
||||
adding a new pattern
|
||||
if such a pattern exists the method only unmarks the pattern from deleting
|
||||
*/
|
||||
void Add(const std::wstring & file);
|
||||
|
||||
void ReloadPatterns(Locale & locale, LocaleFilter & locale_filter, bool delete_white);
|
||||
|
||||
/*
|
||||
returning a pattern
|
||||
can return null pointer if there is not such a pattern
|
||||
*/
|
||||
Ezc::Pattern * Get(const std::wstring & file, size_t lang);
|
||||
|
||||
|
||||
/*
|
||||
marking all patterns as ready to delete
|
||||
*/
|
||||
void MarkAllToDelete();
|
||||
|
||||
|
||||
/*
|
||||
delete marked patterns
|
||||
if you have called Add(pattern_name) then such a pattern is not deleted
|
||||
*/
|
||||
void DeleteMarked();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Config * config;
|
||||
|
||||
// can be null (not set directly)
|
||||
TemplatesFunctions::EzcFun * ezc_fun;
|
||||
Patterns * patterns;
|
||||
|
||||
struct Template
|
||||
{
|
||||
bool to_delete;
|
||||
|
||||
// table[lang]
|
||||
std::vector<Ezc::Pattern> patterns;
|
||||
size_t index;
|
||||
};
|
||||
|
||||
typedef std::map<std::wstring, Template> Tab;
|
||||
Tab tab;
|
||||
|
||||
void ReadPattern(Tab::iterator & i, Locale & locale, LocaleFilter & locale_filter, bool delete_white);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user