Line data Source code
1 : /*! 2 : * \file esys/repo/libgit2/ostream_libgit2.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/libgit2/ostream.h" 20 : 21 : #include <string> 22 : 23 : namespace std 24 : { 25 : 26 0 : void print_helper(std::ostream &os, const std::string &name, const char *value) 27 : { 28 0 : os << name << " : "; 29 0 : if (value != nullptr) 30 0 : os << value; 31 : else 32 0 : os << "<nullptr>"; 33 0 : os << std::endl; 34 0 : } 35 : 36 0 : ESYSREPO_API ostream &operator<<(ostream &os, git_remote *data) 37 : { 38 0 : if (data == nullptr) 39 : { 40 0 : os << "<nullptr>"; 41 0 : return os; 42 : } 43 : 44 0 : print_helper(os, "name", git_remote_name(data)); 45 0 : print_helper(os, "url", git_remote_url(data)); 46 : 47 0 : return os; 48 : } 49 : 50 : } // namespace std