OSDN Git Service

An attempt to reduce build time
[winmerge-jp/winmerge-jp.git] / Src / LineFiltersList.h
1 /** 
2  * @file  LineFiltersList.h
3  *
4  * @brief Declaration file for LineFiltersList class
5  */
6 #pragma once
7
8 #include <vector>
9 #include <memory>
10 #include "UnicodeString.h"
11
12 class COptionsMgr;
13
14 /**
15  @brief Structure for one line filter.
16  */
17 struct LineFilterItem
18 {
19         bool enabled; /**< Is filter enabled? */
20         String filterStr; /**< Filter string */
21         LineFilterItem() : enabled(false) { }
22 };
23
24 typedef std::shared_ptr<LineFilterItem> LineFilterItemPtr;
25
26 /**
27  @brief List of line filters.
28  */
29 class LineFiltersList
30 {
31 public:
32         LineFiltersList();
33         ~LineFiltersList();
34
35         void AddFilter(const String& filter, bool enabled);
36         size_t GetCount() const;
37         void Empty();
38         String GetAsString() const;
39         const LineFilterItem & GetAt(size_t ind) const;
40         void CloneFrom(const LineFiltersList *list);
41         bool Compare(const LineFiltersList *list) const;
42
43         void Initialize(COptionsMgr *pOptionsMgr);
44         void SaveFilters();
45
46 private:
47         std::vector<LineFilterItemPtr> m_items; /**< List for linefilter items */
48         COptionsMgr * m_pOptionsMgr; /**< Options-manager for storage */
49 };
50
51 /**
52  * @brief Returns count of items in the list.
53  * @return Count of filters in the list.
54  */
55 inline size_t LineFiltersList::GetCount() const
56 {
57         return m_items.size();
58 }
59
60 /**
61  * @brief Empties the list.
62  */
63 inline void LineFiltersList::Empty()
64 {
65         m_items.clear();
66 }