summaryrefslogtreecommitdiff
path: root/plugins/HistoryStats/src/colbase_words.h
blob: 2d9ef4c667a5d93d620a8f681863b2873df0d196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#if !defined(HISTORYSTATS_GUARD_COLBASE_WORDS_H)
#define HISTORYSTATS_GUARD_COLBASE_WORDS_H

#include "column.h"

class ColBaseWords
	: public Column
{
public:
	typedef std::map<ext::string, InOut> WordMap;
	typedef Settings::WordSet WordSet;
	typedef Settings::ColFilterSet ColFilterSet;
	typedef Settings::Filter Filter;
	typedef std::vector<const Filter*> FilterVecC;

protected:
	int m_nSource;
	int m_nMinLength;
	int m_nMaxLength;
	bool m_bFilterLinks;
	ColFilterSet m_FilterWords;

	OptionsCtrl::Radio m_hSource;
	OptionsCtrl::Edit  m_hMinLength;
	OptionsCtrl::Edit  m_hMaxLength;
	OptionsCtrl::Check m_hFilterLinks;

	bool m_bFilterMessages;
	bool m_bFilterWords;
	FilterVecC m_ActiveMessageFilter;
	FilterVecC m_ActiveWordFilter;

private:
	void addWord(WordMap* pWords, const ext::string& word, bool bOutgoing) const;
	void parseMsg(WordMap* pWords, const ext::string& msg, bool bOutgoing) const;

protected:
	explicit ColBaseWords();

protected:
	virtual int impl_getFeatures() const { return cfHasConfig | cfAcquiresData | cfTransformsData | cfIsColBaseWords; }
	virtual void impl_copyConfig(const Column* pSource);
	virtual void impl_configRead(const SettingsTree& settings);
	virtual void impl_configWrite(SettingsTree& settings) const;
	virtual void impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup);
	virtual void impl_configFromUI(OptionsCtrl& Opt);
	virtual int impl_configGetRestrictions(ext::string*) const { return crHTMLFull; }
	virtual ext::string impl_contactDataGetUID() const;
	virtual void impl_contactDataBeginAcquire();
	virtual void impl_contactDataPrepare(Contact& contact) const;
	virtual void impl_contactDataFree(Contact& contact) const;
	virtual void impl_contactDataAcquireMessage(Contact& contact, Message& msg);
	virtual void impl_contactDataMerge(Contact& contact, const Contact& include) const;

public:
	const ColFilterSet& getFilterWords() const { return m_FilterWords; }
	void setFilterWords(const ColFilterSet& FilterWords) { m_FilterWords = FilterWords; }
};

#endif // HISTORYSTATS_GUARD_COLBASE_WORDS_H