Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief Base class for defining preconfigured merge configurations
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : *
8 : */
9 :
10 : #ifndef MERGECONFIGURATION_HPP_
11 : #define MERGECONFIGURATION_HPP_
12 :
13 : #include <merging/threewaymerge.hpp>
14 :
15 : using namespace std;
16 :
17 : namespace kdb
18 : {
19 :
20 : namespace tools
21 : {
22 :
23 : namespace merging
24 : {
25 :
26 :
27 : // A merge configuration should configure a passed threeway merger with one or
28 : // morge merge configurations. A class subclassing this class may add
29 : // merge strategies to the allocatedStrategies vector and they will be
30 : // freed on destruction
31 804 : class MergeConfiguration
32 : {
33 : protected:
34 : vector<MergeConflictStrategy *> allocatedStrategies;
35 :
36 : public:
37 402 : virtual ~MergeConfiguration ()
38 1206 : {
39 1772 : for (auto & elem : allocatedStrategies)
40 : {
41 164 : delete (elem);
42 : }
43 402 : };
44 : virtual void configureMerger (ThreeWayMerge & merger) = 0;
45 : };
46 : } // namespace merging
47 : } // namespace tools
48 : } // namespace kdb
49 :
50 :
51 : #endif /* MERGECONFIGURATION_HPP_ */
|