Options for performing JSON encoding.

Synopsis

Declared in <baljsn_encoderoptions.h>

class EncoderOptions;

Description

EncodingStyle is either COMPACT or PRETTY. If EncodingStyle is COMPACT, no whitespace will be added between elements. If encoding style is PRETTY, then the InitialIndentLevel and SpacesPerLevel parameters are used to specify the formatting of the output. Note that InitialIndentLevel and SpacesPerLevel are ignored when EncodingStyle is COMPACT (this is the default). The EncodeEmptyArrays and EncodeNullElements encode empty array and null elements respectively. By default empty array and null elements are not encoded. The EncodeInfAndNaNAsStrings attribute provides users the option to encode Infinity and NaN floating point values as strings. These values do not have a valid JSON representation and by default such value will result in an encoding error. The DatetimeFractionalSecondPrecision specifies the precision of milliseconds printed with date time values. By default a precision of 3 decimal places is used. The MaxFloatPrecision and MaxDoublePrecision attributes allow specifying the maximum precision for float and double values. When not specified, or 0 is specified, the precision is determined automatically to use enough digits to ensure restoring the original binary floating point value by a reader. We recommend against setting these options: they were provided prior to the current default behavior (of choosing the shortest presentation that can be restored to the original value) being available.

Enums

Name

Description

Unnamed enum

Attribute identifier constants.

Unnamed enum

Attribute count constants.

Unnamed enum

Attribute index constants.

EncodingStyle

Encoding style enumerators for backwards compatibility.

Member Functions

Name

Description

EncoderOptions [constructor]

Constructors

~EncoderOptions [destructor]

Destroy this object.

operator=

Assign to this object the value of the specified rhs object.

accessAttribute

accessAttribute overloads

accessAttributes

Invoke accessor sequentially on each non‐modifiable attribute.

datetimeFractionalSecondPrecision

Return a reference to the non‐modifiable "DatetimeFractionalSecondPrecision" attribute of this object.

encodeAnonSequenceInChoice

Return the value of the "EncodeAnonSequenceInChoice" attribute of this object.

encodeEmptyArrays

Return the non‐modifiable "EncodeEmptyArrays" attribute of this object.

encodeInfAndNaNAsStrings

Return a reference to the non‐modifiable "EncodeInfAndNaNAsStrings" attribute of this object.

encodeNullElements

Return a reference to the non‐modifiable "EncodeNullElements" attribute of this object.

encodeQuotedDecimal64

Return the value of the "EncodeQuotedDecimal64" attribute of this object.

encodingStyle

Return a reference to the non‐modifiable "EncodingStyle" attribute of this object.

escapeForwardSlash

Return the value of the "EscapeForwardSlash" attribute of this object.

initialIndentLevel

Return a reference to the non‐modifiable "InitialIndentLevel" attribute of this object.

manipulateAttribute

manipulateAttribute overloads

manipulateAttributes

Invoke manipulator sequentially on each modifiable attribute.

maxDoublePrecision

Return a reference to the non‐modifiable "MaxDoublePrecision" attribute of this object.

maxFloatPrecision

Return a reference to the non‐modifiable "MaxFloatPrecision" attribute of this object.

print

Format this object to the specified output stream.

reset

Reset this object to the default value (i.e., its value upon default construction).

setDatetimeFractionalSecondPrecision

Set the "DatetimeFractionalSecondPrecision" attribute of this object.

setEncodeAnonSequenceInChoice

Set the "EncodeAnonSequenceInChoice" attribute of this object to the specified value.

setEncodeEmptyArrays

Set the "EncodeEmptyArrays" attribute of this object to the specified value.

setEncodeInfAndNaNAsStrings

Set the "EncodeInfAndNaNAsStrings" attribute of this object to the specified value.

setEncodeNullElements

Set the "EncodeNullElements" attribute to the specified value.

setEncodeQuotedDecimal64

Set the "EncodeQuotedDecimal64" attribute of this object to the specified value.

setEncodingStyle

setEncodingStyle overloads

setEscapeForwardSlash

Set the "EscapeForwardSlash" attribute of this object to the specified value.

setInitialIndentLevel

Set the "InitialIndentLevel" attribute of this object to the specified value.

setMaxDoublePrecision

Set the "MaxDoublePrecision" attribute of this object to the specified value.

setMaxFloatPrecision

Set the "MaxFloatPrecision" attribute of this object to the specified value.

setSpacesPerLevel

Set the "SpacesPerLevel" attribute of this object to the specified value.

spacesPerLevel

Return a reference to the non‐modifiable "SpacesPerLevel" attribute of this object.

Static Member Functions

Name

Description

lookupAttributeInfo

lookupAttributeInfo overloads

Static Data Members

Name

Description

ATTRIBUTE_INFO_ARRAY

Attribute metadata for this options type.

CLASS_NAME

Name of this class.

DEFAULT_INITIALIZER_DATETIME_FRACTIONAL_SECOND_PRECISION

Default value for the datetimeFractionalSecondPrecision attribute.

DEFAULT_INITIALIZER_ENCODE_ANON_SEQUENCE_IN_CHOICE

Default value for the encodeAnonSequenceInChoice attribute.

DEFAULT_INITIALIZER_ENCODE_EMPTY_ARRAYS

Default value for the encodeEmptyArrays attribute.

DEFAULT_INITIALIZER_ENCODE_INF_AND_NA_N_AS_STRINGS

Default value for the encodeInfAndNaNAsStrings attribute.

DEFAULT_INITIALIZER_ENCODE_NULL_ELEMENTS

Default value for the encodeNullElements attribute.

DEFAULT_INITIALIZER_ENCODE_QUOTED_DECIMAL64

Default value for the encodeQuotedDecimal64 attribute.

DEFAULT_INITIALIZER_ENCODING_STYLE

Default value for the encodingStyle attribute.

DEFAULT_INITIALIZER_ESCAPE_FORWARD_SLASH

Default value for the escapeForwardSlash attribute.

DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL

Default value for the initialIndentLevel attribute.

DEFAULT_INITIALIZER_MAX_DOUBLE_PRECISION

Default value for the maxDoublePrecision attribute.

DEFAULT_INITIALIZER_MAX_FLOAT_PRECISION

Default value for the maxFloatPrecision attribute.

DEFAULT_INITIALIZER_SPACES_PER_LEVEL

Default value for the spacesPerLevel attribute.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs do not have the same value.

operator==

Return true if the specified lhs and rhs have the same value.

Created with MrDocs