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

Provides raptor::json_writer. More...

#include <concepts>
#include <cstdint>
#include <iosfwd>
#include <string>
#include <string_view>
#include <vector>
+ Include dependency graph for json_writer.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  raptor::json_writer::container
 The state of an open container. More...
 
class  raptor::json_writer
 Writes JSON to a stream, indented by two spaces. More...
 

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

Provides 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