8#ifndef INCLUDED_BDLJSN_JSONUTIL
9#define INCLUDED_BDLJSN_JSONUTIL
382#include <bdlscm_version.h>
395#include <bsl_cstdint.h>
396#include <bsl_iosfwd.h>
397#include <bsl_sstream.h>
398#include <bsl_string.h>
399#include <bsl_string_view.h>
436 bsl::istream& input);
441 bsl::streambuf *input);
443 bsl::streambuf *input,
451 Error *errorDescription,
452 bsl::istream& input);
454 Error *errorDescription,
458 Error *errorDescription,
459 bsl::streambuf *input);
461 Error *errorDescription,
462 bsl::streambuf *input,
465 Error *errorDescription,
468 Error *errorDescription,
481 static bsl::ostream&
printError(bsl::ostream& stream,
485 bsl::streambuf *input,
487 static bsl::ostream&
printError(bsl::ostream& stream,
491 static int write(bsl::ostream& output,
493 static int write(bsl::ostream& output,
496 static int write(bsl::streambuf *output,
498 static int write(bsl::streambuf *output,
506#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_PMR_STRING
507 static int write(std::pmr::string *output,
509 static int write(std::pmr::string *output,
519 static int write(std::string *output,
521 static int write(std::string *output,
540 return read(result, &tmp, input, options);
548 return read(result, input, options);
553 bsl::streambuf *input,
557 return read(result, &tmp, input, options);
562 bsl::streambuf *input)
565 return read(result, input, options);
574 return read(result, &tmp, input, options);
582 return read(result, input, options);
587 Error *errorDescription,
592 return read(result, errorDescription, input.rdbuf(), options);
597 Error *errorDescription,
602 return read(result, errorDescription, input, options);
607 Error *errorDescription,
608 bsl::streambuf *input)
612 return read(result, errorDescription, input, options);
617 Error *errorDescription,
622 return read(result, errorDescription, &inputBuf, options);
627 Error *errorDescription,
631 return read(result, errorDescription, input, options);
639 return printError(stream, input.rdbuf(), error);
656 bsl::ostream outputStream(output);
657 return write(outputStream, json, options);
665 return write(output, json, options);
675 int rc =
write(stream, json, options);
677#ifdef BSLS_PLATFORM_CMP_SUN
693 return write(output, json, options);
696#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_PMR_STRING
702#if defined (BSLS_LIBRARYFEATURES_HAS_CPP20_BASELINE_LIBRARY)
703 typedef std::basic_ostringstream<char,
704 std::char_traits<char>,
705 std::pmr::polymorphic_allocator<char> >
708 PmrOstringStream stream(std::ios_base::out, output->get_allocator());
709 int rc =
write(stream, json, options);
711 std::pmr::string tmpOutput = stream.str(output->get_allocator());
716 std::ostringstream stream;
717 int rc =
write(stream, json, options);
727#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_PMR_STRING
732 WriteOptions options;
734 return write(output, json, options);
743 std::ostringstream stream;
745 int rc =
write(stream, json, options);
747 std::string tmpOutput(stream.str());
759 return write(output, json, options);
766 return write(output, json, options);
Definition bdljsn_error.h:155
Definition bdljsn_json.h:1461
Definition bdljsn_readoptions.h:128
Definition bdljsn_writeoptions.h:138
Definition bdlsb_fixedmeminstreambuf.h:187
Definition bslstl_stringview.h:471
BSLS_KEYWORD_CONSTEXPR const_pointer data() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_stringview.h:1988
BSLS_KEYWORD_CONSTEXPR size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the length of this view.
Definition bslstl_stringview.h:1904
Definition bslstl_string.h:1252
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Return the allocator used by this string to supply memory.
Definition bslstl_string.h:7423
Definition bslstl_pair.h:1280
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdljsn_error.h:142
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
Definition bslstl_iosfwd.h:97
Definition bdljsn_jsonutil.h:412
static int write(bsl::ostream &output, const Json &json, const WriteOptions &options)
static int write(bsl::ostream &output, const Json &json)
Definition bdljsn_jsonutil.h:763
static bsl::ostream & printError(bsl::ostream &stream, bsl::istream &input, const Error &error)
Definition bdljsn_jsonutil.h:635
static bsl::ostream & printError(bsl::ostream &stream, bsl::streambuf *input, const Error &error)
bsl::pair< bsl::uint64_t, bsl::uint64_t > LineAndColumnNumber
Definition bdljsn_jsonutil.h:415
static int read(Json *result, bsl::istream &input)
Definition bdljsn_jsonutil.h:544
static int read(Json *result, Error *errorDescription, bsl::streambuf *input, const ReadOptions &options)
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1067