BDE 4.14.0 Production release
Loading...
Searching...
No Matches
baljsn_decoderoptions.h
Go to the documentation of this file.
1/// @file baljsn_decoderoptions.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// baljsn_decoderoptions.h -*-C++-*-
8#ifndef INCLUDED_BALJSN_DECODEROPTIONS
9#define INCLUDED_BALJSN_DECODEROPTIONS
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup baljsn_decoderoptions baljsn_decoderoptions
15/// @brief Provide an attribute class for specifying JSON decoding options.
16/// @addtogroup bal
17/// @{
18/// @addtogroup baljsn
19/// @{
20/// @addtogroup baljsn_decoderoptions
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#baljsn_decoderoptions-purpose"> Purpose</a>
25/// * <a href="#baljsn_decoderoptions-classes"> Classes </a>
26/// * <a href="#baljsn_decoderoptions-description"> Description </a>
27/// * <a href="#baljsn_decoderoptions-attributes"> Attributes </a>
28/// * <a href="#baljsn_decoderoptions-implementation-note"> Implementation Note </a>
29/// * <a href="#baljsn_decoderoptions-usage"> Usage </a>
30/// * <a href="#baljsn_decoderoptions-example-1-creating-and-populating-an-options-object"> Example 1: Creating and Populating an Options Object </a>
31///
32/// # Purpose {#baljsn_decoderoptions-purpose}
33/// Provide an attribute class for specifying JSON decoding options.
34///
35/// # Classes {#baljsn_decoderoptions-classes}
36///
37/// - baljsn::DecoderOptions: options for decoding objects in the JSON format
38///
39/// @see baljsn_decoder, baljsn_encoderoptions
40///
41/// # Description {#baljsn_decoderoptions-description}
42/// This component provides a single, simply constrained
43/// (value-semantic) attribute class, `baljsn::DecoderOptions`, that is used to
44/// specify options for decoding objects in the JSON format.
45///
46/// ## Attributes {#baljsn_decoderoptions-attributes}
47///
48///
49/// @code
50/// Name Type Default Simple Constraints
51/// ------------------ ---- ------- ------------------
52/// maxDepth int 32 >= 0
53/// skipUnknownElements bool true none
54/// validateInputIsUtf8 bool false none
55/// allowConsecutiveSeparators bool true none
56/// allowFormFeedAsWhitespace bool true none
57/// allowUnescapedControlCharacters bool true none
58/// @endcode
59/// * `maxDepth`: maximum depth of the decoded data
60/// * `skipUnknownElements`: flag specifying if unknown elements are skipped
61/// * `validateInputIsUtf8`: flag specifying whether UTF-8 correctness checking
62/// is enabled.
63/// * `allowConsecutiveSeparators`: flag specifying if multiple consecutive
64/// separators -- e.g., `"a" :: 1`, `[ 1,, 2 ]` -- are accepted and treated
65/// as if one separator had been input.
66/// * `allowFormFeedAsWhitespace`: flag specifying if the form-feed character,
67/// '\f', is treaded as whitespace in addition to ` `, '\t', '\n', '\r', and
68/// '\v'.
69///
70/// * `allowUnescapedControlCharacters`: flag specifying if unescaped (raw)
71/// control characters (e.g., '\n', '\n') are allowed in JSON strings.
72/// Otherwise, control characters are represented by multi-character
73/// sequences (e.g., '\\t' or '\u000A').
74///
75/// ### Implementation Note {#baljsn_decoderoptions-implementation-note}
76///
77///
78/// This file was generated from a script and was subsequently modified to add
79/// documentation and to make other changes. The steps to generate and update
80/// this file can be found in the `doc/generating_codec_options.txt` file.
81///
82/// ## Usage {#baljsn_decoderoptions-usage}
83///
84///
85/// This section illustrates intended use of this component.
86///
87/// ### Example 1: Creating and Populating an Options Object {#baljsn_decoderoptions-example-1-creating-and-populating-an-options-object}
88///
89///
90/// This component is designed to be used at a higher level to set the options
91/// for decoding objects in the JSON format. This example shows how to create
92/// and populate an options object.
93///
94/// First, we default-construct a `baljsn::DecoderOptions` object:
95/// @code
96/// const int MAX_DEPTH = 10;
97/// const bool SKIP_UNKNOWN_ELEMENTS = false;
98///
99/// baljsn::DecoderOptions options;
100/// assert(32 == options.maxDepth());
101/// assert(true == options.skipUnknownElements());
102/// @endcode
103/// Next, we populate that object to decode using a different `maxDepth` value
104/// and `skipUnknownElements` value:
105/// @code
106/// options.setMaxDepth(MAX_DEPTH);
107/// assert(MAX_DEPTH == options.maxDepth());
108///
109/// options.setSkipUnknownElements(SKIP_UNKNOWN_ELEMENTS);
110/// assert(SKIP_UNKNOWN_ELEMENTS == options.skipUnknownElements());
111/// @endcode
112/// @}
113/** @} */
114/** @} */
115
116/** @addtogroup bal
117 * @{
118 */
119/** @addtogroup baljsn
120 * @{
121 */
122/** @addtogroup baljsn_decoderoptions
123 * @{
124 */
125
126#include <balscm_version.h>
127
128#include <bslalg_typetraits.h>
129
130#include <bdlat_attributeinfo.h>
131#include <bdlat_selectioninfo.h>
132#include <bdlat_typetraits.h>
133
134#include <bslh_hash.h>
135#include <bsls_assert.h>
136#include <bsls_objectbuffer.h>
137
138#include <bsl_iosfwd.h>
139#include <bsl_limits.h>
140
141
142
143namespace baljsn { class DecoderOptions; }
144namespace baljsn {
145
146 // ====================
147 // class DecoderOptions
148 // ====================
149
150/// Options for controlling the JSON decoding process.
151///
152/// See @ref baljsn_decoderoptions
154
155 // INSTANCE DATA
156
157 // maximum recursion depth
158 int d_maxDepth;
159
160 // option to skip unknown elements
161 bool d_skipUnknownElements;
162
163 // option to check that input is valid UTF-8
164 bool d_validateInputIsUtf8;
165
166 // Option to allow multiple consecutive colons or commas. Set to
167 // `false` for strictly conformining JSON.
168 bool d_allowConsecutiveSeparators;
169
170 // Option to allow '\f' (form feed) as whitespace in addition to ` `,
171 // '\n', '\t', '\r', and '\v'. Set to `false` for strictly
172 // conformining JSON.
173 bool d_allowFormFeedAsWhitespace;
174
175 // Option to allow characters in the range `[0x00 .. 0x1F]` (e.g.,
176 // '\0', '\t', '\n') in JSON strings. Set to `false` for strictly
177 // conformining JSON.
178 bool d_allowUnescapedControlCharacters;
179
180 // PRIVATE ACCESSORS
181 template <typename t_HASH_ALGORITHM>
182 void hashAppendImpl(t_HASH_ALGORITHM& hashAlgorithm) const;
183
184 bool isEqualTo(const DecoderOptions& rhs) const;
185
186 public:
187 // TYPES
188 enum {
195 };
196
197 enum {
199 };
200
201 enum {
208 };
209
210 // CONSTANTS
211 static const char CLASS_NAME[];
212
214
216
218
220
222
224
226
227 public:
228 // CLASS METHODS
229
230 /// Return attribute information for the attribute indicated by the
231 /// specified `id` if the attribute exists, and 0 otherwise.
233
234 /// Return attribute information for the attribute indicated by the
235 /// specified `name` of the specified `nameLength` if the attribute
236 /// exists, and 0 otherwise.
238 const char *name,
239 int nameLength);
240
241 // CREATORS
242
243 /// Create an object of type `DecoderOptions` having the default value.
245
246 /// Create an object of type `DecoderOptions` having the value of the
247 /// specified `original` object.
249
250#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
251 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
252 /// Create an object of type `DecoderOptions` having the value of the
253 /// specified `original` object. After performing this action, the
254 /// `original` object will be left in a valid, but unspecified state.
255 DecoderOptions(DecoderOptions&& original) = default;
256#endif
257
258 /// Destroy this object.
260
261 // MANIPULATORS
262
263 /// Assign to this object the value of the specified `rhs` object.
265
266#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
267 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
268 /// Assign to this object the value of the specified `rhs` object.
269 /// After performing this action, the `rhs` object will be left in a
270 /// valid, but unspecified state.
272#endif
273
274 /// Reset this object to the default value (i.e., its value upon
275 /// default construction).
276 void reset();
277
278 /// Invoke the specified `manipulator` sequentially on the address of
279 /// each (modifiable) attribute of this object, supplying `manipulator`
280 /// with the corresponding attribute information structure until such
281 /// invocation returns a non-zero value. Return the value from the
282 /// last invocation of `manipulator` (i.e., the invocation that
283 /// terminated the sequence).
284 template <typename t_MANIPULATOR>
285 int manipulateAttributes(t_MANIPULATOR& manipulator);
286
287 /// Invoke the specified `manipulator` on the address of
288 /// the (modifiable) attribute indicated by the specified `id`,
289 /// supplying `manipulator` with the corresponding attribute
290 /// information structure. Return the value returned from the
291 /// invocation of `manipulator` if `id` identifies an attribute of this
292 /// class, and -1 otherwise.
293 template <typename t_MANIPULATOR>
294 int manipulateAttribute(t_MANIPULATOR& manipulator, int id);
295
296 /// Invoke the specified `manipulator` on the address of
297 /// the (modifiable) attribute indicated by the specified `name` of the
298 /// specified `nameLength`, supplying `manipulator` with the
299 /// corresponding attribute information structure. Return the value
300 /// returned from the invocation of `manipulator` if `name` identifies
301 /// an attribute of this class, and -1 otherwise.
302 template <typename t_MANIPULATOR>
303 int manipulateAttribute(t_MANIPULATOR& manipulator,
304 const char *name,
305 int nameLength);
306
307 /// Set the "MaxDepth" attribute of this object to the specified `value`.
308 void setMaxDepth(int value);
309
310 /// Set the "SkipUnknownElements" attribute of this object to the specified
311 /// `value`.
312 void setSkipUnknownElements(bool value);
313
314 /// Set the "ValidateInputIsUtf8" attribute of this object to the specified
315 /// `value`.
316 void setValidateInputIsUtf8(bool value);
317
318 /// Set the "AllowConsecutiveSeparators" attribute of this object to the
319 /// specified `value`.
320 void setAllowConsecutiveSeparators(bool value);
321
322 /// Set the "AllowFormFeedAsWhitespace" attribute of this object to the
323 /// specified `value`.
324 void setAllowFormFeedAsWhitespace(bool value);
325
326 /// Set the "AllowUnescapedControlCharacters" attribute of this object to
327 /// the specified `value`.
328 void setAllowUnescapedControlCharacters(bool value);
329
330 // ACCESSORS
331
332 /// Format this object to the specified output `stream` at the
333 /// optionally specified indentation `level` and return a reference to
334 /// the modifiable `stream`. If `level` is specified, optionally
335 /// specify `spacesPerLevel`, the number of spaces per indentation level
336 /// for this and all of its nested objects. Each line is indented by
337 /// the absolute value of `level * spacesPerLevel`. If `level` is
338 /// negative, suppress indentation of the first line. If
339 /// `spacesPerLevel` is negative, suppress line breaks and format the
340 /// entire output on one line. If `stream` is initially invalid, this
341 /// operation has no effect. Note that a trailing newline is provided
342 /// in multiline mode only.
343 bsl::ostream& print(bsl::ostream& stream,
344 int level = 0,
345 int spacesPerLevel = 4) const;
346
347 /// Invoke the specified `accessor` sequentially on each
348 /// (non-modifiable) attribute of this object, supplying `accessor`
349 /// with the corresponding attribute information structure until such
350 /// invocation returns a non-zero value. Return the value from the
351 /// last invocation of `accessor` (i.e., the invocation that terminated
352 /// the sequence).
353 template <typename t_ACCESSOR>
354 int accessAttributes(t_ACCESSOR& accessor) const;
355
356 /// Invoke the specified `accessor` on the (non-modifiable) attribute
357 /// of this object indicated by the specified `id`, supplying `accessor`
358 /// with the corresponding attribute information structure. Return the
359 /// value returned from the invocation of `accessor` if `id` identifies
360 /// an attribute of this class, and -1 otherwise.
361 template <typename t_ACCESSOR>
362 int accessAttribute(t_ACCESSOR& accessor, int id) const;
363
364 /// Invoke the specified `accessor` on the (non-modifiable) attribute
365 /// of this object indicated by the specified `name` of the specified
366 /// `nameLength`, supplying `accessor` with the corresponding attribute
367 /// information structure. Return the value returned from the
368 /// invocation of `accessor` if `name` identifies an attribute of this
369 /// class, and -1 otherwise.
370 template <typename t_ACCESSOR>
371 int accessAttribute(t_ACCESSOR& accessor,
372 const char *name,
373 int nameLength) const;
374
375 /// Return the value of the "MaxDepth" attribute of this object.
376 int maxDepth() const;
377
378 /// Return the value of the "SkipUnknownElements" attribute of this
379 /// object.
380 bool skipUnknownElements() const;
381
382 /// Return the value of the "ValidateInputIsUtf8" attribute of this
383 /// object.
384 bool validateInputIsUtf8() const;
385
386 /// Return the value of the "AllowConsecutiveSeparators" attribute of
387 /// this object.
388 bool allowConsecutiveSeparators() const;
389
390 /// Return the value of the "AllowFormFeedAsWhitespace" attribute of
391 /// this object.
392 bool allowFormFeedAsWhitespace() const;
393
394 /// Return the value of the "AllowUnescapedControlCharacters" attribute
395 /// of this object.
397
398 // HIDDEN FRIENDS
399
400 /// Return `true` if the specified `lhs` and `rhs` attribute objects
401 /// have the same value, and `false` otherwise. Two attribute objects
402 /// have the same value if each respective attribute has the same value.
403 friend bool operator==(const DecoderOptions& lhs,
404 const DecoderOptions& rhs)
405 {
406 return lhs.isEqualTo(rhs);
407 }
408
409 /// Returns `!(lhs == rhs)`
410 friend bool operator!=(const DecoderOptions& lhs,
411 const DecoderOptions& rhs)
412 {
413 return !(lhs == rhs);
414 }
415
416 /// Format the specified `rhs` to the specified output `stream` and
417 /// return a reference to the modifiable `stream`.
418 friend bsl::ostream& operator<<(bsl::ostream& stream,
419 const DecoderOptions& rhs)
420 {
421 return rhs.print(stream, 0, -1);
422 }
423
424 /// Pass the specified `object` to the specified `hashAlg`. This function
425 /// integrates with the `bslh` modular hashing system and effectively
426 /// provides a `bsl::hash` specialization for `DecoderOptions`.
427 template <typename t_HASH_ALGORITHM>
428 friend void hashAppend(t_HASH_ALGORITHM& hashAlg,
429 const DecoderOptions& object)
430 {
431 object.hashAppendImpl(hashAlg);
432 }
433};
434
435} // close package namespace
436
437// TRAITS
438
440
441//=============================================================================
442// INLINE DEFINITIONS
443//=============================================================================
444
445namespace baljsn {
446
447 // --------------------
448 // class DecoderOptions
449 // --------------------
450
451// PRIVATE ACCESSORS
452template <typename t_HASH_ALGORITHM>
453void DecoderOptions::hashAppendImpl(t_HASH_ALGORITHM& hashAlgorithm) const
454{
455 using bslh::hashAppend;
456 hashAppend(hashAlgorithm, this->maxDepth());
457 hashAppend(hashAlgorithm, this->skipUnknownElements());
458 hashAppend(hashAlgorithm, this->validateInputIsUtf8());
459 hashAppend(hashAlgorithm, this->allowConsecutiveSeparators());
460 hashAppend(hashAlgorithm, this->allowFormFeedAsWhitespace());
461 hashAppend(hashAlgorithm, this->allowUnescapedControlCharacters());
462}
463
464inline
465bool DecoderOptions::isEqualTo(const DecoderOptions& rhs) const
466{
467 return this->maxDepth() == rhs.maxDepth() &&
468 this->skipUnknownElements() == rhs.skipUnknownElements() &&
469 this->validateInputIsUtf8() == rhs.validateInputIsUtf8() &&
470 this->allowConsecutiveSeparators() == rhs.allowConsecutiveSeparators() &&
471 this->allowFormFeedAsWhitespace() == rhs.allowFormFeedAsWhitespace() &&
472 this->allowUnescapedControlCharacters() == rhs.allowUnescapedControlCharacters();
473}
474
475// CLASS METHODS
476// MANIPULATORS
477template <typename t_MANIPULATOR>
478int DecoderOptions::manipulateAttributes(t_MANIPULATOR& manipulator)
479{
480 int ret;
481
482 ret = manipulator(&d_maxDepth, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DEPTH]);
483 if (ret) {
484 return ret;
485 }
486
487 ret = manipulator(&d_skipUnknownElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SKIP_UNKNOWN_ELEMENTS]);
488 if (ret) {
489 return ret;
490 }
491
492 ret = manipulator(&d_validateInputIsUtf8, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_VALIDATE_INPUT_IS_UTF8]);
493 if (ret) {
494 return ret;
495 }
496
497 ret = manipulator(&d_allowConsecutiveSeparators, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONSECUTIVE_SEPARATORS]);
498 if (ret) {
499 return ret;
500 }
501
502 ret = manipulator(&d_allowFormFeedAsWhitespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_FORM_FEED_AS_WHITESPACE]);
503 if (ret) {
504 return ret;
505 }
506
507 ret = manipulator(&d_allowUnescapedControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_UNESCAPED_CONTROL_CHARACTERS]);
508 if (ret) {
509 return ret;
510 }
511
512 return 0;
513}
514
515template <typename t_MANIPULATOR>
516int DecoderOptions::manipulateAttribute(t_MANIPULATOR& manipulator, int id)
517{
518 enum { NOT_FOUND = -1 };
519
520 switch (id) {
522 return manipulator(&d_maxDepth, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DEPTH]);
523 }
525 return manipulator(&d_skipUnknownElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SKIP_UNKNOWN_ELEMENTS]);
526 }
528 return manipulator(&d_validateInputIsUtf8, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_VALIDATE_INPUT_IS_UTF8]);
529 }
531 return manipulator(&d_allowConsecutiveSeparators, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONSECUTIVE_SEPARATORS]);
532 }
534 return manipulator(&d_allowFormFeedAsWhitespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_FORM_FEED_AS_WHITESPACE]);
535 }
537 return manipulator(&d_allowUnescapedControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_UNESCAPED_CONTROL_CHARACTERS]);
538 }
539 default:
540 return NOT_FOUND;
541 }
542}
543
544template <typename t_MANIPULATOR>
546 t_MANIPULATOR& manipulator,
547 const char *name,
548 int nameLength)
549{
550 enum { NOT_FOUND = -1 };
551
552 const bdlat_AttributeInfo *attributeInfo =
553 lookupAttributeInfo(name, nameLength);
554 if (0 == attributeInfo) {
555 return NOT_FOUND;
556 }
557
558 return manipulateAttribute(manipulator, attributeInfo->d_id);
559}
560
561inline
563{
564 BSLS_ASSERT(0 <= value);
565
566 d_maxDepth = value;
567}
568
569inline
571{
572 d_skipUnknownElements = value;
573}
574
575inline
577{
578 d_validateInputIsUtf8 = value;
579}
580
581inline
583{
584 d_allowConsecutiveSeparators = value;
585}
586
587inline
589{
590 d_allowFormFeedAsWhitespace = value;
591}
592
593inline
595{
596 d_allowUnescapedControlCharacters = value;
597}
598
599// ACCESSORS
600template <typename t_ACCESSOR>
601int DecoderOptions::accessAttributes(t_ACCESSOR& accessor) const
602{
603 int ret;
604
605 ret = accessor(d_maxDepth, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DEPTH]);
606 if (ret) {
607 return ret;
608 }
609
610 ret = accessor(d_skipUnknownElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SKIP_UNKNOWN_ELEMENTS]);
611 if (ret) {
612 return ret;
613 }
614
615 ret = accessor(d_validateInputIsUtf8, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_VALIDATE_INPUT_IS_UTF8]);
616 if (ret) {
617 return ret;
618 }
619
620 ret = accessor(d_allowConsecutiveSeparators, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONSECUTIVE_SEPARATORS]);
621 if (ret) {
622 return ret;
623 }
624
625 ret = accessor(d_allowFormFeedAsWhitespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_FORM_FEED_AS_WHITESPACE]);
626 if (ret) {
627 return ret;
628 }
629
630 ret = accessor(d_allowUnescapedControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_UNESCAPED_CONTROL_CHARACTERS]);
631 if (ret) {
632 return ret;
633 }
634
635 return 0;
636}
637
638template <typename t_ACCESSOR>
639int DecoderOptions::accessAttribute(t_ACCESSOR& accessor, int id) const
640{
641 enum { NOT_FOUND = -1 };
642
643 switch (id) {
645 return accessor(d_maxDepth, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DEPTH]);
646 }
648 return accessor(d_skipUnknownElements, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SKIP_UNKNOWN_ELEMENTS]);
649 }
651 return accessor(d_validateInputIsUtf8, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_VALIDATE_INPUT_IS_UTF8]);
652 }
654 return accessor(d_allowConsecutiveSeparators, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONSECUTIVE_SEPARATORS]);
655 }
657 return accessor(d_allowFormFeedAsWhitespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_FORM_FEED_AS_WHITESPACE]);
658 }
660 return accessor(d_allowUnescapedControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_UNESCAPED_CONTROL_CHARACTERS]);
661 }
662 default:
663 return NOT_FOUND;
664 }
665}
666
667template <typename t_ACCESSOR>
669 t_ACCESSOR& accessor,
670 const char *name,
671 int nameLength) const
672{
673 enum { NOT_FOUND = -1 };
674
675 const bdlat_AttributeInfo *attributeInfo =
676 lookupAttributeInfo(name, nameLength);
677 if (0 == attributeInfo) {
678 return NOT_FOUND;
679 }
680
681 return accessAttribute(accessor, attributeInfo->d_id);
682}
683
684inline
686{
687 return d_maxDepth;
688}
689
690inline
692{
693 return d_skipUnknownElements;
694}
695
696inline
698{
699 return d_validateInputIsUtf8;
700}
701
702inline
704{
705 return d_allowConsecutiveSeparators;
706}
707
708inline
710{
711 return d_allowFormFeedAsWhitespace;
712}
713
714inline
716{
717 return d_allowUnescapedControlCharacters;
718}
719
720} // close package namespace
721
722// FREE FUNCTIONS
723
724
725#endif
726
727// GENERATED BY BLP_BAS_CODEGEN_2024.03.02
728// USING bas_codegen.pl -m msg -p baljsn -E --noExternalization --noAggregateConversion ../baljsn.xsd
729// ----------------------------------------------------------------------------
730// Copyright 2024 Bloomberg Finance L.P.
731//
732// Licensed under the Apache License, Version 2.0 (the "License");
733// you may not use this file except in compliance with the License.
734// You may obtain a copy of the License at
735//
736// http://www.apache.org/licenses/LICENSE-2.0
737//
738// Unless required by applicable law or agreed to in writing, software
739// distributed under the License is distributed on an "AS IS" BASIS,
740// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
741// See the License for the specific language governing permissions and
742// limitations under the License.
743// ----------------------------- END-OF-FILE ----------------------------------
744
745/** @} */
746/** @} */
747/** @} */
Definition baljsn_decoderoptions.h:153
void setMaxDepth(int value)
Set the "MaxDepth" attribute of this object to the specified value.
Definition baljsn_decoderoptions.h:562
DecoderOptions(const DecoderOptions &original)
void setAllowUnescapedControlCharacters(bool value)
Definition baljsn_decoderoptions.h:594
static const bool DEFAULT_INITIALIZER_ALLOW_FORM_FEED_AS_WHITESPACE
Definition baljsn_decoderoptions.h:221
bool validateInputIsUtf8() const
Definition baljsn_decoderoptions.h:697
static const char CLASS_NAME[]
Definition baljsn_decoderoptions.h:211
friend void hashAppend(t_HASH_ALGORITHM &hashAlg, const DecoderOptions &object)
Definition baljsn_decoderoptions.h:428
bool allowUnescapedControlCharacters() const
Definition baljsn_decoderoptions.h:715
friend bool operator==(const DecoderOptions &lhs, const DecoderOptions &rhs)
Definition baljsn_decoderoptions.h:403
@ ATTRIBUTE_INDEX_ALLOW_CONSECUTIVE_SEPARATORS
Definition baljsn_decoderoptions.h:205
@ ATTRIBUTE_INDEX_MAX_DEPTH
Definition baljsn_decoderoptions.h:202
@ ATTRIBUTE_INDEX_VALIDATE_INPUT_IS_UTF8
Definition baljsn_decoderoptions.h:204
@ ATTRIBUTE_INDEX_ALLOW_FORM_FEED_AS_WHITESPACE
Definition baljsn_decoderoptions.h:206
@ ATTRIBUTE_INDEX_ALLOW_UNESCAPED_CONTROL_CHARACTERS
Definition baljsn_decoderoptions.h:207
@ ATTRIBUTE_INDEX_SKIP_UNKNOWN_ELEMENTS
Definition baljsn_decoderoptions.h:203
@ NUM_ATTRIBUTES
Definition baljsn_decoderoptions.h:198
void setValidateInputIsUtf8(bool value)
Definition baljsn_decoderoptions.h:576
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
void setAllowConsecutiveSeparators(bool value)
Definition baljsn_decoderoptions.h:582
int manipulateAttribute(t_MANIPULATOR &manipulator, int id)
Definition baljsn_decoderoptions.h:516
friend bsl::ostream & operator<<(bsl::ostream &stream, const DecoderOptions &rhs)
Definition baljsn_decoderoptions.h:418
@ ATTRIBUTE_ID_ALLOW_CONSECUTIVE_SEPARATORS
Definition baljsn_decoderoptions.h:192
@ ATTRIBUTE_ID_VALIDATE_INPUT_IS_UTF8
Definition baljsn_decoderoptions.h:191
@ ATTRIBUTE_ID_ALLOW_UNESCAPED_CONTROL_CHARACTERS
Definition baljsn_decoderoptions.h:194
@ ATTRIBUTE_ID_ALLOW_FORM_FEED_AS_WHITESPACE
Definition baljsn_decoderoptions.h:193
@ ATTRIBUTE_ID_MAX_DEPTH
Definition baljsn_decoderoptions.h:189
@ ATTRIBUTE_ID_SKIP_UNKNOWN_ELEMENTS
Definition baljsn_decoderoptions.h:190
~DecoderOptions()
Destroy this object.
void setAllowFormFeedAsWhitespace(bool value)
Definition baljsn_decoderoptions.h:588
static const bool DEFAULT_INITIALIZER_VALIDATE_INPUT_IS_UTF8
Definition baljsn_decoderoptions.h:217
static const bool DEFAULT_INITIALIZER_ALLOW_UNESCAPED_CONTROL_CHARACTERS
Definition baljsn_decoderoptions.h:223
int manipulateAttributes(t_MANIPULATOR &manipulator)
Definition baljsn_decoderoptions.h:478
bool skipUnknownElements() const
Definition baljsn_decoderoptions.h:691
static const int DEFAULT_INITIALIZER_MAX_DEPTH
Definition baljsn_decoderoptions.h:213
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
bool allowConsecutiveSeparators() const
Definition baljsn_decoderoptions.h:703
friend bool operator!=(const DecoderOptions &lhs, const DecoderOptions &rhs)
Returns !(lhs == rhs)
Definition baljsn_decoderoptions.h:410
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition baljsn_decoderoptions.h:225
static const bool DEFAULT_INITIALIZER_SKIP_UNKNOWN_ELEMENTS
Definition baljsn_decoderoptions.h:215
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int accessAttribute(t_ACCESSOR &accessor, int id) const
Definition baljsn_decoderoptions.h:639
void setSkipUnknownElements(bool value)
Definition baljsn_decoderoptions.h:570
bool allowFormFeedAsWhitespace() const
Definition baljsn_decoderoptions.h:709
DecoderOptions()
Create an object of type DecoderOptions having the default value.
static const bool DEFAULT_INITIALIZER_ALLOW_CONSECUTIVE_SEPARATORS
Definition baljsn_decoderoptions.h:219
int maxDepth() const
Return the value of the "MaxDepth" attribute of this object.
Definition baljsn_decoderoptions.h:685
DecoderOptions & operator=(const DecoderOptions &rhs)
Assign to this object the value of the specified rhs object.
int accessAttributes(t_ACCESSOR &accessor) const
Definition baljsn_decoderoptions.h:601
#define BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:275
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition baljsn_datumdecoderoptions.h:113
bsl::enable_if<(bsl::is_integral< TYPE >::value||bsl::is_pointer< TYPE >::value||bsl::is_enum< TYPE >::value)&&!bsl::is_same< TYPE, bool >::value >::type hashAppend(HASH_ALGORITHM &hashAlg, TYPE input)
Definition bslh_hash.h:638
Definition bdlat_attributeinfo.h:137
int d_id
Definition bdlat_attributeinfo.h:140