8#ifndef INCLUDED_BALJSN_PRINTUTIL
9#define INCLUDED_BALJSN_PRINTUTIL
120#include <balscm_version.h>
139#include <bsl_c_stdio.h>
140#include <bsl_cmath.h>
141#include <bsl_iomanip.h>
143#include <bsl_limits.h>
144#include <bsl_ostream.h>
145#include <bsl_string.h>
146#include <bsl_string_view.h>
166 template <
class TYPE>
189 template <
class TYPE>
197 template <
class TYPE>
223 unsigned short value,
342 stream <<
"\"+inf\"";
350 stream <<
"\"-inf\"";
366 const int precision = maxStreamPrecision<TYPE>(options);
368 if (0 == precision) {
370 char buffer[NumFmt::ToCharsMaxLength<TYPE>::k_VALUE];
372 const char *
const endPtr = NumFmt::toChars(buffer,
373 buffer +
sizeof buffer,
377 const size_t len = endPtr - buffer;
379 stream.write(buffer, len);
382 const int k_SIZE = 32;
384#if defined(BSLS_PLATFORM_CMP_MSVC)
385#define snprintf _snprintf
387 const int len = snprintf(buffer,
392#if defined(BSLS_PLATFORM_CMP_MSVC)
395 stream.write(buffer, len);
414 stream << (value ?
"true" :
"false");
450 stream << static_cast<int>(value);
456 unsigned short value,
510 signed char tmp(value);
512 stream << static_cast<int>(tmp);
521 stream << static_cast<int>(value);
562 stream <<
'"' << value <<
'"';
600 const DateOrDateTz& value,
608 const DatetimeOrDatetimeTz& value,
609 const EncoderOptions *options)
Definition baljsn_encoderoptions.h:262
bool encodeInfAndNaNAsStrings() const
Definition baljsn_encoderoptions.h:947
int maxFloatPrecision() const
Definition baljsn_encoderoptions.h:959
int maxDoublePrecision() const
Definition baljsn_encoderoptions.h:965
int datetimeFractionalSecondPrecision() const
Definition baljsn_encoderoptions.h:953
Definition bdlb_variant.h:2514
Definition bdldfp_decimal.h:1834
Definition bdlt_datetz.h:162
Definition bdlt_date.h:294
Definition bdlt_datetimeinterval.h:201
Definition bdlt_datetimetz.h:308
Definition bdlt_datetime.h:331
Definition bdlt_iso8601utilconfiguration.h:225
void setFractionalSecondPrecision(int value)
Definition bdlt_timetz.h:190
Definition bdlt_time.h:196
Definition bslstl_stringview.h:441
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition baljsn_datumdecoderoptions.h:113
Definition baljsn_printutil.h:157
bdlb::Variant2< bdlt::Time, bdlt::TimeTz > TimeOrTimeTz
Definition baljsn_printutil.h:178
static int printDateAndTime(bsl::ostream &stream, const TYPE &value, const EncoderOptions *options)
Definition baljsn_printutil.h:315
bdlb::Variant2< bdlt::Datetime, bdlt::DatetimeTz > DatetimeOrDatetimeTz
Definition baljsn_printutil.h:183
static int printValue(bsl::ostream &stream, bdldfp::Decimal64 value, const EncoderOptions *options=0)
static int printFloatingPoint(bsl::ostream &stream, TYPE value, const EncoderOptions *options)
Definition baljsn_printutil.h:335
static int printValue(bsl::ostream &stream, const DatetimeOrDatetimeTz &value, const EncoderOptions *options=0)
bdlb::Variant2< bdlt::Date, bdlt::DateTz > DateOrDateTz
Definition baljsn_printutil.h:174
static int printString(bsl::ostream &stream, const bsl::string_view &value)
Definition baljsn_printutil.h:403
static int printValue(bsl::ostream &stream, bool value, const EncoderOptions *options=0)
Definition baljsn_printutil.h:410
static int printValue(bsl::ostream &stream, const DateOrDateTz &value, const EncoderOptions *options=0)
static FineClassification classifyFine(float number)
@ k_SNAN
Definition bdlb_float.h:249
@ k_NEGATIVE_INFINITY
Definition bdlb_float.h:247
@ k_QNAN
Definition bdlb_float.h:248
@ k_POSITIVE_INFINITY
Definition bdlb_float.h:246
static int writeString(bsl::ostream &stream, const bsl::string_view &string)
@ k_MAX_STRLEN
Definition bdlt_iso8601util.h:761
static int generate(char *buffer, ssize_t bufferLength, const bsls::TimeInterval &object)
Definition bdlt_iso8601util.h:1967
unsigned long long Uint64
Definition bsls_types.h:137
long long Int64
Definition bsls_types.h:132