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;
425 void followWithComma(
bool flag);
437 bool usePrettyStyle()
const;
440 int spacesPerLevel()
const;
575 template <
class TYPE>
584 template <
class TYPE>
650void SimpleFormatter::followWithComma(
bool flag)
656void SimpleFormatter::indent()
662void SimpleFormatter::printComma()
667 d_outputStream <<
',';
669 if (usePrettyStyle()) {
670 d_outputStream <<
'\n';
674 d_memberNameSupplied =
false;
680 if (usePrettyStyle()) {
691 d_outputStream << (usePrettyStyle() ?
": " :
":");
696int SimpleFormatter::spacesPerLevel()
const
702bool SimpleFormatter::usePrettyStyle()
const
714 followWithComma(
false);
718 d_memberNameSupplied =
true;
726 bool needIndent = usePrettyStyle() && !d_memberNameSupplied;
729 followWithComma(
true);
735 d_outputStream <<
"null";
744 followWithComma(
true);
748 d_outputStream <<
"null";
756 bool needIndent = usePrettyStyle() && !d_memberNameSupplied;
759 followWithComma(
true);
766 d_outputStream, value, &d_encoderOptions);
775 followWithComma(
true);
780 d_outputStream, value, &d_encoderOptions);
787 return d_started && (1 == d_callSequence.
length());
795 return d_callSequence.
length() > 1 &&
796 d_callSequence[d_callSequence.
length() - 1];
804 return d_callSequence.
length() > 1 &&
805 !d_callSequence[d_callSequence.
length() - 1];
Definition baljsn_encoderoptions.h:290
@ e_PRETTY
Definition baljsn_encoderoptions.h:353
baljsn::EncoderOptions::EncodingStyle encodingStyle() const
Definition baljsn_encoderoptions.h:1043
int spacesPerLevel() const
Definition baljsn_encoderoptions.h:1037
Definition bdlc_bitarray.h:525
bsl::size_t length() const
Return the number of bits in this array.
Definition bdlc_bitarray.h:1886
bslma::Allocator * allocator() const
Return the allocator used by this object to supply memory.
Definition bdlc_bitarray.h:1918
Definition bslstl_stringview.h:471
Definition bslma_allocator.h:545
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition baljsn_convertfromjsonoptions.h:112
static int printValue(bsl::ostream &stream, bool value, const EncoderOptions *options=0)
Definition baljsn_printutil.h:442
static bsl::ostream & indent(bsl::ostream &stream, int level, int spacesPerLevel=4)
Definition bslma_usesbslmaallocator.h:344