8#ifndef INCLUDED_BALJSN_SIMPLEFORMATTER
9#define INCLUDED_BALJSN_SIMPLEFORMATTER
332#include <balscm_version.h>
341#include <bsl_ostream.h>
351#include <bsl_string_view.h>
384 bsl::ostream& d_outputStream;
394 bool d_memberNameSupplied;
424 void followWithComma(
bool flag);
436 bool usePrettyStyle()
const;
439 int spacesPerLevel()
const;
559 template <
class TYPE>
567 template <
class TYPE>
629void SimpleFormatter::followWithComma(
bool flag)
635void SimpleFormatter::indent()
641void SimpleFormatter::printComma()
646 d_outputStream <<
',';
648 if (usePrettyStyle()) {
649 d_outputStream <<
'\n';
653 d_memberNameSupplied =
false;
659 if (usePrettyStyle()) {
668 d_outputStream << (usePrettyStyle() ?
" : " :
":");
673int SimpleFormatter::spacesPerLevel()
const
679bool SimpleFormatter::usePrettyStyle()
const
691 followWithComma(
false);
695 d_memberNameSupplied =
true;
703 bool needIndent = usePrettyStyle() && !d_memberNameSupplied;
706 followWithComma(
true);
712 d_outputStream <<
"null";
721 followWithComma(
true);
725 d_outputStream <<
"null";
733 bool needIndent = usePrettyStyle() && !d_memberNameSupplied;
736 followWithComma(
true);
743 d_outputStream, value, &d_encoderOptions);
752 followWithComma(
true);
757 d_outputStream, value, &d_encoderOptions);
764 return d_started && (1 == d_callSequence.
length());
772 return d_callSequence.
length() > 1 &&
773 d_callSequence[d_callSequence.
length() - 1];
781 return d_callSequence.
length() > 1 &&
782 !d_callSequence[d_callSequence.
length() - 1];
Definition baljsn_encoderoptions.h:262
@ e_PRETTY
Definition baljsn_encoderoptions.h:316
baljsn::EncoderOptions::EncodingStyle encodingStyle() const
Definition baljsn_encoderoptions.h:929
int spacesPerLevel() const
Definition baljsn_encoderoptions.h:923
Definition bdlc_bitarray.h:521
bsl::size_t length() const
Return the number of bits in this array.
Definition bdlc_bitarray.h:1815
bslma::Allocator * allocator() const
Return the allocator used by this object to supply memory.
Definition bdlc_bitarray.h:1847
Definition bslstl_stringview.h:441
Definition bslma_allocator.h:457
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition baljsn_datumdecoderoptions.h:113
static int printValue(bsl::ostream &stream, bool value, const EncoderOptions *options=0)
Definition baljsn_printutil.h:410
static bsl::ostream & indent(bsl::ostream &stream, int level, int spacesPerLevel=4)
Definition bslma_usesbslmaallocator.h:343