LCOV - code coverage report
Current view: top level - src/esys/repo/git - noteid_git.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 11 26 42.3 %
Date: 2026-08-01 10:43:40 Functions: 6 11 54.5 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/git/noteid_git.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 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/noteid.h"
      20             : 
      21             : namespace esys::repo::git
      22             : {
      23             : 
      24           3 : NoteId::NoteId() = default;
      25             : 
      26           3 : NoteId::~NoteId() = default;
      27             : 
      28           4 : void NoteId::set_reference(const std::string &reference)
      29             : {
      30           4 :     m_reference = reference;
      31           4 : }
      32             : 
      33           1 : const std::string &NoteId::get_reference() const
      34             : {
      35           1 :     return m_reference;
      36             : }
      37             : 
      38           0 : void NoteId::set_commit_hash(const CommitHash &commit_hash)
      39             : {
      40           0 :     m_commit_hash = commit_hash;
      41           0 : }
      42             : 
      43           1 : const CommitHash &NoteId::get_commit_hash() const
      44             : {
      45           1 :     return m_commit_hash;
      46             : }
      47             : 
      48           4 : CommitHash &NoteId::get_commit_hash()
      49             : {
      50           4 :     return m_commit_hash;
      51             : }
      52             : 
      53           0 : bool NoteId::operator==(const NoteId &other) const
      54             : {
      55           0 :     bool result = CommitHash::operator==(other);
      56           0 :     if (!result) return false;
      57           0 :     if (get_reference() != other.get_reference()) return false;
      58           0 :     if (get_commit_hash() != other.get_commit_hash()) return false;
      59             :     return true;
      60             : }
      61             : 
      62           0 : bool NoteId::operator!=(const NoteId &other) const
      63             : {
      64           0 :     return !operator==(other);
      65             : }
      66             : 
      67             : } // namespace esys::repo::git
      68             : 
      69             : namespace std
      70             : {
      71             : 
      72           0 : ESYSREPO_API ostream &operator<<(ostream &os, const esys::repo::git::NoteId &note_id)
      73             : {
      74           0 :     os << "note hash   : " << (const esys::repo::git::CommitHash &)note_id << std::endl;
      75           0 :     os << "reference   : " << note_id.get_reference() << std::endl;
      76           0 :     os << "commit hash : " << note_id.get_commit_hash() << std::endl;
      77           0 :     return os;
      78             : }
      79             : 
      80             : } // namespace std

Generated by: LCOV version 1.14