Line data Source code
1 : /*! 2 : * \file esys/repo/git/commithash.h 3 : * \brief Hold information about a commit 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 : #pragma once 19 : 20 : #include "esys/repo/esysrepo_defs.h" 21 : 22 : #include <string> 23 : 24 : //<swig_inc/> 25 : 26 : namespace esys::repo::git 27 : { 28 : 29 : /*! \class CommitHash esys/repo/git/commithash.h "esys/repo/git/commithash.h" 30 : * \brief Hold information about a commit 31 : */ 32 25 : class ESYSREPO_API CommitHash 33 : { 34 : public: 35 : //! Default constructor 36 : CommitHash(); 37 : 38 : //! Destructor 39 : virtual ~CommitHash(); 40 : 41 : //! Set the commit hash 42 : /*! 43 : * \param[in] hash the commit hash 44 : */ 45 : void set_hash(const std::string &hash); 46 : 47 : //! Get the commit hash 48 : /*! 49 : * \return the commit hash 50 : */ 51 : const std::string &get_hash() const; //<swig_out/> 52 : 53 : //! Get the commit hash 54 : /*! 55 : * \return the commit hash 56 : */ 57 : std::string &get_hash(); 58 : 59 : //! Equal to comparison operator 60 : bool operator==(const CommitHash &other) const; 61 : 62 : //! Not equal to comparison operator 63 : bool operator!=(const CommitHash &other) const; 64 : 65 : private: 66 : //!< \cond DOXY_IMPL 67 : std::string m_hash; 68 : //!< \endcond 69 : }; 70 : 71 : } // namespace esys::repo::git 72 : 73 : namespace std 74 : { 75 : ESYSREPO_API ostream &operator<<(ostream &os, const esys::repo::git::CommitHash &commit_has); //<swig_out/> 76 : }