BDE 4.14.0 Production release
Loading...
Searching...
No Matches
balber_berencoderoptions.h
Go to the documentation of this file.
1/// @file balber_berencoderoptions.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// balber_berencoderoptions.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_BALBER_BERENCODEROPTIONS
9#define INCLUDED_BALBER_BERENCODEROPTIONS
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(balber_berencoderoptions_h,"$Id$ $CSID$")
14
15/// @defgroup balber_berencoderoptions balber_berencoderoptions
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup bal
18/// @{
19/// @addtogroup balber
20/// @{
21/// @addtogroup balber_berencoderoptions
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#balber_berencoderoptions-purpose"> Purpose</a>
26///
27/// # Purpose {#balber_berencoderoptions-purpose}
28/// Provide value-semantic attribute classes
29/// @}
30/** @} */
31/** @} */
32
33/** @addtogroup bal
34 * @{
35 */
36/** @addtogroup balber
37 * @{
38 */
39/** @addtogroup balber_berencoderoptions
40 * @{
41 */
42
43#include <bslalg_typetraits.h>
44
45#include <bdlat_attributeinfo.h>
46
47#include <bdlat_selectioninfo.h>
48
49#include <bdlat_typetraits.h>
50
51#include <bsls_objectbuffer.h>
52
55
56#include <bsls_assert.h>
57
58#include <bsl_iosfwd.h>
59#include <bsl_limits.h>
60
61
62
63namespace balber { class BerEncoderOptions; }
64namespace balber {
65
66 // =======================
67 // class BerEncoderOptions
68 // =======================
69
70/// BER encoding options
71///
72/// See @ref balber_berencoderoptions
74
75 // INSTANCE DATA
76
77 // trace (verbosity) level
78 int d_traceLevel;
79
80 // The largest BDE version that can be assumed of the corresponding
81 // decoder for the encoded message, expressed as 10000*majorVersion +
82 // 100*minorVersion + patchVersion (e.g. 1.5.0 is expressed as 10500).
83 //
84 // Ideally, the BER encoder should be permitted to generate any BER
85 // that conforms to X.690 (Basic Encoding Rules) and X.694 (mapping of
86 // XSD to ASN.1). In practice, however, certain unimplemented features
87 // and missunderstandings of these standards have resulted in a decoder
88 // that cannot accept the full range of legal inputs. Even when the
89 // encoder and decoder are both upgraded to a richer subset of BER, the
90 // program receiving the encoded values may not have been recompiled
91 // with the latest version and, thus restricting the encoder to emit
92 // BER that can be understood by the decoder at the other end of the
93 // wire. If it is that the receiver has a more modern decoder, set
94 // this variable to a larger value to allow the encoder to produce BER
95 // that is richer and more standards conformant. The default should be
96 // increased only when old copies of the decoder are completely out of
97 // circulation.
98 int d_bdeVersionConformance;
99
100 // This option controls the number of decimal places used for seconds
101 // when encoding `Datetime` and `DatetimeTz`.
102 int d_datetimeFractionalSecondPrecision;
103
104 // This option allows users to control if empty arrays are encoded. By
105 // default empty arrays are encoded as not encoding empty arrays is
106 // non-compliant with the BER encoding specification.
107 bool d_encodeEmptyArrays;
108
109 // This option allows users to control if date and time types are
110 // encoded as binary integers. By default these types are encoded as
111 // strings in the ISO 8601 format.
112 bool d_encodeDateAndTimeTypesAsBinary;
113
114 // This encode option allows users to control if it is an error to try
115 // and encoded any element with an unselected choice. By default the
116 // encoder allows unselected choices by eliding them from the encoding.
117 bool d_disableUnselectedChoiceEncoding;
118
119 // This *backward*-*compatibility* option controls whether or not
120 // negative zero floating-point values are encoded as the BER
121 // representation of negative zero or positive zero. If this option is
122 // `true`, negative zero floating-point values are encoded as the BER
123 // representation of negative zero, such that they will decode back to
124 // negative zero. If this option is `false`, negative zero
125 // floating-point values are encoded as the BER representation of
126 // positive zero, such they they will decode to positive zero. For
127 // backward-compatibility purposes, the default value of this option is
128 // `false`. Setting this option to `true` requires the receiving
129 // decoder to come from BDE release `3.90.x` or later, or otherwise
130 // comply to the ISO/IEC 8825-1:2015 standard. Clients are encouraged
131 // to update their recipients to the latest version of BDE and set this
132 // option to `true`. Note that the `false` value of this option will
133 // eventually be deprecated, and the default value changed to `true`.
134 bool d_preserveSignOfNegativeZero;
135
136 public:
137 // TYPES
138 enum {
146 };
147
148 enum {
150 };
151
152 enum {
160 };
161
162 // CONSTANTS
163 static const char CLASS_NAME[];
164
166
168
170
172
174
176
178
180
181 public:
182 // CLASS METHODS
183
184 /// Return the most current `bdex` streaming version number supported by
185 /// this class. See the `bslx` package-level documentation for more
186 /// information on `bdex` streaming of value-semantic types and
187 /// containers.
188 static int maxSupportedBdexVersion();
189
190 /// Return attribute information for the attribute indicated by the
191 /// specified `id` if the attribute exists, and 0 otherwise.
193
194 /// Return attribute information for the attribute indicated by the
195 /// specified `name` of the specified `nameLength` if the attribute
196 /// exists, and 0 otherwise.
198 const char *name,
199 int nameLength);
200
201 // CREATORS
202
203 /// Create an object of type `BerEncoderOptions` having the default
204 /// value.
206
207 /// Create an object of type `BerEncoderOptions` having the value of the
208 /// specified `original` object.
210
211#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
212 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
213 /// Create an object of type `BerEncoderOptions` having the value of the
214 /// specified `original` object. After performing this action, the
215 /// `original` object will be left in a valid, but unspecified state.
216 BerEncoderOptions(BerEncoderOptions&& original) = default;
217#endif
218
219 /// Destroy this object.
221
222 // MANIPULATORS
223
224 /// Assign to this object the value of the specified `rhs` object.
226
227#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
228 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
229 /// Assign to this object the value of the specified `rhs` object.
230 /// After performing this action, the `rhs` object will be left in a
231 /// valid, but unspecified state.
233#endif
234
235 /// Assign to this object the value read from the specified input
236 /// `stream` using the specified `version` format and return a reference
237 /// to the modifiable `stream`. If `stream` is initially invalid, this
238 /// operation has no effect. If `stream` becomes invalid during this
239 /// operation, this object is valid, but its value is undefined. If
240 /// `version` is not supported, `stream` is marked invalid and this
241 /// object is unaltered. Note that no version is read from `stream`.
242 /// See the `bslx` package-level documentation for more information on
243 /// `bdex` streaming of value-semantic types and containers.
244 template <class STREAM>
245 STREAM& bdexStreamIn(STREAM& stream, int version);
246
247 /// Reset this object to the default value (i.e., its value upon
248 /// default construction).
249 void reset();
250
251 /// Invoke the specified `manipulator` sequentially on the address of
252 /// each (modifiable) attribute of this object, supplying `manipulator`
253 /// with the corresponding attribute information structure until such
254 /// invocation returns a non-zero value. Return the value from the
255 /// last invocation of `manipulator` (i.e., the invocation that
256 /// terminated the sequence).
257 template<class MANIPULATOR>
258 int manipulateAttributes(MANIPULATOR& manipulator);
259
260 /// Invoke the specified `manipulator` on the address of
261 /// the (modifiable) attribute indicated by the specified `id`,
262 /// supplying `manipulator` with the corresponding attribute
263 /// information structure. Return the value returned from the
264 /// invocation of `manipulator` if `id` identifies an attribute of this
265 /// class, and -1 otherwise.
266 template<class MANIPULATOR>
267 int manipulateAttribute(MANIPULATOR& manipulator, int id);
268
269 /// Invoke the specified `manipulator` on the address of
270 /// the (modifiable) attribute indicated by the specified `name` of the
271 /// specified `nameLength`, supplying `manipulator` with the
272 /// corresponding attribute information structure. Return the value
273 /// returned from the invocation of `manipulator` if `name` identifies
274 /// an attribute of this class, and -1 otherwise.
275 template<class MANIPULATOR>
276 int manipulateAttribute(MANIPULATOR& manipulator,
277 const char *name,
278 int nameLength);
279
280 /// Set the "TraceLevel" attribute of this object to the specified
281 /// `value`.
282 void setTraceLevel(int value);
283
284 /// Return a reference to the modifiable "BdeVersionConformance"
285 /// attribute of this object.
287
288 /// Set the "EncodeEmptyArrays" attribute of this object to the
289 /// specified `value`.
290 void setEncodeEmptyArrays(bool value);
291
292 /// Set the "EncodeDateAndTimeTypesAsBinary" attribute of this object to
293 /// the specified `value`.
294 void setEncodeDateAndTimeTypesAsBinary(bool value);
295
296 /// Set the "DatetimeFractionalSecondPrecision" attribute of this object
297 /// to the specified `value`.
299
300 /// Set the "DisableUnselectedChoiceEncoding" attribute of this object
301 /// to the specified `value`.
302 void setDisableUnselectedChoiceEncoding(bool value);
303
304 /// Set the "PreserveSignOfNegativeZero" attribute of this object to the
305 /// specified `value`.
306 void setPreserveSignOfNegativeZero(bool value);
307
308 // ACCESSORS
309
310 /// Format this object to the specified output `stream` at the
311 /// optionally specified indentation `level` and return a reference to
312 /// the modifiable `stream`. If `level` is specified, optionally
313 /// specify `spacesPerLevel`, the number of spaces per indentation level
314 /// for this and all of its nested objects. Each line is indented by
315 /// the absolute value of `level * spacesPerLevel`. If `level` is
316 /// negative, suppress indentation of the first line. If
317 /// `spacesPerLevel` is negative, suppress line breaks and format the
318 /// entire output on one line. If `stream` is initially invalid, this
319 /// operation has no effect. Note that a trailing newline is provided
320 /// in multiline mode only.
321 bsl::ostream& print(bsl::ostream& stream,
322 int level = 0,
323 int spacesPerLevel = 4) const;
324
325 /// Write the value of this object to the specified output `stream`
326 /// using the specified `version` format and return a reference to the
327 /// modifiable `stream`. If `version` is not supported, `stream` is
328 /// unmodified. Note that `version` is not written to `stream`.
329 /// See the `bslx` package-level documentation for more information
330 /// on `bdex` streaming of value-semantic types and containers.
331 template <class STREAM>
332 STREAM& bdexStreamOut(STREAM& stream, int version) const;
333
334 /// Invoke the specified `accessor` sequentially on each
335 /// (non-modifiable) attribute of this object, supplying `accessor`
336 /// with the corresponding attribute information structure until such
337 /// invocation returns a non-zero value. Return the value from the
338 /// last invocation of `accessor` (i.e., the invocation that terminated
339 /// the sequence).
340 template<class ACCESSOR>
341 int accessAttributes(ACCESSOR& accessor) const;
342
343 /// Invoke the specified `accessor` on the (non-modifiable) attribute
344 /// of this object indicated by the specified `id`, supplying `accessor`
345 /// with the corresponding attribute information structure. Return the
346 /// value returned from the invocation of `accessor` if `id` identifies
347 /// an attribute of this class, and -1 otherwise.
348 template<class ACCESSOR>
349 int accessAttribute(ACCESSOR& accessor, int id) const;
350
351 /// Invoke the specified `accessor` on the (non-modifiable) attribute
352 /// of this object indicated by the specified `name` of the specified
353 /// `nameLength`, supplying `accessor` with the corresponding attribute
354 /// information structure. Return the value returned from the
355 /// invocation of `accessor` if `name` identifies an attribute of this
356 /// class, and -1 otherwise.
357 template<class ACCESSOR>
358 int accessAttribute(ACCESSOR& accessor,
359 const char *name,
360 int nameLength) const;
361
362 /// Return the value of the "TraceLevel" attribute of this object.
363 int traceLevel() const;
364
365 /// Return the value of the "BdeVersionConformance" attribute of this
366 /// object.
367 int bdeVersionConformance() const;
368
369 /// Return the value of the "EncodeEmptyArrays" attribute of this
370 /// object.
371 bool encodeEmptyArrays() const;
372
373 /// Return the value of the "EncodeDateAndTimeTypesAsBinary" attribute
374 /// of this object.
376
377 /// Return the value of the "DatetimeFractionalSecondPrecision"
378 /// attribute of this object.
380
381 /// Return the value of the "DisableUnselectedChoiceEncoding" attribute
382 /// of this object.
384
385 /// Return the value of the "PreserveSignOfNegativeZero" attribute of
386 /// this object.
387 bool preserveSignOfNegativeZero() const;
388};
389
390// FREE OPERATORS
391
392/// Return `true` if the specified `lhs` and `rhs` attribute objects have
393/// the same value, and `false` otherwise. Two attribute objects have the
394/// same value if each respective attribute has the same value.
395inline
396bool operator==(const BerEncoderOptions& lhs, const BerEncoderOptions& rhs);
397
398/// Return `true` if the specified `lhs` and `rhs` attribute objects do not
399/// have the same value, and `false` otherwise. Two attribute objects do
400/// not have the same value if one or more respective attributes differ in
401/// values.
402inline
403bool operator!=(const BerEncoderOptions& lhs, const BerEncoderOptions& rhs);
404
405/// Format the specified `rhs` to the specified output `stream` and
406/// return a reference to the modifiable `stream`.
407inline
408bsl::ostream& operator<<(bsl::ostream& stream, const BerEncoderOptions& rhs);
409
410} // close package namespace
411
412// TRAITS
413
415
416// ============================================================================
417// INLINE FUNCTION DEFINITIONS
418// ============================================================================
419
420namespace balber {
421
422 // -----------------------
423 // class BerEncoderOptions
424 // -----------------------
425
426// CLASS METHODS
427inline
429{
430 return 2; // versions start at 1.
431}
432
433// MANIPULATORS
434template <class STREAM>
435STREAM& BerEncoderOptions::bdexStreamIn(STREAM& stream, int version)
436{
437 if (stream) {
438 switch (version) {
439 case 2: {
440 bslx::InStreamFunctions::bdexStreamIn(stream, d_traceLevel, 1);
441 bslx::InStreamFunctions::bdexStreamIn(stream, d_bdeVersionConformance, 1);
442 bslx::InStreamFunctions::bdexStreamIn(stream, d_encodeEmptyArrays, 1);
443 bslx::InStreamFunctions::bdexStreamIn(stream, d_encodeDateAndTimeTypesAsBinary, 1);
444 bslx::InStreamFunctions::bdexStreamIn(stream, d_datetimeFractionalSecondPrecision, 1);
445 bslx::InStreamFunctions::bdexStreamIn(stream, d_disableUnselectedChoiceEncoding, 1);
446 bslx::InStreamFunctions::bdexStreamIn(stream, d_preserveSignOfNegativeZero, 1);
447 } break;
448 case 1: {
449 reset();
450
451 bslx::InStreamFunctions::bdexStreamIn(stream, d_traceLevel, 1);
452 bslx::InStreamFunctions::bdexStreamIn(stream, d_bdeVersionConformance, 1);
453 bslx::InStreamFunctions::bdexStreamIn(stream, d_encodeEmptyArrays, 1);
454 bslx::InStreamFunctions::bdexStreamIn(stream, d_encodeDateAndTimeTypesAsBinary, 1);
455 bslx::InStreamFunctions::bdexStreamIn(stream, d_datetimeFractionalSecondPrecision, 1);
456 bslx::InStreamFunctions::bdexStreamIn(stream, d_disableUnselectedChoiceEncoding, 1);
457 } break;
458 default: {
459 stream.invalidate();
460 }
461 }
462 }
463 return stream;
464}
465
466template <class MANIPULATOR>
467int BerEncoderOptions::manipulateAttributes(MANIPULATOR& manipulator)
468{
469 int ret;
470
471 ret = manipulator(&d_traceLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TRACE_LEVEL]);
472 if (ret) {
473 return ret;
474 }
475
476 ret = manipulator(&d_bdeVersionConformance, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_BDE_VERSION_CONFORMANCE]);
477 if (ret) {
478 return ret;
479 }
480
481 ret = manipulator(&d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
482 if (ret) {
483 return ret;
484 }
485
486 ret = manipulator(&d_encodeDateAndTimeTypesAsBinary, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_DATE_AND_TIME_TYPES_AS_BINARY]);
487 if (ret) {
488 return ret;
489 }
490
491 ret = manipulator(&d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
492 if (ret) {
493 return ret;
494 }
495
496 ret = manipulator(&d_disableUnselectedChoiceEncoding, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DISABLE_UNSELECTED_CHOICE_ENCODING]);
497 if (ret) {
498 return ret;
499 }
500
501 ret = manipulator(&d_preserveSignOfNegativeZero, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PRESERVE_SIGN_OF_NEGATIVE_ZERO]);
502 if (ret) {
503 return ret;
504 }
505
506 return ret;
507}
508
509template <class MANIPULATOR>
510int BerEncoderOptions::manipulateAttribute(MANIPULATOR& manipulator, int id)
511{
512 enum { NOT_FOUND = -1 };
513
514 switch (id) {
516 return manipulator(&d_traceLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TRACE_LEVEL]);
517 }
519 return manipulator(&d_bdeVersionConformance, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_BDE_VERSION_CONFORMANCE]);
520 }
522 return manipulator(&d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
523 }
525 return manipulator(&d_encodeDateAndTimeTypesAsBinary, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_DATE_AND_TIME_TYPES_AS_BINARY]);
526 }
528 return manipulator(&d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
529 }
531 return manipulator(&d_disableUnselectedChoiceEncoding, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DISABLE_UNSELECTED_CHOICE_ENCODING]);
532 }
534 return manipulator(&d_preserveSignOfNegativeZero, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PRESERVE_SIGN_OF_NEGATIVE_ZERO]);
535 }
536 default:
537 return NOT_FOUND;
538 }
539}
540
541template <class MANIPULATOR>
543 MANIPULATOR& manipulator,
544 const char *name,
545 int nameLength)
546{
547 enum { NOT_FOUND = -1 };
548
549 const bdlat_AttributeInfo *attributeInfo =
550 lookupAttributeInfo(name, nameLength);
551 if (0 == attributeInfo) {
552 return NOT_FOUND;
553 }
554
555 return manipulateAttribute(manipulator, attributeInfo->d_id);
556}
557
558inline
560{
561 d_traceLevel = value;
562}
563
564inline
566{
567 return d_bdeVersionConformance;
568}
569
570inline
572{
573 d_encodeEmptyArrays = value;
574}
575
576inline
578{
579 d_encodeDateAndTimeTypesAsBinary = value;
580}
581
582inline
584{
585 d_datetimeFractionalSecondPrecision = value;
586}
587
588inline
590{
591 d_disableUnselectedChoiceEncoding = value;
592}
593
594inline
596{
597 d_preserveSignOfNegativeZero = value;
598}
599
600// ACCESSORS
601template <class STREAM>
628
629template <class ACCESSOR>
630int BerEncoderOptions::accessAttributes(ACCESSOR& accessor) const
631{
632 int ret;
633
634 ret = accessor(d_traceLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TRACE_LEVEL]);
635 if (ret) {
636 return ret;
637 }
638
639 ret = accessor(d_bdeVersionConformance, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_BDE_VERSION_CONFORMANCE]);
640 if (ret) {
641 return ret;
642 }
643
644 ret = accessor(d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
645 if (ret) {
646 return ret;
647 }
648
649 ret = accessor(d_encodeDateAndTimeTypesAsBinary, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_DATE_AND_TIME_TYPES_AS_BINARY]);
650 if (ret) {
651 return ret;
652 }
653
654 ret = accessor(d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
655 if (ret) {
656 return ret;
657 }
658
659 ret = accessor(d_disableUnselectedChoiceEncoding, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DISABLE_UNSELECTED_CHOICE_ENCODING]);
660 if (ret) {
661 return ret;
662 }
663
664 ret = accessor(d_preserveSignOfNegativeZero, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PRESERVE_SIGN_OF_NEGATIVE_ZERO]);
665 if (ret) {
666 return ret;
667 }
668
669 return ret;
670}
671
672template <class ACCESSOR>
673int BerEncoderOptions::accessAttribute(ACCESSOR& accessor, int id) const
674{
675 enum { NOT_FOUND = -1 };
676
677 switch (id) {
679 return accessor(d_traceLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TRACE_LEVEL]);
680 }
682 return accessor(d_bdeVersionConformance, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_BDE_VERSION_CONFORMANCE]);
683 }
685 return accessor(d_encodeEmptyArrays, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS]);
686 }
688 return accessor(d_encodeDateAndTimeTypesAsBinary, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODE_DATE_AND_TIME_TYPES_AS_BINARY]);
689 }
691 return accessor(d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
692 }
694 return accessor(d_disableUnselectedChoiceEncoding, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DISABLE_UNSELECTED_CHOICE_ENCODING]);
695 }
697 return accessor(d_preserveSignOfNegativeZero, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_PRESERVE_SIGN_OF_NEGATIVE_ZERO]);
698 }
699 default:
700 return NOT_FOUND;
701 }
702}
703
704template <class ACCESSOR>
706 ACCESSOR& accessor,
707 const char *name,
708 int nameLength) const
709{
710 enum { NOT_FOUND = -1 };
711
712 const bdlat_AttributeInfo *attributeInfo =
713 lookupAttributeInfo(name, nameLength);
714 if (0 == attributeInfo) {
715 return NOT_FOUND;
716 }
717
718 return accessAttribute(accessor, attributeInfo->d_id);
719}
720
721inline
723{
724 return d_traceLevel;
725}
726
727inline
729{
730 return d_bdeVersionConformance;
731}
732
733inline
735{
736 return d_encodeEmptyArrays;
737}
738
739inline
741{
742 return d_encodeDateAndTimeTypesAsBinary;
743}
744
745inline
747{
748 return d_datetimeFractionalSecondPrecision;
749}
750
751inline
753{
754 return d_disableUnselectedChoiceEncoding;
755}
756
757inline
759{
760 return d_preserveSignOfNegativeZero;
761}
762
763} // close package namespace
764
765// FREE FUNCTIONS
766
767inline
769 const balber::BerEncoderOptions& lhs,
770 const balber::BerEncoderOptions& rhs)
771{
772 return lhs.traceLevel() == rhs.traceLevel()
774 && lhs.encodeEmptyArrays() == rhs.encodeEmptyArrays()
779}
780
781inline
783 const balber::BerEncoderOptions& lhs,
784 const balber::BerEncoderOptions& rhs)
785{
786 return !(lhs == rhs);
787}
788
789inline
790bsl::ostream& balber::operator<<(
791 bsl::ostream& stream,
792 const balber::BerEncoderOptions& rhs)
793{
794 return rhs.print(stream, 0, -1);
795}
796
797
798#endif
799
800// GENERATED BY BLP_BAS_CODEGEN_2021.07.12.1
801// USING bas_codegen.pl -m msg --msgExpand -p balber --noAggregateConversion --noHashSupport -c berencoderoptions balber.xsd
802// ----------------------------------------------------------------------------
803// NOTICE:
804// Copyright 2021 Bloomberg Finance L.P. All rights reserved.
805// Property of Bloomberg Finance L.P. (BFLP)
806// This software is made available solely pursuant to the
807// terms of a BFLP license agreement which governs its use.
808// ------------------------------- END-OF-FILE --------------------------------
809
810/** @} */
811/** @} */
812/** @} */
Definition balber_berencoderoptions.h:73
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition balber_berencoderoptions.h:602
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition balber_berencoderoptions.h:179
static const bool DEFAULT_INITIALIZER_ENCODE_EMPTY_ARRAYS
Definition balber_berencoderoptions.h:169
@ ATTRIBUTE_ID_PRESERVE_SIGN_OF_NEGATIVE_ZERO
Definition balber_berencoderoptions.h:145
@ ATTRIBUTE_ID_ENCODE_EMPTY_ARRAYS
Definition balber_berencoderoptions.h:141
@ ATTRIBUTE_ID_DISABLE_UNSELECTED_CHOICE_ENCODING
Definition balber_berencoderoptions.h:144
@ ATTRIBUTE_ID_TRACE_LEVEL
Definition balber_berencoderoptions.h:139
@ ATTRIBUTE_ID_ENCODE_DATE_AND_TIME_TYPES_AS_BINARY
Definition balber_berencoderoptions.h:142
@ ATTRIBUTE_ID_BDE_VERSION_CONFORMANCE
Definition balber_berencoderoptions.h:140
@ ATTRIBUTE_ID_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition balber_berencoderoptions.h:143
static const int DEFAULT_INITIALIZER_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition balber_berencoderoptions.h:173
static const int DEFAULT_INITIALIZER_TRACE_LEVEL
Definition balber_berencoderoptions.h:165
bool encodeDateAndTimeTypesAsBinary() const
Definition balber_berencoderoptions.h:740
static const bool DEFAULT_INITIALIZER_ENCODE_DATE_AND_TIME_TYPES_AS_BINARY
Definition balber_berencoderoptions.h:171
BerEncoderOptions(const BerEncoderOptions &original)
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
bool preserveSignOfNegativeZero() const
Definition balber_berencoderoptions.h:758
void setPreserveSignOfNegativeZero(bool value)
Definition balber_berencoderoptions.h:595
~BerEncoderOptions()
Destroy this object.
int manipulateAttribute(MANIPULATOR &manipulator, int id)
Definition balber_berencoderoptions.h:510
static const bool DEFAULT_INITIALIZER_DISABLE_UNSELECTED_CHOICE_ENCODING
Definition balber_berencoderoptions.h:175
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
int traceLevel() const
Return the value of the "TraceLevel" attribute of this object.
Definition balber_berencoderoptions.h:722
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition balber_berencoderoptions.h:435
static const int DEFAULT_INITIALIZER_BDE_VERSION_CONFORMANCE
Definition balber_berencoderoptions.h:167
@ ATTRIBUTE_INDEX_DISABLE_UNSELECTED_CHOICE_ENCODING
Definition balber_berencoderoptions.h:158
@ ATTRIBUTE_INDEX_ENCODE_EMPTY_ARRAYS
Definition balber_berencoderoptions.h:155
@ ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition balber_berencoderoptions.h:157
@ ATTRIBUTE_INDEX_TRACE_LEVEL
Definition balber_berencoderoptions.h:153
@ ATTRIBUTE_INDEX_PRESERVE_SIGN_OF_NEGATIVE_ZERO
Definition balber_berencoderoptions.h:159
@ ATTRIBUTE_INDEX_BDE_VERSION_CONFORMANCE
Definition balber_berencoderoptions.h:154
@ ATTRIBUTE_INDEX_ENCODE_DATE_AND_TIME_TYPES_AS_BINARY
Definition balber_berencoderoptions.h:156
int datetimeFractionalSecondPrecision() const
Definition balber_berencoderoptions.h:746
int manipulateAttributes(MANIPULATOR &manipulator)
Definition balber_berencoderoptions.h:467
int accessAttributes(ACCESSOR &accessor) const
Definition balber_berencoderoptions.h:630
bool disableUnselectedChoiceEncoding() const
Definition balber_berencoderoptions.h:752
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int accessAttribute(ACCESSOR &accessor, int id) const
Definition balber_berencoderoptions.h:673
void setTraceLevel(int value)
Definition balber_berencoderoptions.h:559
static const bool DEFAULT_INITIALIZER_PRESERVE_SIGN_OF_NEGATIVE_ZERO
Definition balber_berencoderoptions.h:177
void setEncodeEmptyArrays(bool value)
Definition balber_berencoderoptions.h:571
void setEncodeDateAndTimeTypesAsBinary(bool value)
Definition balber_berencoderoptions.h:577
void setDisableUnselectedChoiceEncoding(bool value)
Definition balber_berencoderoptions.h:589
static int maxSupportedBdexVersion()
Definition balber_berencoderoptions.h:428
@ NUM_ATTRIBUTES
Definition balber_berencoderoptions.h:149
bool encodeEmptyArrays() const
Definition balber_berencoderoptions.h:734
int & bdeVersionConformance()
Definition balber_berencoderoptions.h:565
static const char CLASS_NAME[]
Definition balber_berencoderoptions.h:163
void setDatetimeFractionalSecondPrecision(int value)
Definition balber_berencoderoptions.h:583
BerEncoderOptions & operator=(const BerEncoderOptions &rhs)
Assign to this object the value of the specified rhs object.
#define BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:275
#define BSLS_IDENT_RCSID(tag, str)
Definition bsls_ident.h:260
#define BSLS_IDENT_PRAGMA_ONCE
Definition bsls_ident.h:310
Definition balber_berconstants.h:82
bsl::ostream & operator<<(bsl::ostream &stream, BerConstants::TagClass tagClass)
bool operator!=(const BerDecoderOptions &lhs, const BerDecoderOptions &rhs)
bool operator==(const BerDecoderOptions &lhs, const BerDecoderOptions &rhs)
STREAM & bdexStreamIn(STREAM &stream, VALUE_TYPE &variable)
Definition bslx_instreamfunctions.h:1247
STREAM & bdexStreamOut(STREAM &stream, const TYPE &value)
Definition bslx_outstreamfunctions.h:992
Definition bdlat_attributeinfo.h:137
int d_id
Definition bdlat_attributeinfo.h:140