Line data Source code
1 : /*! 2 : * \file esys/repo/git/commit.cpp 3 : * \brief 4 : * 5 : * \cond 6 : * __legal_b__ 7 : * 8 : * Copyright (c) 2020-2023 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/commit.h" 20 : 21 : #include <ostream> 22 : 23 : namespace esys::repo::git 24 : { 25 : 26 83 : CommitHash::CommitHash() = default; 27 : 28 108 : CommitHash::~CommitHash() = default; 29 : 30 88 : void CommitHash::set_hash(const std::string &hash) 31 : { 32 88 : m_hash = hash; 33 88 : } 34 : 35 22 : const std::string &CommitHash::get_hash() const 36 : { 37 22 : return m_hash; 38 : } 39 : 40 49 : std::string &CommitHash::get_hash() 41 : { 42 49 : return m_hash; 43 : } 44 : 45 0 : bool CommitHash::operator==(const CommitHash &other) const 46 : { 47 0 : return get_hash() == other.get_hash(); 48 : } 49 : 50 0 : bool CommitHash::operator!=(const CommitHash &other) const 51 : { 52 0 : return get_hash() != other.get_hash(); 53 : } 54 : 55 : } // namespace esys::repo::git 56 : 57 : namespace std 58 : { 59 : 60 0 : ESYSREPO_API ostream &operator<<(ostream &os, const esys::repo::git::CommitHash &commit_hash) 61 : { 62 0 : os << commit_hash.get_hash(); 63 0 : return os; 64 : } 65 : 66 : } // namespace std