Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief A strategy which always takes the value from one side
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : *
8 : */
9 :
10 : #ifndef ONESIDESTRATEGY_HPP_
11 : #define ONESIDESTRATEGY_HPP_
12 :
13 : #include <merging/mergeconflictstrategy.hpp>
14 :
15 : namespace kdb
16 : {
17 :
18 : namespace tools
19 : {
20 :
21 : namespace merging
22 : {
23 : // This strategy is able to resolve every kind of conflict by always
24 : // using the key of the winning side. Note that this also includes removing
25 : // keys if the keys were deleted at the winning side.
26 14 : class OneSideStrategy : public MergeConflictStrategy
27 : {
28 :
29 : public:
30 : ConflictResolutionSide winningSide;
31 :
32 14 : explicit OneSideStrategy (ConflictResolutionSide _winningSide) : winningSide (_winningSide)
33 : {
34 : }
35 :
36 : virtual void resolveConflict (const MergeTask & task, Key & conflictKey, MergeResult & result) override;
37 : };
38 : } // namespace merging
39 : } // namespace tools
40 : } // namespace kdb
41 :
42 : #endif /* ONESIDESTRATEGY_HPP_ */
|