OSDN Git Service

Merge remote-tracking branch 'upstream/master' into jp
[winmerge-jp/winmerge-jp.git] / Src / CompareEngines / Wrap_DiffUtils.h
1 /**
2  * @file  Wrap_DiffUtils.h
3  *
4  * @brief Declaration of Wrap_DiffUtils class.
5  */
6 #pragma once
7
8 #include <memory>
9
10 class FilterList;
11 class SubstitutionList;
12 class CompareOptions;
13 struct FileTextStats;
14 class CDiffWrapper;
15 struct DiffFileData;
16
17 namespace CompareEngines
18 {
19
20 /**
21  * @brief A class wrapping GNU diffutils as compare engine.
22  *
23  * This class needs to have all its data as local copies, not as pointers
24  * outside. Lifetime can vary certainly be different from unrelated classes.
25  * Filters list being an exception - pcre structs are too complex to easily
26  * copy so we'll only keep a pointer to external list.
27  */
28 class DiffUtils
29 {
30 public:
31         DiffUtils();
32         ~DiffUtils();
33
34         void SetCodepage(int codepage);
35         void SetCompareOptions(const CompareOptions& options);
36         void SetFilterList(std::shared_ptr<FilterList> plist);
37         void ClearFilterList();
38         void SetSubstitutionList(std::shared_ptr<SubstitutionList> plist);
39         void ClearSubstitutionList();
40
41         int CompareFiles(DiffFileData* diffData);
42         bool Diff2Files(struct change ** diffs, DiffFileData *diffData,
43                         int * bin_status, int * bin_file) const;
44
45         void GetDiffCounts(int & diffs, int & trivialDiffs) const;
46
47 private:
48         int m_ndiffs; /**< Real diffs found. */
49         int m_ntrivialdiffs; /**< Ignored diffs found. */
50         std::unique_ptr<CDiffWrapper> m_pDiffWrapper;
51 };
52
53
54 } // namespace CompareEngines