BDE 4.39.x Production Release
Loading...
Searching...
No Matches
balxml_encoderoptions.h
Go to the documentation of this file.
1/// @file balxml_encoderoptions.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// balxml_encoderoptions.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_BALXML_ENCODEROPTIONS
9#define INCLUDED_BALXML_ENCODEROPTIONS
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(balxml_encoderoptions_h, "$Id$ $CSID$")
14
15/// @defgroup balxml_encoderoptions balxml_encoderoptions
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup bal
18/// @{
19/// @addtogroup balxml
20/// @{
21/// @addtogroup balxml_encoderoptions
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#balxml_encoderoptions-purpose"> Purpose</a>
26///
27/// # Purpose {#balxml_encoderoptions-purpose}
28/// Provide value-semantic attribute classes
29/// @}
30/** @} */
31/** @} */
32
33/** @addtogroup bal
34 * @{
35 */
36/** @addtogroup balxml
37 * @{
38 */
39/** @addtogroup balxml_encoderoptions
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
53#include <bslma_default.h>
54
55#include <bsls_assert.h>
56
58
59#include <bdlb_nullablevalue.h>
60
61#include <bsl_string.h>
62
63#include <bsl_iosfwd.h>
64#include <bsl_limits.h>
65
66
67
68namespace bslma { class Allocator; }
69
70namespace balxml { class EncoderOptions; }
71namespace balxml {
72
73 // ====================
74 // class EncoderOptions
75 // ====================
76
77/// Options for performing XML encodings. Encoding style is either COMPACT
78/// or PRETTY. If encoding style is COMPACT, no whitespace will be added
79/// between elements. If encoding style is `PRETTY`, then the
80/// `InitialIndentLevel`, `SpacesPerLevel`, and `WrapColumn` parameters are
81/// used to specify the formatting of the output.
82///
83/// \note Note that `InitialIndentLevel`, `SpacesPerLevel`, and `WrapColumn` are ignored
84/// when `EncodingStyle` is COMPACT (this is the default).
85/// The generated C++ code for this schema element is created by using
86/// bas_codegen.pl, run by balxml/code_from_xsd.pl, with no hand-editing.
87///
88/// See @ref balxml_encoderoptions
90
91 // INSTANCE DATA
92
93 // namespace where object is defined
94 bsl::string d_objectNamespace;
95
96 // location of the schema
97 bsl::string d_schemaLocation;
98
99 // tag for top level
100 bsl::string d_tag;
101
102 // Formatting mode
103 int d_formattingMode;
104
105 // initial indentation level
106 int d_initialIndentLevel;
107
108 // spaces per level of indentation
109 int d_spacesPerLevel;
110
111 // number of characters to wrap text
112 int d_wrapColumn;
113
114 // This option controls the number of decimal places used for seconds
115 // when encoding `Datetime` and `DatetimeTz`.
116 // Note that the default of this field is `6` in
117 // `balxml_encoderoptions.cpp`, but is edited to `3` in
118 // `balxml_configschema.cpp` by balxml/code_from_xsd.pl.
119 int d_datetimeFractionalSecondPrecision;
120
121 // Maximum total digits of the decimal value that should be displayed
122 bdlb::NullableValue<int> d_maxDecimalTotalDigits;
123
124 // Maximum fractional digits of the decimal value that should be
125 // displayed
126 bdlb::NullableValue<int> d_maxDecimalFractionDigits;
127
128 // The number of significant digits that must be displayed for the
129 // double value.
130 bdlb::NullableValue<int> d_significantDoubleDigits;
131
132 // encoding style (see component-level doc)
133 EncodingStyle::Value d_encodingStyle;
134
135 // Allow control characters to be encoded.
136 bool d_allowControlCharacters;
137
138 // This option controls if the baexml encoder should output the XML
139 // header.
140 bool d_outputXMLHeader;
141
142 // This option controls if the baexml encoder should output the XSI
143 // alias with the top-level element.
144 bool d_outputXSIAlias;
145
146 // This option control whether `Z` should be used for the zone
147 // designator of `DateTz` or instead of `+00:00` (specific to UTC).
148 bool d_useZAbbreviationForUtc;
149
150 public:
151 // TYPES
152 enum {
169 };
170
171 enum {
172 NUM_ATTRIBUTES = 16
173 };
174
175 enum {
192 };
193
194 // CONSTANTS
195 static const char CLASS_NAME[];
196
198
200
202
204
206
208
210
212
214
216
218
219 public:
220 // CLASS METHODS
221
222 /// Return attribute information for the attribute indicated by the
223 /// specified `id` if the attribute exists, and 0 otherwise.
225
226 /// Return attribute information for the attribute indicated by the
227 /// specified `name` of the specified `nameLength` if the attribute
228 /// exists, and 0 otherwise.
230 const char *name,
231 int nameLength);
232
233 // CREATORS
234
235 /// Create an object of type `EncoderOptions` having the default value.
236 /// Use the optionally specified `basicAllocator` to supply memory. If
237 /// `basicAllocator` is 0, the currently installed default allocator is
238 /// used.
239 explicit EncoderOptions(bslma::Allocator *basicAllocator = 0);
240
241 /// Create an object of type `EncoderOptions` having the value of the
242 /// specified `original` object. Use the optionally specified
243 /// `basicAllocator` to supply memory. If `basicAllocator` is 0, the
244 /// currently installed default allocator is used.
246 bslma::Allocator *basicAllocator = 0);
247
248#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
249 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
250 /// Create an object of type `EncoderOptions` having the value of the
251 /// specified `original` object. After performing this action, the
252 /// `original` object will be left in a valid, but unspecified state.
253 EncoderOptions(EncoderOptions&& original) noexcept;
254
255 /// Create an object of type `EncoderOptions` having the value of the
256 /// specified `original` object. After performing this action, the
257 /// `original` object will be left in a valid, but unspecified state.
258 /// Use the optionally specified `basicAllocator` to supply memory. If
259 /// `basicAllocator` is 0, the currently installed default allocator is
260 /// used.
262 bslma::Allocator *basicAllocator);
263#endif
264
265 /// Destroy this object.
267
268 // MANIPULATORS
269
270 /// Assign to this object the value of the specified `rhs` object.
272
273#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
274 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
275 /// Assign to this object the value of the specified `rhs` object.
276 /// After performing this action, the `rhs` object will be left in a
277 /// valid, but unspecified state.
279#endif
280
281 /// Reset this object to the default value (i.e., its value upon
282 /// default construction).
283 void reset();
284
285 /// Invoke the specified `manipulator` sequentially on the address of
286 /// each (modifiable) attribute of this object, supplying `manipulator`
287 /// with the corresponding attribute information structure until such
288 /// invocation returns a non-zero value. Return the value from the
289 /// last invocation of `manipulator` (i.e., the invocation that
290 /// terminated the sequence).
291 template <typename t_MANIPULATOR>
292 int manipulateAttributes(t_MANIPULATOR& manipulator);
293
294 /// Invoke the specified `manipulator` on the address of
295 /// the (modifiable) attribute indicated by the specified `id`,
296 /// supplying `manipulator` with the corresponding attribute
297 /// information structure. Return the value returned from the
298 /// invocation of `manipulator` if `id` identifies an attribute of this
299 /// class, and -1 otherwise.
300 template <typename t_MANIPULATOR>
301 int manipulateAttribute(t_MANIPULATOR& manipulator, int id);
302
303 /// Invoke the specified `manipulator` on the address of
304 /// the (modifiable) attribute indicated by the specified `name` of the
305 /// specified `nameLength`, supplying `manipulator` with the
306 /// corresponding attribute information structure. Return the value
307 /// returned from the invocation of `manipulator` if `name` identifies
308 /// an attribute of this class, and -1 otherwise.
309 template <typename t_MANIPULATOR>
310 int manipulateAttribute(t_MANIPULATOR& manipulator,
311 const char *name,
312 int nameLength);
313
314 /// Set the "ObjectNamespace" attribute of this object to the specified
315 /// `value`.
316 void setObjectNamespace(const bsl::string_view& value);
317
318 /// Set the "SchemaLocation" attribute of this object to the specified
319 /// `value`.
320 void setSchemaLocation(const bsl::string_view& value);
321
322 /// Set the "Tag" attribute of this object to the specified `value`.
323 void setTag(const bsl::string_view& value);
324
325 /// Set the "FormattingMode" attribute of this object to the specified
326 /// `value`.
327 void setFormattingMode(int value);
328
329 /// Set the "InitialIndentLevel" attribute of this object to the
330 /// specified `value`.
331 void setInitialIndentLevel(int value);
332
333 /// Set the "SpacesPerLevel" attribute of this object to the specified
334 /// `value`.
335 void setSpacesPerLevel(int value);
336
337 /// Set the "WrapColumn" attribute of this object to the specified
338 /// `value`.
339 void setWrapColumn(int value);
340
341 /// Set the "MaxDecimalTotalDigits" attribute of this object to the
342 /// specified `value`.
344
345 /// Set the "MaxDecimalFractionDigits" attribute of this object to the
346 /// specified `value`.
348
349 /// Set the "SignificantDoubleDigits" attribute of this object to the
350 /// specified `value`.
352
353 /// Set the "EncodingStyle" attribute of this object to the specified
354 /// `value`.
356
357 /// Set the "AllowControlCharacters" attribute of this object to the
358 /// specified `value`.
359 void setAllowControlCharacters(bool value);
360
361 /// Set the "OutputXMLHeader" attribute of this object to the specified
362 /// `value`.
363 void setOutputXMLHeader(bool value);
364
365 /// Set the "OutputXSIAlias" attribute of this object to the specified
366 /// `value`.
367 void setOutputXSIAlias(bool value);
368
369 /// Set the "DatetimeFractionalSecondPrecision" attribute of this object
370 /// to the specified `value`.
372
373 /// Set the "UseZAbbreviationForUtc" attribute of this object to the
374 /// specified `value`.
375 void setUseZAbbreviationForUtc(bool value);
376
377 // ACCESSORS
378
379 /// Format this object to the specified output `stream` at the
380 /// optionally specified indentation `level` and return a reference to
381 /// the modifiable `stream`. If `level` is specified, optionally
382 /// specify `spacesPerLevel`, the number of spaces per indentation level
383 /// for this and all of its nested objects. Each line is indented by
384 /// the absolute value of `level * spacesPerLevel`. If `level` is
385 /// negative, suppress indentation of the first line. If
386 /// `spacesPerLevel` is negative, suppress line breaks and format the
387 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
388 ///
389 /// \note Note that a trailing newline is provided
390 /// in multiline mode only.
391 bsl::ostream& print(bsl::ostream& stream,
392 int level = 0,
393 int spacesPerLevel = 4) const;
394
395 /// Invoke the specified `accessor` sequentially on each
396 /// (non-modifiable) attribute of this object, supplying `accessor`
397 /// with the corresponding attribute information structure until such
398 /// invocation returns a non-zero value. Return the value from the
399 /// last invocation of `accessor` (i.e., the invocation that terminated
400 /// the sequence).
401 template <typename t_ACCESSOR>
402 int accessAttributes(t_ACCESSOR& accessor) const;
403
404 /// Invoke the specified `accessor` on the (non-modifiable) attribute
405 /// of this object indicated by the specified `id`, supplying `accessor`
406 /// with the corresponding attribute information structure. Return the
407 /// value returned from the invocation of `accessor` if `id` identifies
408 /// an attribute of this class, and -1 otherwise.
409 template <typename t_ACCESSOR>
410 int accessAttribute(t_ACCESSOR& accessor, int id) const;
411
412 /// Invoke the specified `accessor` on the (non-modifiable) attribute
413 /// of this object indicated by the specified `name` of the specified
414 /// `nameLength`, supplying `accessor` with the corresponding attribute
415 /// information structure. Return the value returned from the
416 /// invocation of `accessor` if `name` identifies an attribute of this
417 /// class, and -1 otherwise.
418 template <typename t_ACCESSOR>
419 int accessAttribute(t_ACCESSOR& accessor,
420 const char *name,
421 int nameLength) const;
422
423 /// Return a reference offering non-modifiable access to the
424 /// "ObjectNamespace" attribute of this object.
425 const bsl::string& objectNamespace() const;
426
427 /// Return a reference offering non-modifiable access to the
428 /// "SchemaLocation" attribute of this object.
429 const bsl::string& schemaLocation() const;
430
431 /// Return a reference offering non-modifiable access to the "Tag"
432 /// attribute of this object.
433 const bsl::string& tag() const;
434
435 /// Return the value of the "FormattingMode" attribute of this object.
436 int formattingMode() const;
437
438 /// Return the value of the "InitialIndentLevel" attribute of this
439 /// object.
440 int initialIndentLevel() const;
441
442 /// Return the value of the "SpacesPerLevel" attribute of this object.
443 int spacesPerLevel() const;
444
445 /// Return the value of the "WrapColumn" attribute of this object.
446 int wrapColumn() const;
447
448 /// Return a reference offering non-modifiable access to the
449 /// "MaxDecimalTotalDigits" attribute of this object.
451
452 /// Return a reference offering non-modifiable access to the
453 /// "MaxDecimalFractionDigits" attribute of this object.
455
456 /// Return a reference offering non-modifiable access to the
457 /// "SignificantDoubleDigits" attribute of this object.
459
460 /// Return the value of the "EncodingStyle" attribute of this object.
462
463 /// Return the value of the "AllowControlCharacters" attribute of this
464 /// object.
465 bool allowControlCharacters() const;
466
467 /// Return the value of the "OutputXMLHeader" attribute of this object.
468 bool outputXMLHeader() const;
469
470 /// Return the value of the "OutputXSIAlias" attribute of this object.
471 bool outputXSIAlias() const;
472
473 /// Return the value of the "DatetimeFractionalSecondPrecision"
474 /// attribute of this object.
476
477 /// Return the value of the "UseZAbbreviationForUtc" attribute of this
478 /// object.
479 bool useZAbbreviationForUtc() const;
480};
481
482// FREE OPERATORS
483
484/// Return `true` if the specified `lhs` and `rhs` attribute objects have
485/// the same value, and `false` otherwise. Two attribute objects have the
486/// same value if each respective attribute has the same value.
487inline
488bool operator==(const EncoderOptions& lhs, const EncoderOptions& rhs);
489
490/// Return `true` if the specified `lhs` and `rhs` attribute objects do not
491/// have the same value, and `false` otherwise. Two attribute objects do
492/// not have the same value if one or more respective attributes differ in
493/// values.
494inline
495bool operator!=(const EncoderOptions& lhs, const EncoderOptions& rhs);
496
497/// Format the specified `rhs` to the specified output `stream` and
498/// return a reference to the modifiable `stream`.
499inline
500bsl::ostream& operator<<(bsl::ostream& stream, const EncoderOptions& rhs);
501
502} // close package namespace
503
504// TRAITS
505
507
508// ============================================================================
509// INLINE FUNCTION DEFINITIONS
510// ============================================================================
511
512namespace balxml {
513
514 // --------------------
515 // class EncoderOptions
516 // --------------------
517
518// CLASS METHODS
519// MANIPULATORS
520template <typename t_MANIPULATOR>
521int EncoderOptions::manipulateAttributes(t_MANIPULATOR& manipulator)
522{
523 int ret;
524
525 ret = manipulator(&d_objectNamespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OBJECT_NAMESPACE]);
526 if (ret) {
527 return ret;
528 }
529
530 ret = manipulator(&d_schemaLocation, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SCHEMA_LOCATION]);
531 if (ret) {
532 return ret;
533 }
534
535 ret = manipulator(&d_tag, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TAG]);
536 if (ret) {
537 return ret;
538 }
539
540 ret = manipulator(&d_formattingMode, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FORMATTING_MODE]);
541 if (ret) {
542 return ret;
543 }
544
545 ret = manipulator(&d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
546 if (ret) {
547 return ret;
548 }
549
550 ret = manipulator(&d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
551 if (ret) {
552 return ret;
553 }
554
555 ret = manipulator(&d_wrapColumn, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_WRAP_COLUMN]);
556 if (ret) {
557 return ret;
558 }
559
560 ret = manipulator(&d_maxDecimalTotalDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_TOTAL_DIGITS]);
561 if (ret) {
562 return ret;
563 }
564
565 ret = manipulator(&d_maxDecimalFractionDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_FRACTION_DIGITS]);
566 if (ret) {
567 return ret;
568 }
569
570 ret = manipulator(&d_significantDoubleDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SIGNIFICANT_DOUBLE_DIGITS]);
571 if (ret) {
572 return ret;
573 }
574
575 ret = manipulator(&d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
576 if (ret) {
577 return ret;
578 }
579
580 ret = manipulator(&d_allowControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONTROL_CHARACTERS]);
581 if (ret) {
582 return ret;
583 }
584
585 ret = manipulator(&d_outputXMLHeader, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_M_L_HEADER]);
586 if (ret) {
587 return ret;
588 }
589
590 ret = manipulator(&d_outputXSIAlias, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_S_I_ALIAS]);
591 if (ret) {
592 return ret;
593 }
594
595 ret = manipulator(&d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
596 if (ret) {
597 return ret;
598 }
599
600 ret = manipulator(&d_useZAbbreviationForUtc, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_USE_Z_ABBREVIATION_FOR_UTC]);
601 if (ret) {
602 return ret;
603 }
604
605 return 0;
606}
607
608template <typename t_MANIPULATOR>
609int EncoderOptions::manipulateAttribute(t_MANIPULATOR& manipulator, int id)
610{
611 enum { NOT_FOUND = -1 };
612
613 switch (id) {
615 return manipulator(&d_objectNamespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OBJECT_NAMESPACE]);
616 }
618 return manipulator(&d_schemaLocation, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SCHEMA_LOCATION]);
619 }
620 case ATTRIBUTE_ID_TAG: {
621 return manipulator(&d_tag, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TAG]);
622 }
624 return manipulator(&d_formattingMode, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FORMATTING_MODE]);
625 }
627 return manipulator(&d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
628 }
630 return manipulator(&d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
631 }
633 return manipulator(&d_wrapColumn, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_WRAP_COLUMN]);
634 }
636 return manipulator(&d_maxDecimalTotalDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_TOTAL_DIGITS]);
637 }
639 return manipulator(&d_maxDecimalFractionDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_FRACTION_DIGITS]);
640 }
642 return manipulator(&d_significantDoubleDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SIGNIFICANT_DOUBLE_DIGITS]);
643 }
645 return manipulator(&d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
646 }
648 return manipulator(&d_allowControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONTROL_CHARACTERS]);
649 }
651 return manipulator(&d_outputXMLHeader, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_M_L_HEADER]);
652 }
654 return manipulator(&d_outputXSIAlias, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_S_I_ALIAS]);
655 }
657 return manipulator(&d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
658 }
660 return manipulator(&d_useZAbbreviationForUtc, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_USE_Z_ABBREVIATION_FOR_UTC]);
661 }
662 default:
663 return NOT_FOUND;
664 }
665}
666
667template <typename t_MANIPULATOR>
669 t_MANIPULATOR& manipulator,
670 const char *name,
671 int nameLength)
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 manipulateAttribute(manipulator, attributeInfo->d_id);
682}
683
684inline
686{
687 d_objectNamespace = value;
688}
689
690inline
692{
693 d_schemaLocation = value;
694}
695
696inline
698{
699 d_tag = value;
700}
701
702inline
704{
705 d_formattingMode = value;
706}
707
708inline
710{
711 d_initialIndentLevel = value;
712}
713
714inline
716{
717 d_spacesPerLevel = value;
718}
719
720inline
722{
723 d_wrapColumn = value;
724}
725
726inline
728{
729 d_maxDecimalTotalDigits = value;
730}
731
732inline
734{
735 d_maxDecimalFractionDigits = value;
736}
737
738inline
740{
741 d_significantDoubleDigits = value;
742}
743
744inline
746{
747 d_encodingStyle = value;
748}
749
750inline
752{
753 d_allowControlCharacters = value;
754}
755
756inline
758{
759 d_outputXMLHeader = value;
760}
761
762inline
764{
765 d_outputXSIAlias = value;
766}
767
768inline
770{
771 d_datetimeFractionalSecondPrecision = value;
772}
773
774inline
776{
777 d_useZAbbreviationForUtc = value;
778}
779
780// ACCESSORS
781template <typename t_ACCESSOR>
782int EncoderOptions::accessAttributes(t_ACCESSOR& accessor) const
783{
784 int ret;
785
786 ret = accessor(d_objectNamespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OBJECT_NAMESPACE]);
787 if (ret) {
788 return ret;
789 }
790
791 ret = accessor(d_schemaLocation, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SCHEMA_LOCATION]);
792 if (ret) {
793 return ret;
794 }
795
796 ret = accessor(d_tag, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TAG]);
797 if (ret) {
798 return ret;
799 }
800
801 ret = accessor(d_formattingMode, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FORMATTING_MODE]);
802 if (ret) {
803 return ret;
804 }
805
806 ret = accessor(d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
807 if (ret) {
808 return ret;
809 }
810
811 ret = accessor(d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
812 if (ret) {
813 return ret;
814 }
815
816 ret = accessor(d_wrapColumn, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_WRAP_COLUMN]);
817 if (ret) {
818 return ret;
819 }
820
821 ret = accessor(d_maxDecimalTotalDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_TOTAL_DIGITS]);
822 if (ret) {
823 return ret;
824 }
825
826 ret = accessor(d_maxDecimalFractionDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_FRACTION_DIGITS]);
827 if (ret) {
828 return ret;
829 }
830
831 ret = accessor(d_significantDoubleDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SIGNIFICANT_DOUBLE_DIGITS]);
832 if (ret) {
833 return ret;
834 }
835
836 ret = accessor(d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
837 if (ret) {
838 return ret;
839 }
840
841 ret = accessor(d_allowControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONTROL_CHARACTERS]);
842 if (ret) {
843 return ret;
844 }
845
846 ret = accessor(d_outputXMLHeader, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_M_L_HEADER]);
847 if (ret) {
848 return ret;
849 }
850
851 ret = accessor(d_outputXSIAlias, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_S_I_ALIAS]);
852 if (ret) {
853 return ret;
854 }
855
856 ret = accessor(d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
857 if (ret) {
858 return ret;
859 }
860
861 ret = accessor(d_useZAbbreviationForUtc, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_USE_Z_ABBREVIATION_FOR_UTC]);
862 if (ret) {
863 return ret;
864 }
865
866 return 0;
867}
868
869template <typename t_ACCESSOR>
870int EncoderOptions::accessAttribute(t_ACCESSOR& accessor, int id) const
871{
872 enum { NOT_FOUND = -1 };
873
874 switch (id) {
876 return accessor(d_objectNamespace, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OBJECT_NAMESPACE]);
877 }
879 return accessor(d_schemaLocation, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SCHEMA_LOCATION]);
880 }
881 case ATTRIBUTE_ID_TAG: {
882 return accessor(d_tag, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_TAG]);
883 }
885 return accessor(d_formattingMode, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FORMATTING_MODE]);
886 }
888 return accessor(d_initialIndentLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL]);
889 }
891 return accessor(d_spacesPerLevel, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SPACES_PER_LEVEL]);
892 }
894 return accessor(d_wrapColumn, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_WRAP_COLUMN]);
895 }
897 return accessor(d_maxDecimalTotalDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_TOTAL_DIGITS]);
898 }
900 return accessor(d_maxDecimalFractionDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_MAX_DECIMAL_FRACTION_DIGITS]);
901 }
903 return accessor(d_significantDoubleDigits, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SIGNIFICANT_DOUBLE_DIGITS]);
904 }
906 return accessor(d_encodingStyle, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ENCODING_STYLE]);
907 }
909 return accessor(d_allowControlCharacters, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ALLOW_CONTROL_CHARACTERS]);
910 }
912 return accessor(d_outputXMLHeader, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_M_L_HEADER]);
913 }
915 return accessor(d_outputXSIAlias, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_OUTPUT_X_S_I_ALIAS]);
916 }
918 return accessor(d_datetimeFractionalSecondPrecision, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION]);
919 }
921 return accessor(d_useZAbbreviationForUtc, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_USE_Z_ABBREVIATION_FOR_UTC]);
922 }
923 default:
924 return NOT_FOUND;
925 }
926}
927
928template <typename t_ACCESSOR>
930 t_ACCESSOR& accessor,
931 const char *name,
932 int nameLength) const
933{
934 enum { NOT_FOUND = -1 };
935
936 const bdlat_AttributeInfo *attributeInfo =
937 lookupAttributeInfo(name, nameLength);
938 if (0 == attributeInfo) {
939 return NOT_FOUND;
940 }
941
942 return accessAttribute(accessor, attributeInfo->d_id);
943}
944
945inline
947{
948 return d_objectNamespace;
949}
950
951inline
953{
954 return d_schemaLocation;
955}
956
957inline
959{
960 return d_tag;
961}
962
963inline
965{
966 return d_formattingMode;
967}
968
969inline
971{
972 return d_initialIndentLevel;
973}
974
975inline
977{
978 return d_spacesPerLevel;
979}
980
981inline
983{
984 return d_wrapColumn;
985}
986
987inline
989{
990 return d_maxDecimalTotalDigits;
991}
992
993inline
995{
996 return d_maxDecimalFractionDigits;
997}
998
999inline
1001{
1002 return d_significantDoubleDigits;
1003}
1004
1005inline
1007{
1008 return d_encodingStyle;
1009}
1010
1011inline
1013{
1014 return d_allowControlCharacters;
1015}
1016
1017inline
1019{
1020 return d_outputXMLHeader;
1021}
1022
1023inline
1025{
1026 return d_outputXSIAlias;
1027}
1028
1029inline
1031{
1032 return d_datetimeFractionalSecondPrecision;
1033}
1034
1035inline
1037{
1038 return d_useZAbbreviationForUtc;
1039}
1040
1041} // close package namespace
1042
1043// FREE FUNCTIONS
1044
1045inline
1047 const balxml::EncoderOptions& lhs,
1048 const balxml::EncoderOptions& rhs)
1049{
1050 return lhs.objectNamespace() == rhs.objectNamespace()
1051 && lhs.schemaLocation() == rhs.schemaLocation()
1052 && lhs.tag() == rhs.tag()
1053 && lhs.formattingMode() == rhs.formattingMode()
1054 && lhs.initialIndentLevel() == rhs.initialIndentLevel()
1055 && lhs.spacesPerLevel() == rhs.spacesPerLevel()
1056 && lhs.wrapColumn() == rhs.wrapColumn()
1057 && lhs.maxDecimalTotalDigits() == rhs.maxDecimalTotalDigits()
1058 && lhs.maxDecimalFractionDigits() == rhs.maxDecimalFractionDigits()
1059 && lhs.significantDoubleDigits() == rhs.significantDoubleDigits()
1060 && lhs.encodingStyle() == rhs.encodingStyle()
1061 && lhs.allowControlCharacters() == rhs.allowControlCharacters()
1062 && lhs.outputXMLHeader() == rhs.outputXMLHeader()
1063 && lhs.outputXSIAlias() == rhs.outputXSIAlias()
1064 && lhs.datetimeFractionalSecondPrecision() == rhs.datetimeFractionalSecondPrecision()
1065 && lhs.useZAbbreviationForUtc() == rhs.useZAbbreviationForUtc();
1066}
1067
1068inline
1070 const balxml::EncoderOptions& lhs,
1071 const balxml::EncoderOptions& rhs)
1072{
1073 return !(lhs == rhs);
1074}
1075
1076inline
1077bsl::ostream& balxml::operator<<(
1078 bsl::ostream& stream,
1079 const balxml::EncoderOptions& rhs)
1080{
1081 return rhs.print(stream, 0, -1);
1082}
1083
1084
1085#endif
1086
1087// GENERATED BY @BLP_BAS_CODEGEN_VERSION@
1088// USING bas_codegen.pl -m msg -p balxml -E --noExternalization --noAggregateConversion --noHashSupport balxml.xsd
1089// ----------------------------------------------------------------------------
1090// NOTICE:
1091// Copyright 2023 Bloomberg Finance L.P. All rights reserved.
1092// Property of Bloomberg Finance L.P. (BFLP)
1093// This software is made available solely pursuant to the
1094// terms of a BFLP license agreement which governs its use.
1095// ------------------------------- END-OF-FILE --------------------------------
1096
1097/** @} */
1098/** @} */
1099/** @} */
Definition balxml_encoderoptions.h:89
bool outputXSIAlias() const
Return the value of the "OutputXSIAlias" attribute of this object.
Definition balxml_encoderoptions.h:1024
void setEncodingStyle(EncodingStyle::Value value)
Definition balxml_encoderoptions.h:745
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition balxml_encoderoptions.h:217
void setSchemaLocation(const bsl::string_view &value)
Definition balxml_encoderoptions.h:691
const bsl::string & schemaLocation() const
Definition balxml_encoderoptions.h:952
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
int initialIndentLevel() const
Definition balxml_encoderoptions.h:970
void setInitialIndentLevel(int value)
Definition balxml_encoderoptions.h:709
static const bool DEFAULT_INITIALIZER_USE_Z_ABBREVIATION_FOR_UTC
Definition balxml_encoderoptions.h:215
int accessAttribute(t_ACCESSOR &accessor, int id) const
Definition balxml_encoderoptions.h:870
void setFormattingMode(int value)
Definition balxml_encoderoptions.h:703
const bdlb::NullableValue< int > & maxDecimalTotalDigits() const
Definition balxml_encoderoptions.h:988
EncodingStyle::Value encodingStyle() const
Return the value of the "EncodingStyle" attribute of this object.
Definition balxml_encoderoptions.h:1006
const bdlb::NullableValue< int > & maxDecimalFractionDigits() const
Definition balxml_encoderoptions.h:994
void setMaxDecimalTotalDigits(const bdlb::NullableValue< int > &value)
Definition balxml_encoderoptions.h:727
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
static const bool DEFAULT_INITIALIZER_OUTPUT_X_M_L_HEADER
Definition balxml_encoderoptions.h:209
int spacesPerLevel() const
Return the value of the "SpacesPerLevel" attribute of this object.
Definition balxml_encoderoptions.h:976
static const bool DEFAULT_INITIALIZER_OUTPUT_X_S_I_ALIAS
Definition balxml_encoderoptions.h:211
@ ATTRIBUTE_ID_OUTPUT_X_S_I_ALIAS
Definition balxml_encoderoptions.h:166
@ ATTRIBUTE_ID_TAG
Definition balxml_encoderoptions.h:155
@ ATTRIBUTE_ID_WRAP_COLUMN
Definition balxml_encoderoptions.h:159
@ ATTRIBUTE_ID_MAX_DECIMAL_FRACTION_DIGITS
Definition balxml_encoderoptions.h:161
@ ATTRIBUTE_ID_USE_Z_ABBREVIATION_FOR_UTC
Definition balxml_encoderoptions.h:168
@ ATTRIBUTE_ID_ALLOW_CONTROL_CHARACTERS
Definition balxml_encoderoptions.h:164
@ ATTRIBUTE_ID_ENCODING_STYLE
Definition balxml_encoderoptions.h:163
@ ATTRIBUTE_ID_OUTPUT_X_M_L_HEADER
Definition balxml_encoderoptions.h:165
@ ATTRIBUTE_ID_SIGNIFICANT_DOUBLE_DIGITS
Definition balxml_encoderoptions.h:162
@ ATTRIBUTE_ID_SPACES_PER_LEVEL
Definition balxml_encoderoptions.h:158
@ ATTRIBUTE_ID_INITIAL_INDENT_LEVEL
Definition balxml_encoderoptions.h:157
@ ATTRIBUTE_ID_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition balxml_encoderoptions.h:167
@ ATTRIBUTE_ID_SCHEMA_LOCATION
Definition balxml_encoderoptions.h:154
@ ATTRIBUTE_ID_FORMATTING_MODE
Definition balxml_encoderoptions.h:156
@ ATTRIBUTE_ID_OBJECT_NAMESPACE
Definition balxml_encoderoptions.h:153
@ ATTRIBUTE_ID_MAX_DECIMAL_TOTAL_DIGITS
Definition balxml_encoderoptions.h:160
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
bool outputXMLHeader() const
Return the value of the "OutputXMLHeader" attribute of this object.
Definition balxml_encoderoptions.h:1018
void setDatetimeFractionalSecondPrecision(int value)
Definition balxml_encoderoptions.h:769
void setSpacesPerLevel(int value)
Definition balxml_encoderoptions.h:715
void setMaxDecimalFractionDigits(const bdlb::NullableValue< int > &value)
Definition balxml_encoderoptions.h:733
@ ATTRIBUTE_INDEX_TAG
Definition balxml_encoderoptions.h:178
@ ATTRIBUTE_INDEX_WRAP_COLUMN
Definition balxml_encoderoptions.h:182
@ ATTRIBUTE_INDEX_OUTPUT_X_S_I_ALIAS
Definition balxml_encoderoptions.h:189
@ ATTRIBUTE_INDEX_MAX_DECIMAL_FRACTION_DIGITS
Definition balxml_encoderoptions.h:184
@ ATTRIBUTE_INDEX_SPACES_PER_LEVEL
Definition balxml_encoderoptions.h:181
@ ATTRIBUTE_INDEX_OBJECT_NAMESPACE
Definition balxml_encoderoptions.h:176
@ ATTRIBUTE_INDEX_INITIAL_INDENT_LEVEL
Definition balxml_encoderoptions.h:180
@ ATTRIBUTE_INDEX_ALLOW_CONTROL_CHARACTERS
Definition balxml_encoderoptions.h:187
@ ATTRIBUTE_INDEX_MAX_DECIMAL_TOTAL_DIGITS
Definition balxml_encoderoptions.h:183
@ ATTRIBUTE_INDEX_USE_Z_ABBREVIATION_FOR_UTC
Definition balxml_encoderoptions.h:191
@ ATTRIBUTE_INDEX_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition balxml_encoderoptions.h:190
@ ATTRIBUTE_INDEX_SCHEMA_LOCATION
Definition balxml_encoderoptions.h:177
@ ATTRIBUTE_INDEX_SIGNIFICANT_DOUBLE_DIGITS
Definition balxml_encoderoptions.h:185
@ ATTRIBUTE_INDEX_OUTPUT_X_M_L_HEADER
Definition balxml_encoderoptions.h:188
@ ATTRIBUTE_INDEX_ENCODING_STYLE
Definition balxml_encoderoptions.h:186
@ ATTRIBUTE_INDEX_FORMATTING_MODE
Definition balxml_encoderoptions.h:179
EncoderOptions & operator=(const EncoderOptions &rhs)
Assign to this object the value of the specified rhs object.
void setUseZAbbreviationForUtc(bool value)
Definition balxml_encoderoptions.h:775
int wrapColumn() const
Return the value of the "WrapColumn" attribute of this object.
Definition balxml_encoderoptions.h:982
const bsl::string & tag() const
Definition balxml_encoderoptions.h:958
@ NUM_ATTRIBUTES
Definition balxml_encoderoptions.h:172
void setOutputXMLHeader(bool value)
Definition balxml_encoderoptions.h:757
static const bool DEFAULT_INITIALIZER_ALLOW_CONTROL_CHARACTERS
Definition balxml_encoderoptions.h:207
static const int DEFAULT_INITIALIZER_FORMATTING_MODE
Definition balxml_encoderoptions.h:197
void setOutputXSIAlias(bool value)
Definition balxml_encoderoptions.h:763
void setSignificantDoubleDigits(const bdlb::NullableValue< int > &value)
Definition balxml_encoderoptions.h:739
static const int DEFAULT_INITIALIZER_WRAP_COLUMN
Definition balxml_encoderoptions.h:203
EncoderOptions(const EncoderOptions &original, bslma::Allocator *basicAllocator=0)
static const int DEFAULT_INITIALIZER_SPACES_PER_LEVEL
Definition balxml_encoderoptions.h:201
bool useZAbbreviationForUtc() const
Definition balxml_encoderoptions.h:1036
static const EncodingStyle::Value DEFAULT_INITIALIZER_ENCODING_STYLE
Definition balxml_encoderoptions.h:205
static const char CLASS_NAME[]
Definition balxml_encoderoptions.h:195
static const int DEFAULT_INITIALIZER_DATETIME_FRACTIONAL_SECOND_PRECISION
Definition balxml_encoderoptions.h:213
bool allowControlCharacters() const
Definition balxml_encoderoptions.h:1012
int manipulateAttributes(t_MANIPULATOR &manipulator)
Definition balxml_encoderoptions.h:521
void setObjectNamespace(const bsl::string_view &value)
Definition balxml_encoderoptions.h:685
void setTag(const bsl::string_view &value)
Set the "Tag" attribute of this object to the specified value.
Definition balxml_encoderoptions.h:697
void setAllowControlCharacters(bool value)
Definition balxml_encoderoptions.h:751
int accessAttributes(t_ACCESSOR &accessor) const
Definition balxml_encoderoptions.h:782
int datetimeFractionalSecondPrecision() const
Definition balxml_encoderoptions.h:1030
const bdlb::NullableValue< int > & significantDoubleDigits() const
Definition balxml_encoderoptions.h:1000
const bsl::string & objectNamespace() const
Definition balxml_encoderoptions.h:946
int manipulateAttribute(t_MANIPULATOR &manipulator, int id)
Definition balxml_encoderoptions.h:609
void setWrapColumn(int value)
Definition balxml_encoderoptions.h:721
int formattingMode() const
Return the value of the "FormattingMode" attribute of this object.
Definition balxml_encoderoptions.h:964
~EncoderOptions()
Destroy this object.
EncoderOptions(bslma::Allocator *basicAllocator=0)
static const int DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL
Definition balxml_encoderoptions.h:199
Definition bdlb_nullablevalue.h:262
Definition bslstl_stringview.h:471
Definition bslstl_string.h:1252
Definition bslma_allocator.h:545
#define BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:301
#define BSLS_IDENT_RCSID(tag, str)
BSLS_IDENT_RCSID() - insert ident str (specific to platform/compiler)
Definition bsls_ident.h:244
#define BSLS_IDENT_PRAGMA_ONCE
BSLS_IDENT_PRAGMA_ONCE - macro to avoid multiple inclusion
Definition bsls_ident.h:263
Definition balxml_base64parser.h:150
bsl::ostream & operator<<(bsl::ostream &stream, const ConfigSchema &schema)
bool operator==(const DecoderOptions &lhs, const DecoderOptions &rhs)
bool operator!=(const DecoderOptions &lhs, const DecoderOptions &rhs)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
Definition baljsn_encoder_testtypes.h:76
Value
Definition balxml_encodingstyle.h:76
Definition bdlat_attributeinfo.h:139
int d_id
Definition bdlat_attributeinfo.h:142