Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:01

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/json
0008 //
0009 
0010 #ifndef BOOST_JSON_IMPL_KIND_IPP
0011 #define BOOST_JSON_IMPL_KIND_IPP
0012 
0013 #include <boost/json/kind.hpp>
0014 #include <ostream>
0015 
0016 namespace boost {
0017 namespace json {
0018 
0019 string_view
0020 to_string(kind k) noexcept
0021 {
0022     switch(k)
0023     {
0024     case kind::array:   return "array";
0025     case kind::object:  return "object";
0026     case kind::string:  return "string";
0027     case kind::int64:   return "int64";
0028     case kind::uint64:  return "uint64";
0029     case kind::double_: return "double";
0030     case kind::bool_:   return "bool";
0031     default: // satisfy warnings
0032     case kind::null:    return "null";
0033     }
0034 }
0035 
0036 std::ostream&
0037 operator<<(std::ostream& os, kind k)
0038 {
0039     os << to_string(k);
0040     return os;
0041 }
0042 
0043 } // namespace json
0044 } // namespace boost
0045 
0046 #endif