Raptor 4.0.0-rc.1
A fast and space-efficient pre-filter
Loading...
Searching...
No Matches
json_writer.cpp File Reference

Implements raptor::json_writer. More...

#include <array>
#include <cassert>
#include <charconv>
#include <cmath>
#include <limits>
#include <ostream>
#include <raptor/inspect/json_writer.hpp>
+ Include dependency graph for json_writer.cpp:

Functions

std::string raptor::json_quote (std::string_view const value)
 Returns value as a JSON string literal, including the enclosing quotes.
 
std::string raptor::shortest_double (double const value)
 Returns the shortest representation of value that reads back as the same double.
 

Detailed Description

Implements raptor::json_writer.

Author
Enrico Seiler <enrico.seiler AT fu-berlin.de>

Function Documentation

◆ shortest_double()

std::string raptor::shortest_double ( double const value)

Returns the shortest representation of value that reads back as the same double.

Uses std::to_chars, e.g. 0.05 and 1, not 0.050000 and 1.000000. Not finite values yield nan, inf and -inf, which are not valid JSON; raptor::json_writer::number writes null instead.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
Hide me