Files
rippled/include/xrpl/json/Output.h
Bart 34ef577604 refactor: Replace include guards by '#pragma once' (#6322)
This change replaces all include guards in the `src/` and `include/` directories by `#pragma once`.
2026-02-04 09:50:21 -05:00

37 lines
873 B
C++

#pragma once
#include <boost/beast/core/string.hpp>
#include <functional>
#include <string>
namespace Json {
class Value;
using Output = std::function<void(boost::beast::string_view const&)>;
inline Output
stringOutput(std::string& s)
{
return [&](boost::beast::string_view const& b) { s.append(b.data(), b.size()); };
}
/** Writes a minimal representation of a Json value to an Output in O(n) time.
Data is streamed right to the output, so only a marginal amount of memory is
used. This can be very important for a very large Json::Value.
*/
void
outputJson(Json::Value const&, Output const&);
/** Return the minimal string representation of a Json::Value in O(n) time.
This requires a memory allocation for the full size of the output.
If possible, use outputJson().
*/
std::string
jsonAsString(Json::Value const&);
} // namespace Json