Line data Source code
1 : /*! 2 : * \file esys/repo/git/diffdelta.cpp 3 : * \brief 4 : * 5 : * \cond 6 : * __legal_b__ 7 : * 8 : * Copyright (c) 2020 Michel Gillet 9 : * Distributed under the MIT License. 10 : * (See accompanying file LICENSE.txt or 11 : * copy at https://opensource.org/licenses/MIT) 12 : * 13 : * __legal_e__ 14 : * \endcond 15 : * 16 : */ 17 : 18 : #include "esys/repo/esysrepo_prec.h" 19 : #include "esys/repo/git/diffdelta.h" 20 : 21 : namespace esys::repo::git 22 : { 23 : 24 6 : DiffDelta::DiffDelta() = default; 25 : 26 6 : DiffDelta::~DiffDelta() = default; 27 : 28 0 : void DiffDelta::set_type(DiffDeltaType type) 29 : { 30 0 : m_type = type; 31 0 : } 32 : 33 0 : DiffDeltaType DiffDelta::get_type() const 34 : { 35 0 : return m_type; 36 : } 37 : 38 6 : void DiffDelta::set_similatiry(std::size_t similarity) 39 : { 40 6 : m_similarity = similarity; 41 6 : } 42 : 43 0 : std::size_t DiffDelta::get_similarity() const 44 : { 45 0 : return m_similarity; 46 : } 47 : 48 6 : void DiffDelta::set_file_count(std::size_t file_count) 49 : { 50 6 : m_file_count = file_count; 51 6 : } 52 : 53 0 : std::size_t DiffDelta::get_file_count() const 54 : { 55 0 : return m_file_count; 56 : } 57 : 58 16 : DiffFile &DiffDelta::get_old_file() 59 : { 60 16 : return m_old_file; 61 : } 62 : 63 0 : const DiffFile &DiffDelta::get_old_file() const 64 : { 65 0 : return m_old_file; 66 : } 67 : 68 6 : DiffFile &DiffDelta::get_new_file() 69 : { 70 6 : return m_new_file; 71 : } 72 : 73 0 : const DiffFile &DiffDelta::get_new_file() const 74 : { 75 0 : return m_new_file; 76 : } 77 : 78 0 : bool DiffDelta::operator==(const DiffDelta &other) const 79 : { 80 0 : if (get_type() != other.get_type()) return false; 81 0 : if (get_similarity() != other.get_similarity()) return false; 82 0 : if (get_file_count() != other.get_file_count()) return false; 83 0 : if (get_old_file() != other.get_old_file()) return false; 84 0 : if (get_new_file() != other.get_new_file()) return false; 85 : return true; 86 : } 87 : 88 0 : bool DiffDelta::operator!=(const DiffDelta &other) const 89 : { 90 0 : return !operator==(other); 91 : } 92 : 93 : } // namespace esys::repo::git