Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:34:41

0001 //
0002 // Copyright (c) 2024 Dmitry Arkhipov (grisumbras@yandex.ru)
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_DETAIL_LITERALS_HPP
0011 #define BOOST_JSON_DETAIL_LITERALS_HPP
0012 
0013 #include <boost/json/detail/config.hpp>
0014 #include <boost/mp11/integral.hpp>
0015 
0016 namespace boost {
0017 namespace json {
0018 namespace detail {
0019 
0020 enum class literals
0021 {
0022     null = 0,
0023     true_,
0024     false_,
0025     infinity,
0026     neg_infinity,
0027     nan,
0028     resume,
0029 };
0030 
0031 constexpr char const* literal_strings[] = {
0032     "null",
0033     "true",
0034     "false",
0035     "Infinity",
0036     "-Infinity",
0037     "NaN",
0038     "",
0039 };
0040 
0041 constexpr std::size_t literal_sizes[] = {
0042     4,
0043     4,
0044     5,
0045     8,
0046     9,
0047     3,
0048     0,
0049 };
0050 
0051 template<literals L>
0052 using literals_c = std::integral_constant<literals, L>;
0053 
0054 constexpr
0055 unsigned char
0056 literal_index(literals l)
0057 {
0058     return static_cast<unsigned char>(l);
0059 }
0060 
0061 } // namespace detail
0062 } // namespace json
0063 } // namespace boost
0064 
0065 #endif // BOOST_JSON_DETAIL_LITERALS_HPP