BDE 4.39.x Production Release
Loading...
Searching...
No Matches
baljsn_encoderoptions.h
Go to the documentation of this file.
1/// @file baljsn_encoderoptions.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// baljsn_encoderoptions.h -*-C++-*-
8#ifndef INCLUDED_BALJSN_ENCODEROPTIONS
9#define INCLUDED_BALJSN_ENCODEROPTIONS
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup baljsn_encoderoptions baljsn_encoderoptions
15/// @brief Provide an attribute class for specifying JSON encoding options.
16/// @addtogroup bal
17/// @{
18/// @addtogroup baljsn
19/// @{
20/// @addtogroup baljsn_encoderoptions
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#baljsn_encoderoptions-purpose"> Purpose</a>
25/// * <a href="#baljsn_encoderoptions-classes"> Classes </a>
26/// * <a href="#baljsn_encoderoptions-description"> Description </a>
27/// * <a href="#baljsn_encoderoptions-attributes"> Attributes </a>
28/// * <a href="#baljsn_encoderoptions-implementation-note"> Implementation Note </a>
29/// * <a href="#baljsn_encoderoptions-usage"> Usage </a>
30/// * <a href="#baljsn_encoderoptions-example-1-creating-and-populating-an-options-object"> Example 1: Creating and Populating an Options Object </a>
31///
32/// # Purpose {#baljsn_encoderoptions-purpose}
33/// Provide an attribute class for specifying JSON encoding options.
34///
35/// # Classes {#baljsn_encoderoptions-classes}
36///
37/// - baljsn::EncoderOptions: options for encoding objects in the JSON format
38///
39/// @see baljsn_encoder, baljsn_decoderoptions
40///
41/// # Description {#baljsn_encoderoptions-description}
42/// This component provides a single, simply constrained
43/// (value-semantic) attribute class, `baljsn::EncoderOptions`, that is used to
44/// specify options for encoding objects in the JSON format.
45///
46/// ## Attributes {#baljsn_encoderoptions-attributes}
47///
48///
49/// @code
50/// Name Type Default Simple Constraints
51/// ------------------ ----------- ------- ------------------
52/// encodingStyle EncodingStyle e_COMPACT none
53/// initialIndentLevel int 0 >= 0
54/// spacesPerLevel int 0 >= 0
55/// encodeEmptyArrays bool false none
56/// encodeNullElements bool false none
57/// encodeInfAndNaNAsStrings
58/// bool false none
59/// encodeQuotedDecimal64
60/// bool true none
61/// datetimeFractionalSecondPrecision
62/// int 3 >= 0 and <= 6
63/// maxFloatPrecision int 0 >= 1 and <= 9 or 0
64/// maxDoublePrecision int 0 >= 1 and <= 17 or 0
65/// escapeForwardSlash bool true none
66/// encodeAnonSequenceInChoice
67/// bool true none
68/// @endcode
69/// * `encodingStyle`: encoding style used to encode the JSON data.
70/// * `initialIndentLevel`: Initial indent level for the topmost element.
71/// * `spacesPerLevel`: spaces per additional indent level.
72/// * `encodeEmptyArrays`: option specifying if empty arrays should be encoded
73/// (empty arrays occurring as selections of choices are always encoded).
74/// * `encodeNullElements`: option specifying if null elements should be
75/// encoded.
76/// * `encodeInfAndNaNAsStrings`: JSON does not provide a way to encode these
77/// values as they are not numbers. This option
78/// provides a way to encode these values.
79/// Although the resulting output is a valid
80/// JSON document, decoders expecting floating
81/// point numbers to be encoded only as numbers
82/// will fail to decode. Users of this option
83/// must therefore exercise caution and ensure
84/// that if this option is used then the parser
85/// decoding the generated JSON can handle
86/// doubles as strings.
87/// * `encodeQuotedDecimal64`: option specifying a way to encode `Decimal64`
88/// values. If the `encodeQuotedDecimal64`
89/// attribute value is `true` (the default), the
90/// `Decimal64` values will be encoded quoted,
91/// and otherwise they will be encoded as numbers.
92/// Encoding a Decimal64 as a JSON number will
93/// frequently result in it being later decoded as
94/// a binary floating point number, and in the
95/// process losing digits of precision that were
96/// the point of using the Decimal64 type in the
97/// first place. Care should be taken when setting
98/// this option to `false` (though it may be useful
99/// when communicating with endpoints that are
100/// known to correctly handle high precision JSON
101/// numbers).
102/// * `datetimeFractionalSecondPrecision`: option specifying the number of
103/// decimal places used for seconds when
104/// encoding `Datetime` and
105/// `DatetimeTz`.
106/// * `maxFloatPrecision`: [**DEPRECATED**] option specifying the maximum number
107/// of decimal places used to encode each `float` value.
108/// When 0 (the default value) the encoder will use the
109/// minimum that is necessary to restore the binary
110/// value into a `float`. We recommend against setting
111/// this option: the option was provided prior to the
112/// current default behavior (of choosing the shortest
113/// presentation that can be restored to the original
114/// value) being available.
115/// * `maxDoublePrecision`: [**DEPRECATED**] option specifying the maximum number
116/// of decimal places used to encode each `double`
117/// value. When 0 (the default value) the encoder will
118/// use the minimum that is necessary to restore the
119/// binary value into a `double`. We recommend against
120/// setting this option: the option was provided prior
121/// to the current default behavior (of choosing the
122/// shortest presentation that can be restored to the
123/// original value) being available.
124/// * `escapeForwardSlash`: option specifying whether `/` characters in names or
125/// strings are output with a preceding `\` or not.
126/// * `encodeAnonSequenceInChoice`: option specifying if anonymous sequence
127/// elements in choice should be encoded. The
128/// preffered value for this option is `false`,
129/// but the default value is `true` for
130/// backward-compatibility purposes only. Note
131/// that `baljsn::Decoder` currently fails to
132/// decode such elements.
133///
134/// ### Implementation Note {#baljsn_encoderoptions-implementation-note}
135///
136///
137/// This file was generated from a script and was subsequently modified to add
138/// documentation and to make other changes. The steps to generate and update
139/// this file can be found in the `doc/generating_codec_options.txt` file.
140///
141/// ## Usage {#baljsn_encoderoptions-usage}
142///
143///
144/// This section illustrates intended use of this component.
145///
146/// ### Example 1: Creating and Populating an Options Object {#baljsn_encoderoptions-example-1-creating-and-populating-an-options-object}
147///
148///
149/// This component is designed to be used at a higher level to set the options
150/// for encoding objects in the JSON format. This example shows how to create
151/// and populate an options object.
152///
153/// First, we default-construct a `baljsn::EncoderOptions` object:
154/// @code
155/// const int INITIAL_INDENT_LEVEL = 1;
156/// const int SPACES_PER_LEVEL = 4;
157/// const bool ENCODE_EMPTY_ARRAYS = true;
158/// const bool ENCODE_NULL_ELEMENTS = true;
159/// const bool ENCODE_INF_NAN_AS_STRINGS = true;
160/// const int DATETIME_PRECISION = 6;
161/// const int FLOAT_PRECISION = 3;
162/// const int DOUBLE_PRECISION = 9;
163/// const bool ENCODE_QUOTED_DECIMAL64 = false;
164/// const bool ESCAPE_FORWARD_SLASH = false;
165/// const bool ENCODE_ANON_SEQUENCE_IN_CHOICE = false;
166///
167/// baljsn::EncoderOptions options;
168/// assert(0 == options.initialIndentLevel());
169/// assert(0 == options.spacesPerLevel());
170/// assert(baljsn::EncoderOptions::e_COMPACT == options.encodingStyle());
171/// assert(false == options.encodeEmptyArrays());
172/// assert(false == options.encodeNullElements());
173/// assert(false == options.encodeInfAndNaNAsStrings());
174/// assert(3 == options.datetimeFractionalSecondPrecision());
175/// assert(0 == options.maxFloatPrecision());
176/// assert(0 == options.maxDoublePrecision());
177/// assert(true == options.encodeQuotedDecimal64());
178/// assert(true == options.escapeForwardSlash());
179/// assert(true == options.encodeAnonSequenceInChoice());
180/// @endcode
181/// Next, we populate that object to encode in a pretty format using a
182/// pre-defined initial indent level and spaces per level:
183/// @code
184/// options.setEncodingStyle(baljsn::EncodingStyle::e_PRETTY);
185/// assert(baljsn::EncoderOptions::e_PRETTY == options.encodingStyle());
186///
187/// options.setInitialIndentLevel(INITIAL_INDENT_LEVEL);
188/// assert(INITIAL_INDENT_LEVEL == options.initialIndentLevel());
189///
190/// options.setSpacesPerLevel(SPACES_PER_LEVEL);
191/// assert(SPACES_PER_LEVEL == options.spacesPerLevel());
192///
193/// options.setEncodeEmptyArrays(ENCODE_EMPTY_ARRAYS);
194/// assert(ENCODE_EMPTY_ARRAYS == options.encodeEmptyArrays());
195///
196/// options.setEncodeNullElements(ENCODE_NULL_ELEMENTS);
197/// assert(ENCODE_NULL_ELEMENTS == options.encodeNullElements());
198///
199/// options.setEncodeInfAndNaNAsStrings(ENCODE_INF_NAN_AS_STRINGS);
200/// assert(ENCODE_INF_NAN_AS_STRINGS == options.encodeInfAndNaNAsStrings());
201///
202/// options.setDatetimeFractionalSecondPrecision(DATETIME_PRECISION);
203/// assert(DATETIME_PRECISION == options.datetimeFractionalSecondPrecision());
204///
205/// options.setMaxFloatPrecision(FLOAT_PRECISION);
206/// assert(FLOAT_PRECISION == options.maxFloatPrecision());
207///
208/// options.setMaxDoublePrecision(DOUBLE_PRECISION);
209/// assert(DOUBLE_PRECISION == options.maxDoublePrecision());
210///
211/// options.setEncodeQuotedDecimal64(ENCODE_QUOTED_DECIMAL64);
212/// assert(ENCODE_QUOTED_DECIMAL64 == options.encodeQuotedDecimal64());
213///
214/// options.setEscapeForwardSlash(ESCAPE_FORWARD_SLASH);
215/// assert(ESCAPE_FORWARD_SLASH == options.escapeForwardSlash());
216///
217/// options.setEncodeAnonSequenceInChoice(ENCODE_ANON_SEQUENCE_IN_CHOICE);
218/// assert(ENCODE_ANON_SEQUENCE_IN_CHOICE ==
219/// options.encodeAnonSequenceInChoice());
220/// @endcode
221/// @}
222/** @} */
223/** @} */
224
225/** @addtogroup bal
226 * @{
227 */
228/** @addtogroup baljsn
229 * @{
230 */
231/** @addtogroup baljsn_encoderoptions
232 * @{
233 */
234
235#include <balscm_version.h>
236
237#include <baljsn_encodingstyle.h>
238
239#include <bslalg_typetraits.h>
240
241#include <bdlat_attributeinfo.h>
242#include <bdlat_selectioninfo.h>
243#include <bdlat_typetraits.h>
244
245#ifndef BDE_OMIT_INTERNAL_DEPRECATED
246#include <bsla_deprecated.h>
247#endif
248
249#include <bsls_assert.h>
250#include <bsls_objectbuffer.h>
251#include <bsls_review.h>
252
253#include <bsl_limits.h>
254#include <bsl_iosfwd.h>
255
256
257
258namespace baljsn { class EncoderOptions; }
259namespace baljsn {
260
261 // ====================
262 // class EncoderOptions
263 // ====================
264
265/// Options for performing JSON encoding. `EncodingStyle` is either
266/// `COMPACT` or `PRETTY`. If `EncodingStyle` is `COMPACT`, no whitespace
267/// will be added between elements. If encoding style is `PRETTY`, then the
268/// `InitialIndentLevel` and `SpacesPerLevel` parameters are used to specify the formatting of the output.
269///
270/// \note Note that `InitialIndentLevel` and
271/// `SpacesPerLevel` are ignored when `EncodingStyle` is `COMPACT` (this is
272/// the default). The `EncodeEmptyArrays` and `EncodeNullElements` encode
273/// empty array and null elements respectively. By default empty array and
274/// null elements are not encoded. The `EncodeInfAndNaNAsStrings` attribute
275/// provides users the option to encode `Infinity` and `NaN` floating point
276/// values as strings. These values do not have a valid JSON representation
277/// and by default such value will result in an encoding error. The
278/// `DatetimeFractionalSecondPrecision` specifies the precision of
279/// milliseconds printed with date time values. By default a precision of
280/// `3` decimal places is used. The `MaxFloatPrecision` and
281/// `MaxDoublePrecision` attributes allow specifying the maximum precision
282/// for `float` and `double` values. When not specified, or 0 is specified,
283/// the precision is determined automatically to use enough digits to ensure
284/// restoring the original binary floating point value by a reader. We
285/// recommend against setting these options: they were provided prior to the
286/// current default behavior (of choosing the shortest presentation that can
287/// be restored to the original value) being available.
288///
289/// See @ref baljsn_encoderoptions
291
292 // INSTANCE DATA
293
294 // initial indentation level for the topmost element
295 int d_initialIndentLevel;
296
297 // spaces per additional level of indentation
298 int d_spacesPerLevel;
299
300 // option specifying the number of decimal places used for milliseconds
301 // when encoding `Datetime` and `DatetimeTz` values
302 int d_datetimeFractionalSecondPrecision;
303
304 // option specifying the maximum number of decimal places used to
305 // encode each `float` value
306 int d_maxFloatPrecision;
307
308 // option specifying the maximum number of decimal places used to
309 // encode each `double` value
310 int d_maxDoublePrecision;
311
312 // encoding style used to encode values
313 baljsn::EncodingStyle::Value d_encodingStyle;
314
315 // option specifying if empty arrays should be encoded (empty arrays
316 // occurring as selections of choices are always encoded)
317 bool d_encodeEmptyArrays;
318
319 // option specifying if null elements should be encoded
320 bool d_encodeNullElements;
321
322 // option specifying a way to encode `Infinity` and `NaN` floating
323 // point values. JSON does not provide a way to encode these values as
324 // they are not numbers. Although the resulting output is a valid JSON
325 // document, decoders expecting floating point numbers to be encoded
326 // only as numbers will fail to decode. Users of this option must
327 // therefore exercise caution and ensure that if this option is used
328 // then the parser decoding the generated JSON can handle doubles as
329 // strings.
330 bool d_encodeInfAndNaNAsStrings;
331
332 // option specifying a way to encode `Decimal64` values. If the option
333 // value is `true` then the `Decimal64` value is encoded quoted
334 // { "dec": "1.2e-5" }, and unquoted { "dec": 1.2e-5 } otherwise.
335 bool d_encodeQuotedDecimal64;
336
337 // option specifying if `/` characters should be preceded by a `\` character
338 // or not (e.g., rendered as `\/` or `/`).
339 bool d_escapeForwardSlash;
340
341 // option specifying if anonymous sequence elements in choice should be
342 // encoded
343 bool d_encodeAnonSequenceInChoice;
344
345 public:
346 // TYPES
347
348 // This `enum` provides enumerators to specify the encoding styles. This
349 // `enum` is replicated in this `class` for backwards-compatibility with
350 // `baejsn`. Users should use `baljsn::EncodingStyle` directly.
354#ifndef BDE_OMIT_INTERNAL_DEPRECATED
355 , BAEJSN_COMPACT BSLA_DEPRECATED = e_COMPACT
356 , BAEJSN_PRETTY BSLA_DEPRECATED = e_PRETTY
357#endif // BDE_OMIT_INTERNAL_DEPRECATED
358 };
359
360 enum {
373 };
374
375 enum {
376 NUM_ATTRIBUTES = 12
377 };
378
379 enum {
392 };
393
394 // CONSTANTS
395 static const char CLASS_NAME[];
396
398
400
402
404
406
408
410
412
414
416
418
420
422
423 public:
424 // CLASS METHODS
425
426 /// Return attribute information for the attribute indicated by the
427 /// specified `id` if the attribute exists, and 0 otherwise.
429
430 /// Return attribute information for the attribute indicated by the
431 /// specified `name` of the specified `nameLength` if the attribute
432 /// exists, and 0 otherwise.
434 const char *name,
435 int nameLength);
436
437 // CREATORS
438
439 /// Create an object of type `EncoderOptions` having the default value.
441
442 /// Create an object of type `EncoderOptions` having the value of the
443 /// specified `original` object.
445
446 /// Destroy this object.
448
449 // MANIPULATORS
450
451 /// Assign to this object the value of the specified `rhs` object.
453
454 /// Reset this object to the default value (i.e., its value upon
455 /// default construction).
456 void reset();
457
458 /// Invoke the specified `manipulator` sequentially on the address of
459 /// each (modifiable) attribute of this object, supplying `manipulator`
460 /// with the corresponding attribute information structure until such
461 /// invocation returns a non-zero value. Return the value from the
462 /// last invocation of `manipulator` (i.e., the invocation that
463 /// terminated the sequence).
464 template<class MANIPULATOR>
465 int manipulateAttributes(MANIPULATOR& manipulator);
466
467 /// Invoke the specified `manipulator` on the address of
468 /// the (modifiable) attribute indicated by the specified `id`,
469 /// supplying `manipulator` with the corresponding attribute
470 /// information structure. Return the value returned from the
471 /// invocation of `manipulator` if `id` identifies an attribute of this
472 /// class, and -1 otherwise.
473 template<class MANIPULATOR>
474 int manipulateAttribute(MANIPULATOR& manipulator, int id);
475
476 /// Invoke the specified `manipulator` on the address of the (modifiable)
477 /// attribute indicated by the specified `name` of the specified
478 /// `nameLength`, supplying `manipulator` with the corresponding attribute
479 /// information structure. Return the value returned from the invocation
480 /// of `manipulator` if `name` identifies an attribute of this class, and
481 /// -1 otherwise.
482 template<class MANIPULATOR>
483 int manipulateAttribute(MANIPULATOR& manipulator,
484 const char *name,
485 int nameLength);
486
487 /// Set the "InitialIndentLevel" attribute of this object to the specified
488 /// `value`.
489 void setInitialIndentLevel(int value);
490
491 /// Set the "SpacesPerLevel" attribute of this object to the specified
492 /// `value`.
493 void setSpacesPerLevel(int value);
494
495 /// Set the "EncodingStyle" attribute of this object to the specified
496 /// `value`.
499
500 /// Set the "EncodeEmptyArrays" attribute of this object to the specified
501 /// `value`.
502 void setEncodeEmptyArrays(bool value);
503
504 /// Set the "EncodeNullElements" attribute of this object to the specified
505 /// `value`.
506 void setEncodeNullElements(bool value);
507
508 /// Set the "EncodeInfAndNaNAsStrings" attribute of this object to the
509 /// specified `value`.
510 void setEncodeInfAndNaNAsStrings(bool value);
511
512 /// Set the "DatetimeFractionalSecondPrecision" attribute of this object
513 /// to the specified `value`.
515
516 /// Set the "MaxFloatPrecision" attribute of this object to the
517 /// specified `value`.
518 void setMaxFloatPrecision(int value);
519
520 /// Set the "MaxDoublePrecision" attribute of this object to the
521 /// specified `value`.
522 void setMaxDoublePrecision(int value);
523
524 /// Set the "EncodeQuotedDecimal64" attribute of this object to the
525 /// specified `value`.
526 void setEncodeQuotedDecimal64(bool value);
527
528 /// Set the "EscapeForwardSlash" attribute of this object to the
529 /// specified `value`.
530 void setEscapeForwardSlash(bool value);
531
532 /// Set the "EncodeAnonSequenceInChoice" attribute of this object to the
533 /// specified `value`.
534 void setEncodeAnonSequenceInChoice(bool value);
535
536 // ACCESSORS
537
538 /// Format this object to the specified output `stream` at the
539 /// optionally specified indentation `level` and return a reference to
540 /// the modifiable `stream`. If `level` is specified, optionally
541 /// specify `spacesPerLevel`, the number of spaces per indentation level
542 /// for this and all of its nested objects. Each line is indented by
543 /// the absolute value of `level * spacesPerLevel`. If `level` is
544 /// negative, suppress indentation of the first line. If
545 /// `spacesPerLevel` is negative, suppress line breaks and format the
546 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
547 ///
548 /// \note Note that a trailing newline is provided
549 /// in multiline mode only.
550 bsl::ostream& print(bsl::ostream& stream,
551 int level = 0,
552 int spacesPerLevel = 4) const;
553
554 /// Invoke the specified `accessor` sequentially on each
555 /// (non-modifiable) attribute of this object, supplying `accessor`
556 /// with the corresponding attribute information structure until such
557 /// invocation returns a non-zero value. Return the value from the
558 /// last invocation of `accessor` (i.e., the invocation that terminated
559 /// the sequence).
560 template<class ACCESSOR>
561 int accessAttributes(ACCESSOR& accessor) const;
562
563 /// Invoke the specified `accessor` on the (non-modifiable) attribute
564 /// of this object indicated by the specified `id`, supplying `accessor`
565 /// with the corresponding attribute information structure. Return the
566 /// value returned from the invocation of `accessor` if `id` identifies
567 /// an attribute of this class, and -1 otherwise.
568 template<class ACCESSOR>
569 int accessAttribute(ACCESSOR& accessor, int id) const;
570
571 /// Invoke the specified `accessor` on the (non-modifiable) attribute
572 /// of this object indicated by the specified `name` of the specified
573 /// `nameLength`, supplying `accessor` with the corresponding attribute
574 /// information structure. Return the value returned from the
575 /// invocation of `accessor` if `name` identifies an attribute of this
576 /// class, and -1 otherwise.
577 template<class ACCESSOR>
578 int accessAttribute(ACCESSOR& accessor,
579 const char *name,
580 int nameLength) const;
581
582 /// Return a reference to the non-modifiable "InitialIndentLevel"
583 /// attribute of this object.
584 int initialIndentLevel() const;
585
586 /// Return a reference to the non-modifiable "SpacesPerLevel" attribute
587 /// of this object.
588 int spacesPerLevel() const;
589
590 /// Return a reference to the non-modifiable "EncodingStyle" attribute
591 /// of this object.
593
594 /// Return a reference to the non-modifiable "EncodeEmptyArrays" attribute of this object.
595 ///
596 /// \note Note that empty arrays occurring as
597 /// selections of choices are always encoded regardless of the setting
598 /// of this option.
599 bool encodeEmptyArrays() const;
600
601 /// Return a reference to the non-modifiable "EncodeNullElements"
602 /// attribute of this object.
603 bool encodeNullElements() const;
604
605 /// Return a reference to the non-modifiable "EncodeInfAndNaNAsStrings"
606 /// attribute of this object.
607 bool encodeInfAndNaNAsStrings() const;
608
609 /// Return a reference to the non-modifiable
610 /// "DatetimeFractionalSecondPrecision" attribute of this object.
612
613 /// Return a reference to the non-modifiable "MaxFloatPrecision"
614 /// attribute of this object.
615 int maxFloatPrecision() const;
616
617 /// Return a reference to the non-modifiable "MaxDoublePrecision"
618 /// attribute of this object.
619 int maxDoublePrecision() const;
620
621 /// Return the value of the "EncodeQuotedDecimal64" attribute of this
622 /// object.
623 bool encodeQuotedDecimal64() const;
624
625 /// Return the value of the "EscapeForwardSlash" attribute of this object.
626 bool escapeForwardSlash() const;
627
628 /// Return the value of the "EncodeAnonSequenceInChoice" attribute of this
629 /// object.
630 bool encodeAnonSequenceInChoice() const;
631};
632
633// FREE OPERATORS
634
635/// Return `true` if the specified `lhs` and `rhs` attribute objects have
636/// the same value, and `false` otherwise. Two attribute objects have the
637/// same value if each respective attribute has the same value.
638inline
639bool operator==(const EncoderOptions& lhs, const EncoderOptions& rhs);
640
641/// Return `true` if the specified `lhs` and `rhs` attribute objects do not
642/// have the same value, and `false` otherwise. Two attribute objects do
643/// not have the same value if one or more respective attributes differ in
644/// values.
645inline
646bool operator!=(const EncoderOptions& lhs, const EncoderOptions& rhs);
647
648/// Format the specified `rhs` to the specified output `stream` and
649/// return a reference to the modifiable `stream`.
650inline
651bsl::ostream& operator<<(bsl::ostream& stream, const EncoderOptions& rhs);
652
653} // close package namespace
654
655// TRAITS
656
658
659// ============================================================================
660// INLINE FUNCTION DEFINITIONS
661// ============================================================================
662
663namespace baljsn {
664
665 // --------------------
666 // class EncoderOptions
667 // --------------------
668
669// CLASS METHODS
670// MANIPULATORS
671template <class MANIPULATOR>
672int EncoderOptions::manipulateAttributes(MANIPULATOR& manipulator)
673{
674 int ret;
675
676 ret = manipulator(&d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
677 if (ret) {
678 return ret;
679 }
680
681 ret = manipulator(&d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
682 if (ret) {
683 return ret;
684 }
685
686 ret = manipulator(&d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
687 if (ret) {
688 return ret;
689 }
690
691 ret = manipulator(&d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
692 if (ret) {
693 return ret;
694 }
695
696 ret = manipulator(&d_encodeNullElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_NULL_ELEMENTS]);
697 if (ret) {
698 return ret;
699 }
700
701 ret = manipulator(&d_encodeInfAndNaNAsStrings, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_INF_AND_NA_N_AS_STRINGS]);
702 if (ret) {
703 return ret;
704 }
705
706 ret = manipulator(&d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
707 if (ret) {
708 return ret;
709 }
710
711 ret = manipulator(&d_maxFloatPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_FLOAT_PRECISION]);
712 if (ret) {
713 return ret;
714 }
715
716 ret = manipulator(&d_maxDoublePrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DOUBLE_PRECISION]);
717 if (ret) {
718 return ret;
719 }
720
721 ret = manipulator(&d_encodeQuotedDecimal64, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_QUOTED_DECIMAL64]);
722 if (ret) {
723 return ret;
724 }
725
726 ret = manipulator(&d_escapeForwardSlash, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ESCAPE_FORWARD_SLASH]);
727 if (ret) {
728 return ret;
729 }
730
731 ret = manipulator(
732 &d_encodeAnonSequenceInChoice,
734 if (ret) {
735 return ret;
736 }
737
738 return ret;
739}
740
741template <class MANIPULATOR>
742int EncoderOptions::manipulateAttribute(MANIPULATOR& manipulator, int id)
743{
744 enum { NOT_FOUND = -1 };
745
746 switch (id) {
748 return manipulator(&d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
749 } break;
751 return manipulator(&d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
752 } break;
754 return manipulator(&d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
755 } break;
757 return manipulator(&d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
758 } break;
760 return manipulator(&d_encodeNullElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_NULL_ELEMENTS]);
761 } break;
763 return manipulator(&d_encodeInfAndNaNAsStrings, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_INF_AND_NA_N_AS_STRINGS]);
764 } break;
766 return manipulator(&d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
767 } break;
769 return manipulator(&d_maxFloatPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_FLOAT_PRECISION]);
770 } break;
772 return manipulator(&d_maxDoublePrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DOUBLE_PRECISION]);
773 } break;
775 return manipulator(&d_encodeQuotedDecimal64, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_QUOTED_DECIMAL64]);
776 } break;
778 return manipulator(&d_escapeForwardSlash, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ESCAPE_FORWARD_SLASH]);
779 } break;
781 return manipulator(
782 &d_encodeAnonSequenceInChoice,
784 } break;
785 default:
786 return NOT_FOUND;
787 }
788}
789
790template <class MANIPULATOR>
792 MANIPULATOR& manipulator,
793 const char *name,
794 int nameLength)
795{
796 enum { NOT_FOUND = -1 };
797
798 const bdlat_AttributeInfo *attributeInfo =
799 lookupAttributeInfo(name, nameLength);
800 if (0 == attributeInfo) {
801 return NOT_FOUND;
802 }
803
804 return manipulateAttribute(manipulator, attributeInfo->d_id);
805}
806
807inline
809{
810 BSLS_ASSERT(0 <= value);
811
812 d_initialIndentLevel = value;
813}
814
815inline
817{
818 BSLS_ASSERT(0 <= value);
819
820 d_spacesPerLevel = value;
821}
822
823inline
825{
826 d_encodingStyle = value;
827}
828
829inline
832{
833 d_encodingStyle = static_cast<baljsn::EncodingStyle::Value>(value);
834}
835
836inline
838{
839 d_encodeEmptyArrays = value;
840}
841
842inline
844{
845 d_encodeNullElements = value;
846}
847
848inline
850{
851 d_encodeInfAndNaNAsStrings = value;
852}
853
854inline
856{
857 BSLS_ASSERT(0 <= value );
858 BSLS_ASSERT( value <= 6);
859
860 d_datetimeFractionalSecondPrecision = value;
861}
862
863inline
865{
866 d_maxFloatPrecision = value;
867}
868
869inline
871{
872 d_maxDoublePrecision = value;
873}
874
875inline
877{
878 d_encodeQuotedDecimal64 = value;
879}
880
881inline
883{
884 d_escapeForwardSlash = value;
885}
886
887inline
889{
890 d_encodeAnonSequenceInChoice = value;
891}
892
893// ACCESSORS
894template <class ACCESSOR>
895int EncoderOptions::accessAttributes(ACCESSOR& accessor) const
896{
897 int ret;
898
899 ret = accessor(d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
900 if (ret) {
901 return ret;
902 }
903
904 ret = accessor(d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
905 if (ret) {
906 return ret;
907 }
908
909 ret = accessor(d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
910 if (ret) {
911 return ret;
912 }
913
914 ret = accessor(d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
915 if (ret) {
916 return ret;
917 }
918
919 ret = accessor(d_encodeNullElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_NULL_ELEMENTS]);
920 if (ret) {
921 return ret;
922 }
923
924 ret = accessor(d_encodeInfAndNaNAsStrings, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_INF_AND_NA_N_AS_STRINGS]);
925 if (ret) {
926 return ret;
927 }
928
929 ret = accessor(d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
930 if (ret) {
931 return ret;
932 }
933
934 ret = accessor(d_maxFloatPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_FLOAT_PRECISION]);
935 if (ret) {
936 return ret;
937 }
938
939 ret = accessor(d_maxDoublePrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DOUBLE_PRECISION]);
940 if (ret) {
941 return ret;
942 }
943
944 ret = accessor(d_encodeQuotedDecimal64, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_QUOTED_DECIMAL64]);
945 if (ret) {
946 return ret;
947 }
948
949 ret = accessor(d_escapeForwardSlash, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ESCAPE_FORWARD_SLASH]);
950 if (ret) {
951 return ret;
952 }
953
954 ret = accessor(
955 d_encodeAnonSequenceInChoice,
957 if (ret) {
958 return ret;
959 }
960
961 return ret;
962}
963
964template <class ACCESSOR>
965int EncoderOptions::accessAttribute(ACCESSOR& accessor, int id) const
966{
967 enum { NOT_FOUND = -1 };
968
969 switch (id) {
971 return accessor(d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
972 } break;
974 return accessor(d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
975 } break;
977 return accessor(d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
978 } break;
980 return accessor(d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
981 } break;
983 return accessor(d_encodeNullElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_NULL_ELEMENTS]);
984 } break;
986 return accessor(d_encodeInfAndNaNAsStrings, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_INF_AND_NA_N_AS_STRINGS]);
987 } break;
989 return accessor(d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
990 } break;
992 return accessor(d_maxFloatPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_FLOAT_PRECISION]);
993 } break;
995 return accessor(d_maxDoublePrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DOUBLE_PRECISION]);
996 } break;
998 return accessor(d_encodeQuotedDecimal64, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_QUOTED_DECIMAL64]);
999 } break;
1001 return accessor(d_escapeForwardSlash, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ESCAPE_FORWARD_SLASH]);
1002 } break;
1004 return accessor(
1005 d_encodeAnonSequenceInChoice,
1007 } break;
1008 default:
1009 return NOT_FOUND;
1010 }
1011}
1012
1013template <class ACCESSOR>
1015 ACCESSOR& accessor,
1016 const char *name,
1017 int nameLength) const
1018{
1019 enum { NOT_FOUND = -1 };
1020
1021 const bdlat_AttributeInfo *attributeInfo =
1022 lookupAttributeInfo(name, nameLength);
1023 if (0 == attributeInfo) {
1024 return NOT_FOUND;
1025 }
1026
1027 return accessAttribute(accessor, attributeInfo->d_id);
1028}
1029
1030inline
1032{
1033 return d_initialIndentLevel;
1034}
1035
1036inline
1038{
1039 return d_spacesPerLevel;
1040}
1041
1042inline
1047
1048inline
1050{
1051 return d_encodeEmptyArrays;
1052}
1053
1054inline
1056{
1057 return d_encodeNullElements;
1058}
1059
1060inline
1062{
1063 return d_encodeInfAndNaNAsStrings;
1064}
1065
1066inline
1068{
1069 return d_datetimeFractionalSecondPrecision;
1070}
1071
1072inline
1074{
1075 return d_maxFloatPrecision;
1076}
1077
1078inline
1080{
1081 return d_maxDoublePrecision;
1082}
1083
1084inline
1086{
1087 return d_encodeQuotedDecimal64;
1088}
1089
1090inline
1092{
1093 return d_escapeForwardSlash;
1094}
1095
1096inline
1098{
1099 return d_encodeAnonSequenceInChoice;
1100}
1101
1102} // close package namespace
1103
1104// FREE FUNCTIONS
1105
1106inline
1108 const baljsn::EncoderOptions& lhs,
1109 const baljsn::EncoderOptions& rhs)
1110{
1111 return lhs.initialIndentLevel() == rhs.initialIndentLevel()
1112 && lhs.spacesPerLevel() == rhs.spacesPerLevel()
1113 && lhs.encodingStyle() == rhs.encodingStyle()
1114 && lhs.encodeEmptyArrays() == rhs.encodeEmptyArrays()
1115 && lhs.encodeNullElements() == rhs.encodeNullElements()
1116 && lhs.encodeInfAndNaNAsStrings() == rhs.encodeInfAndNaNAsStrings()
1117 && lhs.datetimeFractionalSecondPrecision() == rhs.datetimeFractionalSecondPrecision()
1118 && lhs.maxFloatPrecision() == rhs.maxFloatPrecision()
1119 && lhs.maxDoublePrecision() == rhs.maxDoublePrecision()
1120 && lhs.encodeQuotedDecimal64() == rhs.encodeQuotedDecimal64()
1121 && lhs.escapeForwardSlash() == rhs.escapeForwardSlash()
1122 && lhs.encodeAnonSequenceInChoice() ==
1123 rhs.encodeAnonSequenceInChoice();
1124}
1125
1126inline
1128 const baljsn::EncoderOptions& lhs,
1129 const baljsn::EncoderOptions& rhs)
1130{
1131 return lhs.initialIndentLevel() != rhs.initialIndentLevel()
1132 || lhs.spacesPerLevel() != rhs.spacesPerLevel()
1133 || lhs.encodingStyle() != rhs.encodingStyle()
1134 || lhs.encodeEmptyArrays() != rhs.encodeEmptyArrays()
1135 || lhs.encodeNullElements() != rhs.encodeNullElements()
1136 || lhs.encodeInfAndNaNAsStrings() != rhs.encodeInfAndNaNAsStrings()
1137 || lhs.datetimeFractionalSecondPrecision() != rhs.datetimeFractionalSecondPrecision()
1138 || lhs.maxFloatPrecision() != rhs.maxFloatPrecision()
1139 || lhs.maxDoublePrecision() != rhs.maxDoublePrecision()
1140 || lhs.encodeQuotedDecimal64() != rhs.encodeQuotedDecimal64()
1141 || lhs.escapeForwardSlash() != rhs.escapeForwardSlash()
1142 || lhs.encodeAnonSequenceInChoice() !=
1143 rhs.encodeAnonSequenceInChoice();
1144}
1145
1146inline
1147bsl::ostream& baljsn::operator<<(
1148 bsl::ostream& stream,
1149 const baljsn::EncoderOptions& rhs)
1150{
1151 return rhs.print(stream, 0, -1);
1152}
1153
1154
1155#endif
1156
1157// GENERATED BY BLP_BAS_CODEGEN_3.8.24 Fri Feb 17 12:35:40 2017
1158// USING bas_codegen.pl -m msg --package baljsn --noExternalization -E --noAggregateConversion baljsn.xsd
1159// SERVICE VERSION
1160// ----------------------------------------------------------------------------
1161// Copyright 2015 Bloomberg Finance L.P.
1162//
1163// Licensed under the Apache License, Version 2.0 (the "License");
1164// you may not use this file except in compliance with the License.
1165// You may obtain a copy of the License at
1166//
1167// http://www.apache.org/licenses/LICENSE-2.0
1168//
1169// Unless required by applicable law or agreed to in writing, software
1170// distributed under the License is distributed on an "AS IS" BASIS,
1171// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1172// See the License for the specific language governing permissions and
1173// limitations under the License.
1174// ----------------------------- END-OF-FILE ----------------------------------
1175
1176/** @} */
1177/** @} */
1178/** @} */
Definition baljsn_encoderoptions.h:290
static const bool DEFAULT_INITIALIZER_ENCODE_ANON_SEQUENCE_IN_CHOICE
Definition baljsn_encoderoptions.h:419
static const int DEFAULT_INITIALIZER_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition baljsn_encoderoptions.h:409
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
static const int DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL
Definition baljsn_encoderoptions.h:397
void setEncodingStyle(baljsn::EncodingStyle::Value value)
Definition baljsn_encoderoptions.h:824
static const int DEFAULT_INITIALIZER_MAX_DOUBLE_PRECISION
Definition baljsn_encoderoptions.h:413
static const baljsn::EncodingStyle::Value DEFAULT_INITIALIZER_ENCODING_STYLE
Definition baljsn_encoderoptions.h:401
void setMaxFloatPrecision(int value)
Definition baljsn_encoderoptions.h:864
int manipulateAttribute(MANIPULATOR &manipulator, int id)
Definition baljsn_encoderoptions.h:742
static const char CLASS_NAME[]
Definition baljsn_encoderoptions.h:395
static const bool DEFAULT_INITIALIZER_ENCODE_QUOTED_DECIMAL64
Definition baljsn_encoderoptions.h:415
static const bool DEFAULT_INITIALIZER_ENCODE_NULL_ELEMENTS
Definition baljsn_encoderoptions.h:405
~EncoderOptions()
Destroy this object.
static const bool DEFAULT_INITIALIZER_ENCODE_EMPTY_ARRAYS
Definition baljsn_encoderoptions.h:403
EncodingStyle
Definition baljsn_encoderoptions.h:351
@ e_COMPACT
Definition baljsn_encoderoptions.h:352
@ e_PRETTY
Definition baljsn_encoderoptions.h:353
@ BSLA_DEPRECATED
Definition baljsn_encoderoptions.h:355
bool encodeInfAndNaNAsStrings() const
Definition baljsn_encoderoptions.h:1061
void setEncodeAnonSequenceInChoice(bool value)
Definition baljsn_encoderoptions.h:888
void setEncodeQuotedDecimal64(bool value)
Definition baljsn_encoderoptions.h:876
int maxFloatPrecision() const
Definition baljsn_encoderoptions.h:1073
bool encodeNullElements() const
Definition baljsn_encoderoptions.h:1055
static const bool DEFAULT_INITIALIZER_ENCODE_INF_AND_NA_N_AS_STRINGS
Definition baljsn_encoderoptions.h:407
void setInitialIndentLevel(int value)
Definition baljsn_encoderoptions.h:808
bool encodeAnonSequenceInChoice() const
Definition baljsn_encoderoptions.h:1097
void setDatetimeFractionalSecondPrecision(int value)
Definition baljsn_encoderoptions.h:855
void setEncodeEmptyArrays(bool value)
Definition baljsn_encoderoptions.h:837
int maxDoublePrecision() const
Definition baljsn_encoderoptions.h:1079
EncoderOptions()
Create an object of type EncoderOptions having the default value.
void setSpacesPerLevel(int value)
Definition baljsn_encoderoptions.h:816
EncoderOptions & operator=(const EncoderOptions &rhs)
Assign to this object the value of the specified rhs object.
static const int DEFAULT_INITIALIZER_SPACES_PER_LEVEL
Definition baljsn_encoderoptions.h:399
int datetimeFractionalSecondPrecision() const
Definition baljsn_encoderoptions.h:1067
@ ATTRIBUTE_ID_ESCAPE_FORWARD_SLASH
Definition baljsn_encoderoptions.h:371
@ ATTRIBUTE_ID_ENCODE_ANON_SEQUENCE_IN_CHOICE
Definition baljsn_encoderoptions.h:372
@ ATTRIBUTE_ID_ENCODE_EMPTY_ARRAYS
Definition baljsn_encoderoptions.h:364
@ ATTRIBUTE_ID_INITIAL_INDENT_LEVEL
Definition baljsn_encoderoptions.h:361
@ ATTRIBUTE_ID_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition baljsn_encoderoptions.h:367
@ ATTRIBUTE_ID_MAX_DOUBLE_PRECISION
Definition baljsn_encoderoptions.h:369
@ ATTRIBUTE_ID_ENCODE_INF_AND_NA_N_AS_STRINGS
Definition baljsn_encoderoptions.h:366
@ ATTRIBUTE_ID_ENCODE_NULL_ELEMENTS
Definition baljsn_encoderoptions.h:365
@ ATTRIBUTE_ID_ENCODE_QUOTED_DECIMAL64
Definition baljsn_encoderoptions.h:370
@ ATTRIBUTE_ID_SPACES_PER_LEVEL
Definition baljsn_encoderoptions.h:362
@ ATTRIBUTE_ID_MAX_FLOAT_PRECISION
Definition baljsn_encoderoptions.h:368
@ ATTRIBUTE_ID_ENCODING_STYLE
Definition baljsn_encoderoptions.h:363
void setEncodeNullElements(bool value)
Definition baljsn_encoderoptions.h:843
baljsn::EncoderOptions::EncodingStyle encodingStyle() const
Definition baljsn_encoderoptions.h:1043
@ ATTRIBUTE_INDEX_ENCODE_INF_AND_NA_N_AS_STRINGS
Definition baljsn_encoderoptions.h:385
@ ATTRIBUTE_INDEX_ENCODE_QUOTED_DECIMAL64
Definition baljsn_encoderoptions.h:389
@ ATTRIBUTE_INDEX_ESCAPE_FORWARD_SLASH
Definition baljsn_encoderoptions.h:390
@ ATTRIBUTE_INDEX_MAX_FLOAT_PRECISION
Definition baljsn_encoderoptions.h:387
@ ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS
Definition baljsn_encoderoptions.h:383
@ ATTRIBUTE_INDEX_ENCODING_STYLE
Definition baljsn_encoderoptions.h:382
@ ATTRIBUTE_INDEX_SPACES_PER_LEVEL
Definition baljsn_encoderoptions.h:381
@ ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL
Definition baljsn_encoderoptions.h:380
@ ATTRIBUTE_INDEX_ENCODE_NULL_ELEMENTS
Definition baljsn_encoderoptions.h:384
@ ATTRIBUTE_INDEX_MAX_DOUBLE_PRECISION
Definition baljsn_encoderoptions.h:388
@ ATTRIBUTE_INDEX_ENCODE_ANON_SEQUENCE_IN_CHOICE
Definition baljsn_encoderoptions.h:391
@ ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition baljsn_encoderoptions.h:386
void setEscapeForwardSlash(bool value)
Definition baljsn_encoderoptions.h:882
@ NUM_ATTRIBUTES
Definition baljsn_encoderoptions.h:376
EncoderOptions(const EncoderOptions &original)
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition baljsn_encoderoptions.h:421
int accessAttributes(ACCESSOR &accessor) const
Definition baljsn_encoderoptions.h:895
bool encodeQuotedDecimal64() const
Definition baljsn_encoderoptions.h:1085
int initialIndentLevel() const
Definition baljsn_encoderoptions.h:1031
static const int DEFAULT_INITIALIZER_MAX_FLOAT_PRECISION
Definition baljsn_encoderoptions.h:411
bool escapeForwardSlash() const
Return the value of the "EscapeForwardSlash" attribute of this object.
Definition baljsn_encoderoptions.h:1091
int accessAttribute(ACCESSOR &accessor, int id) const
Definition baljsn_encoderoptions.h:965
int spacesPerLevel() const
Definition baljsn_encoderoptions.h:1037
bool encodeEmptyArrays() const
Definition baljsn_encoderoptions.h:1049
int manipulateAttributes(MANIPULATOR &manipulator)
Definition baljsn_encoderoptions.h:672
static const bool DEFAULT_INITIALIZER_ESCAPE_FORWARD_SLASH
Definition baljsn_encoderoptions.h:417
void setEncodeInfAndNaNAsStrings(bool value)
Definition baljsn_encoderoptions.h:849
void setMaxDoublePrecision(int value)
Definition baljsn_encoderoptions.h:870
#define BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:294
#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
bool operator==(const DatumDecoderOptions &lhs, const DatumDecoderOptions &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, const DatumDecoderOptions &rhs)
bool operator!=(const DatumDecoderOptions &lhs, const DatumDecoderOptions &rhs)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
Value
Definition baljsn_encodingstyle.h:80
@ e_COMPACT
Definition baljsn_encodingstyle.h:81
@ e_PRETTY
Definition baljsn_encodingstyle.h:82
Definition bdlat_attributeinfo.h:139
int d_id
Definition bdlat_attributeinfo.h:142