1 namespace simdjson { 2 namespace SIMDJSON_IMPLEMENTATION { 3 namespace ondemand { 4 5 /** 6 * The type of a JSON value. 7 */ 8 enum class json_type { 9 // Start at 1 to catch uninitialized / default values more easily 10 array=1, ///< A JSON array ( [ 1, 2, 3 ... ] ) 11 object, ///< A JSON object ( { "a": 1, "b" 2, ... } ) 12 number, ///< A JSON number ( 1 or -2.3 or 4.5e6 ...) 13 string, ///< A JSON string ( "a" or "hello world\n" ...) 14 boolean, ///< A JSON boolean (true or false) 15 null ///< A JSON null (null) 16 }; 17 18 /** 19 * Write the JSON type to the output stream 20 * 21 * @param out The output stream. 22 * @param type The json_type. 23 */ 24 inline std::ostream& operator<<(std::ostream& out, json_type type) noexcept; 25 26 #if SIMDJSON_EXCEPTIONS 27 /** 28 * Send JSON type to an output stream. 29 * 30 * @param out The output stream. 31 * @param type The json_type. 32 * @throw simdjson_error if the result being printed has an error. If there is an error with the 33 * underlying output stream, that error will be propagated (simdjson_error will not be 34 * thrown). 35 */ 36 inline std::ostream& operator<<(std::ostream& out, simdjson_result<json_type> &type) noexcept(false); 37 #endif 38 39 } // namespace ondemand 40 } // namespace SIMDJSON_IMPLEMENTATION 41 } // namespace simdjson 42 43 namespace simdjson { 44 45 template<> 46 struct simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::json_type> : public SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::json_type> { 47 public: 48 simdjson_really_inline simdjson_result(SIMDJSON_IMPLEMENTATION::ondemand::json_type &&value) noexcept; ///< @private 49 simdjson_really_inline simdjson_result(error_code error) noexcept; ///< @private 50 simdjson_really_inline simdjson_result() noexcept = default; 51 simdjson_really_inline ~simdjson_result() noexcept = default; ///< @private 52 }; 53 54 } // namespace simdjson 55