2010-06-22 01:53:19 +02:00
|
|
|
/*
|
|
|
|
* 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 <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include "ezc.h"
|
|
|
|
#include "localefilter.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "core/locale.h"
|
|
|
|
#include "core/config.h"
|
2010-06-22 01:53:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IndexPatterns
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
void SetConfig(Config * pconfig);
|
|
|
|
|
2010-06-22 01:53:19 +02:00
|
|
|
// can return null pointer if there is not such a pattern
|
|
|
|
Ezc::Pattern * GetPattern(const std::string & file, Locale::Lang lang);
|
|
|
|
void AddPattern(const std::string & file, Locale & locale, LocaleFilter & locale_filter, bool delete_white);
|
|
|
|
void AddPatternIfNotExists(const std::string & 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::string & file);
|
|
|
|
|
|
|
|
void ReloadPatterns(Locale & locale, LocaleFilter & locale_filter, bool delete_white);
|
|
|
|
void MarkAllToDelete();
|
|
|
|
void DeleteMarked();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
Config * config;
|
2010-06-22 01:53:19 +02:00
|
|
|
|
|
|
|
struct Template
|
|
|
|
{
|
|
|
|
bool to_delete;
|
|
|
|
|
|
|
|
// table[lang]
|
|
|
|
std::vector<Ezc::Pattern> patterns;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map<std::string, Template> Tab;
|
|
|
|
Tab tab;
|
|
|
|
|
|
|
|
void ReadPattern(Tab::iterator & i, Locale & locale, LocaleFilter & locale_filter, bool delete_white);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|