Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:14:59

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_KIND_HPP
0011 #define BOOST_JSON_KIND_HPP
0012 
0013 #include <boost/json/detail/config.hpp>
0014 #include <boost/json/string_view.hpp>
0015 #include <iosfwd>
0016 
0017 namespace boost {
0018 namespace json {
0019 
0020 /** Constants for identifying the type of a value
0021 
0022     These values are returned from @ref value::kind
0023 */
0024 // Order matters
0025 enum class kind : unsigned char
0026 {
0027     /// The null value.
0028     null,
0029 
0030     /// A `bool`.
0031     bool_,
0032 
0033     /// A `std::int64_t`
0034     int64,
0035 
0036     /// A `std::uint64_t`
0037     uint64,
0038 
0039     /// A `double`.
0040     double_,
0041 
0042     /// A @ref string.
0043     string,
0044 
0045     /// An @ref array.
0046     array,
0047 
0048     /// An @ref object.
0049     object
0050 };
0051 
0052 /** Return a string representing a kind.
0053 
0054     This provides a human-readable string
0055     representing a @ref kind. This may be
0056     useful for diagnostics.
0057 
0058     @returns The string.
0059 
0060     @param k The kind.
0061 */
0062 BOOST_JSON_DECL
0063 string_view
0064 to_string(kind k) noexcept;
0065 
0066 /** Format a kind to an output stream.
0067 
0068     This allows a @ref kind to be formatted as
0069     a string, typically for diagnostics.
0070 
0071     @returns The output stream.
0072 
0073     @param os The output stream to format to.
0074 
0075     @param k The kind to format.
0076 */
0077 BOOST_JSON_DECL
0078 std::ostream&
0079 operator<<(std::ostream& os, kind k);
0080 
0081 /** A tag type used to select a @ref value constructor overload.
0082 
0083     The library provides the constant @ref array_kind
0084     which may be used to select the @ref value constructor
0085     that creates an empty @ref array.
0086 
0087     @see @ref array_kind
0088 */
0089 struct array_kind_t
0090 {
0091 };
0092 
0093 /** A tag type used to select a @ref value constructor overload.
0094 
0095     The library provides the constant @ref object_kind
0096     which may be used to select the @ref value constructor
0097     that creates an empty @ref object.
0098 
0099     @see @ref object_kind
0100 */
0101 struct object_kind_t
0102 {
0103 };
0104 
0105 /** A tag type used to select a @ref value constructor overload.
0106 
0107     The library provides the constant @ref string_kind
0108     which may be used to select the @ref value constructor
0109     that creates an empty @ref string.
0110 
0111     @see @ref string_kind
0112 */
0113 struct string_kind_t
0114 {
0115 };
0116 
0117 /** A constant used to select a @ref value constructor overload.
0118 
0119     The library provides this constant to allow efficient
0120     construction of a @ref value containing an empty @ref array.
0121 
0122     @par Example
0123     @code
0124     storage_ptr sp;
0125     value jv( array_kind, sp ); // sp is an optional parameter
0126     @endcode
0127 
0128     @see @ref array_kind_t
0129 */
0130 BOOST_JSON_INLINE_VARIABLE(array_kind, array_kind_t);
0131 
0132 /** A constant used to select a @ref value constructor overload.
0133 
0134     The library provides this constant to allow efficient
0135     construction of a @ref value containing an empty @ref object.
0136 
0137     @par Example
0138     @code
0139     storage_ptr sp;
0140     value jv( object_kind, sp ); // sp is an optional parameter
0141     @endcode
0142 
0143     @see @ref object_kind_t
0144 */
0145 BOOST_JSON_INLINE_VARIABLE(object_kind, object_kind_t);
0146 
0147 /** A constant used to select a @ref value constructor overload.
0148 
0149     The library provides this constant to allow efficient
0150     construction of a @ref value containing an empty @ref string.
0151 
0152     @par Example
0153     @code
0154     storage_ptr sp;
0155     value jv( string_kind, sp ); // sp is an optional parameter
0156     @endcode
0157 
0158     @see @ref string_kind_t
0159 */
0160 BOOST_JSON_INLINE_VARIABLE(string_kind, string_kind_t);
0161 
0162 } // namespace json
0163 } // namespace boost
0164 
0165 #endif