BDE 4.14.0 Production release
Loading...
Searching...
No Matches
baljsn_decoderoptions

Detailed Description

Outline

Purpose

Provide an attribute class for specifying JSON decoding options.

Classes

See also
baljsn_decoder, baljsn_encoderoptions

Description

This component provides a single, simply constrained (value-semantic) attribute class, baljsn::DecoderOptions, that is used to specify options for decoding objects in the JSON format.

Attributes

Name Type Default Simple Constraints
------------------ ---- ------- ------------------
maxDepth int 32 >= 0
skipUnknownElements bool true none
validateInputIsUtf8 bool false none
allowConsecutiveSeparators bool true none
allowFormFeedAsWhitespace bool true none
allowUnescapedControlCharacters bool true none

Implementation Note

This file was generated from a script and was subsequently modified to add documentation and to make other changes. The steps to generate and update this file can be found in the doc/generating_codec_options.txt file.

Usage

This section illustrates intended use of this component.

Example 1: Creating and Populating an Options Object

This component is designed to be used at a higher level to set the options for decoding objects in the JSON format. This example shows how to create and populate an options object.

First, we default-construct a baljsn::DecoderOptions object:

const int MAX_DEPTH = 10;
const bool SKIP_UNKNOWN_ELEMENTS = false;
assert(32 == options.maxDepth());
assert(true == options.skipUnknownElements());
Definition baljsn_decoderoptions.h:153
bool skipUnknownElements() const
Definition baljsn_decoderoptions.h:691
int maxDepth() const
Return the value of the "MaxDepth" attribute of this object.
Definition baljsn_decoderoptions.h:685

Next, we populate that object to decode using a different maxDepth value and skipUnknownElements value:

options.setMaxDepth(MAX_DEPTH);
assert(MAX_DEPTH == options.maxDepth());
options.setSkipUnknownElements(SKIP_UNKNOWN_ELEMENTS);
assert(SKIP_UNKNOWN_ELEMENTS == options.skipUnknownElements());
void setMaxDepth(int value)
Set the "MaxDepth" attribute of this object to the specified value.
Definition baljsn_decoderoptions.h:562
void setSkipUnknownElements(bool value)
Definition baljsn_decoderoptions.h:570