LCOV - code coverage report
Current view: top level - src/libs/tools/include/merging - onesidestrategy.hpp (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 2 2 100.0 %
Date: 2019-09-12 12:28:41 Functions: 1 2 50.0 %

          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_ */

Generated by: LCOV version 1.13