LCOV - code coverage report
Current view: top level - src/libs/tools/src/merging - mergeconflictstrategy.cpp (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 15 15 100.0 %
Date: 2019-09-12 12:28:41 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief Implementation of MergeConflictStrategy
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  *
       8             :  */
       9             : 
      10             : #include <merging/mergeconflictstrategy.hpp>
      11             : #include <string>
      12             : 
      13             : using namespace std;
      14             : 
      15             : namespace kdb
      16             : {
      17             : 
      18             : namespace tools
      19             : {
      20             : 
      21             : namespace merging
      22             : {
      23             : 
      24         684 : ConflictOperation MergeConflictStrategy::getOurConflictOperation (const Key & conflictKey)
      25             : {
      26        3420 :         string ourConflictName = conflictKey.getMeta<string> ("conflict/operation/our");
      27        1368 :         ConflictOperation ourOperation = MergeConflictOperation::getFromName (ourConflictName);
      28        1368 :         return ourOperation;
      29             : }
      30             : 
      31         684 : ConflictOperation MergeConflictStrategy::getTheirConflictOperation (const Key & conflictKey)
      32             : {
      33        3420 :         string theirConflictName = conflictKey.getMeta<string> ("conflict/operation/their");
      34        1368 :         ConflictOperation theirOperation = MergeConflictOperation::getFromName (theirConflictName);
      35        1368 :         return theirOperation;
      36             : }
      37             : 
      38         309 : void MergeConflictStrategy::copyKeyValue (const Key & source, Key & destination)
      39             : {
      40         618 :         if (source && destination)
      41             :         {
      42         309 :                 if (source.isString ())
      43             :                 {
      44         726 :                         destination.setString (source.getString ());
      45             :                 }
      46             :                 else
      47             :                 {
      48          67 :                         if (source.getValue () == nullptr)
      49             :                         {
      50             :                                 destination.setBinary (nullptr, 0);
      51             :                         }
      52             :                         else
      53             :                         {
      54         256 :                                 destination.setBinary (source.getBinary ().c_str (), source.getBinarySize ());
      55             :                         }
      56             :                 }
      57             :         }
      58         309 : }
      59             : } // namespace merging
      60             : } // namespace tools
      61             : } // namespace kdb

Generated by: LCOV version 1.13