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