BDE 4.39.x Production Release
Loading...
Searching...
No Matches
balxml_formatter_compactimpl.h
Go to the documentation of this file.
1/// @file balxml_formatter_compactimpl.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// balxml_formatter_compactimpl.h -*-C++-*-
8#ifndef INCLUDED_BALXML_FORMATTER_COMPACTIMPL
9#define INCLUDED_BALXML_FORMATTER_COMPACTIMPL
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup balxml_formatter_compactimpl balxml_formatter_compactimpl
15/// @brief Provide a minimal-whitespace implementation for `balxml_formatter`.
16/// @addtogroup bal
17/// @{
18/// @addtogroup balxml
19/// @{
20/// @addtogroup balxml_formatter_compactimpl
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#balxml_formatter_compactimpl-purpose"> Purpose</a>
25/// * <a href="#balxml_formatter_compactimpl-classes"> Classes </a>
26/// * <a href="#balxml_formatter_compactimpl-description"> Description </a>
27///
28/// # Purpose {#balxml_formatter_compactimpl-purpose}
29/// Provide a minimal-whitespace implementation for @ref balxml_formatter .
30///
31/// # Classes {#balxml_formatter_compactimpl-classes}
32///
33/// - balxml::Formatter_CompactImplState: state of formatter state machine
34/// - balxml::Formatter_CompactImplStateId: labels for formatter state
35/// - balxml::Formatter_CompactImplUtil: actions of formatter state machine
36///
37/// # Description {#balxml_formatter_compactimpl-description}
38/// This private, subordinate component to @ref balxml_formatter
39/// provides an in-core value semantic attribute class,
40/// `balxml::Formatter_CompactImplState`, and a utility `struct`,
41/// `balxml::Formatter_CompactImplUtil`, that implements XML printing operations
42/// using the state value type. These two classes work in conjunction to
43/// implement a state machine for printing an XML document having minimal
44/// whitespace, given a sequence of tokens to emit. The class
45/// `balxml::Formatter_CompactImplStateId` enumerates the set of labels for
46/// distinct states of `balxml::Formatter_CompactImplState`, upon which most
47/// control-flow decisions of `balxml::Formatter_CompactImplUtil` are
48/// based.
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bal
54 * @{
55 */
56/** @addtogroup balxml
57 * @{
58 */
59/** @addtogroup balxml_formatter_compactimpl
60 * @{
61 */
62
63#include <balscm_version.h>
64
68
69#include <bsl_ostream.h>
70#include <bsl_string_view.h>
71
72
73namespace balxml {
74
75 // ===================================
76 // struct Formatter_CompactImplStateId
77 // ===================================
78
79/// This `struct` provides a namespace for enumerating a set of labels for
80/// distinct states of `Formatter_CompactImplState`.
81///
82/// See @ref balxml_formatter_compactimpl
84
85 // TYPES
86 enum Enum {
87 /// This state indicates that the current write position of the
88 /// formatter is at the start of the document. The formatter is
89 /// only allowed to add an XML header when in this state.
91
92 /// This state indicates that the current write position of the
93 /// formatter is immediately after the name of an opening tag, or
94 /// otherwise immediately after the value of an attribute of an
95 /// opening tag. In this state, most token printing operations,
96 /// other than adding attributes, need to emit a ">" character to
97 /// close the currently open tag before emitting their content. For
98 /// example:
99 /// @code
100 /// 1| <someTag
101 /// `---------^
102 ///
103 /// *
104 /// \note Note that there is no '>' character yet
105 /// @endcode
106 /// or:
107 /// @code
108 /// 1| <someTag attr="value" otherAttr="42"
109 /// `-------------------------------------^
110 /// @endcode
112
113 /// This state indicates that the current write position of the
114 /// formatter is either 1) after a closing tag, or 2) after a
115 /// complete opening tag and before any data for the tag. In this
116 /// state, data printing operations do *not* need to emit delimiting whitespace for their content.
117 ///
118 /// \note Note that comments are not
119 /// considered data. For example:
120 /// @code
121 /// 1| <someTag>
122 /// `----------^
123 /// @endcode
124 /// or:
125 /// @code
126 /// 1| <someTag><!-- comment -->
127 /// `--------------------------^
128 /// @endcode
129 /// or:
130 /// @code
131 /// 1| <someTag></someTag>
132 /// `--------------------^
133 /// @endcode
135
136 /// This state indicates that the current write position of the
137 /// formatter is after one or more data tokens for the
138 /// currently-open tag. In this state, data printing operations
139 /// need to emit delimiting whitespace for their content. For
140 /// example:
141 /// @code
142 /// 1| <someTag>data
143 /// `--------------^
144 /// @endcode
145 /// or:
146 /// @code
147 /// 1| <someTag>some list data
148 /// `------------------------^
149 /// @endcode
151 };
152};
153
154 // ================================
155 // class Formatter_CompactImplState
156 // ================================
157
158/// This class provides an in-core, value-semantic attribute type that
159/// maintains all of the state information needed to print an XML document
160/// with minimal whitespace using the operations provided by
161/// `Formatter_CompactImplUtil`.
162///
163/// See @ref balxml_formatter_compactimpl
165
166 public:
167 // TYPES
169
170 private:
171 // DATA
172
173 // the canonical "state" in the state machine, upon which most
174 // control-flow decisions are based when printing
175 Id::Enum d_id;
176
177 // the current open XML tag nesting depth
178 int d_indentLevel;
179
180 // the XML tag nesting depth to use at the start of the document, and
181 // the value to which `d_indentLevel` is set upon `reset`, which no
182 // printing operations modify
183 int d_initialIndentLevel;
184
185 // an option that the formatter does not use in compact mode, but
186 // which is accessible to clients in any mode
187 int d_spacesPerLevel;
188
189 // an approximation of the current column number, which does not take
190 // into account the number of characters used to print any data, and
191 // which the formatter does not use in compact mode, but is accessible
192 // to clients in any mode
193 int d_column;
194
195 public:
196 // CREATORS
197
198 /// Create a `Formatter_CompactImplState` having an `id` attribute of
199 /// `Id::e_AT_START`, and `indentLevel`, `initialIndentLevel`,
200 /// `spacesPerLevel`, and `column` attributes of 0.
202
203 /// Create a `Formatter_CompactImplState` having an `id` attribute of
204 /// `Id::e_AT_START`, the specified `indentLevel` and `spacesPerLevel`,
205 /// as well as an `initialIndentLevel` attribute equal to `indentLevel`,
206 /// and a `column` attribute of 0.
208
209 /// Create a `Formatter_CompactImplState` having the specified `id`,
210 /// `indentLevel`, `initialIndentLevel`, `spacesPerLevel`, and `column`
211 /// attributes.
213 int indentLevel,
215 int spacesPerLevel,
216 int column);
217
218 // MANIPULATORS
219
220 /// Return a reference providing modifiable access to the `column`
221 /// attribute of this object.
222 int& column();
223
224 /// Return a reference providing modifiable access to the `id` attribute
225 /// of this object.
226 Id::Enum& id();
227
228 /// Return a reference providing modifiable access to the `indentLevel`
229 /// attribute of this object.
230 int& indentLevel();
231
232 /// Return a reference providing modifiable access to the
233 /// `initialIndentLevel` attribute of this object.
234 int& initialIndentLevel();
235
236 /// Return a reference providing modifiable access to the
237 /// `spacesPerLevel` attribute of this object.
238 int& spacesPerLevel();
239
240 // ACCESSORS
241
242 /// Return a reference providing non-modifiable access to the `column`
243 /// attribute of this object.
244 const int& column() const;
245
246 /// Return a reference providing non-modifiable access to the `id`
247 /// attribute of this object.
248 const Id::Enum& id() const;
249
250 /// Return a reference providing non-modifiable access to the
251 /// `indentLevel` attribute of this object.
252 const int& indentLevel() const;
253
254 /// Return a reference providing non-modifiable access to the
255 /// `initialIndentLevel` attribute of this object.
256 const int& initialIndentLevel() const;
257
258 /// Return a reference providing non-modifiable access to the
259 /// `spacesPerLevel` attribute of this object.
260 const int& spacesPerLevel() const;
261};
262
263 // ================================
264 // struct Formatter_CompactImplUtil
265 // ================================
266
267/// This utility `struct` provides a namespace for a suite of operations
268/// used to pretty-print XML documents given a sequence of tokens to emit.
269/// Together with `Formatter_CompactImplState`, this `struct` provides an
270/// implementation of a state machine for such pretty-printing.
271///
272/// See @ref balxml_formatter_compactimpl
274
275 // TYPES
279
280 private:
281 // PRIVATE CLASS METHODS
282
283 /// Write the specified `openMarker`, `comment`, and `closeMarker` into
284 /// the specified `stream`, with formatting depending on the specified `state`, and update the `state` accordingly.
285 ///
286 /// \note Note that if an
287 /// element-opening tag is not completed with a `>`, this function will
288 /// add `>`.
289 static void addCommentImpl(bsl::ostream& stream,
290 State *state,
291 const bsl::string_view& comment,
292 const bsl::string_view& openMarker,
293 const bsl::string_view& closeMarker);
294
295 public:
296 // CLASS METHODS
297
298 /// Add an attribute of the specified `name` and specified `value` to
299 /// the currently open element in the specified `stream`, with
300 /// formatting depending on the specified `state`, and update the
301 /// `state` accordingly. Return the `stream`. `value` can be of the
302 /// following types: `char`, `short`, `int`, `bsls::Types::Int64`,
303 /// `float`, `double`, `bsl::string`, `bdlt::Datetime`, `bdlt::Date`,
304 /// and `bdlt::Time`. Precede this name="value" pair with a single
305 /// space. Wrap line (write the attribute on next line with proper
306 /// indentation), if the length of name="value" is too long. Optionally
307 /// specify a `valueFormattingMode` and `encoderOptions` to control the
308 /// formatting of `value`. If `value` is of type `bsl::string`, it is
309 /// truncated at any invalid UTF-8 byte-sequence or any control
310 /// character. The list of invalid control characters includes
311 /// characters in the range `[0x00, 0x20)` and `0x7F` (DEL) but does not
312 /// include `0x9`, `0xA`, and `0x0D`. The five special characters:
313 /// apostrophe, double quote, ampersand, less than, and greater than are
314 /// escaped in the output XML. If `value` is of type `char`, it is cast
315 /// to a signed byte value with a range `[ -128 .. 127 ]`.
316 ///
317 /// \pre The behavior is undefined unless the last manipulator was `openElement`
318 /// or `addAttribute`.
319 template <class VALUE_TYPE>
320 static bsl::ostream& addAttribute(
321 bsl::ostream& stream,
322 State *state,
323 const bsl::string_view& name,
324 const VALUE_TYPE& value,
325 int valueFormattingMode = 0,
326 const EncoderOptions& encoderOptions = EncoderOptions());
327
328 /// Insert one or two newline characters into the specified `stream`
329 /// stream such that a blank line results, depending on the specified
330 /// `state`, and update the `state` accordingly. Return the `stream`.
331 /// If the last output was a newline, then only one newline is added,
332 /// otherwise two newlines are added. If following a call to
333 /// `openElement`, or `addAttribute`, add a closing `>` to the opened
334 /// tag.
335 static bsl::ostream& addBlankLine(bsl::ostream& stream, State *state);
336
337 /// Write the specified `comment` into the specified `stream`, with
338 /// formatting depending on the specified `state`, and update the
339 /// `state` accordingly. Return the `stream`. The optionally specified
340 /// `forceNewline`, if true, forces to start a new line solely for the
341 /// comment if it's not on a new line already. Otherwise, comments
342 /// continue on current line. If an element-opening tag is not
343 /// completed with a `>`, `addComment` will add `>`.
344 ///
345 /// @deprecated Use @ref addValidComment instead.
346 static bsl::ostream& addComment(
347 bsl::ostream& stream,
348 State *state,
349 const bsl::string_view& comment,
350 bool forceNewline = true);
351
352 /// Add the specified `value` as the data content to the specified
353 /// `stream`, with formatting depending on the specified `state`, and
354 /// update `state` accordingly. Return the `stream`. `value` can be of
355 /// the following types: `char`, `short`, `int`, `bsls::Types::Int64`,
356 /// `float`, `double`, `bsl::string`, `bdlt::Datetime`, `bdlt::Date`,
357 /// and `bdlt::Time`. Perform no line-wrapping or indentation as if the
358 /// whitespace constraint were always `BAEXML_PRESERVE_WHITESPACE` in
359 /// `openElement`, with the only exception that an initial newline and
360 /// an initial indent is added when `openElement` specifies
361 /// `BAEXML_NEWLINE_INDENT` option. If `value` is of type
362 /// `bsl::string`, it is truncated at any invalid UTF-8 byte-sequence or
363 /// any control character. The list of invalid control characters
364 /// includes characters in the range `[0x00, 0x20)` and `0x7F` (DEL) but
365 /// does not include `0x9`, `0xA`, and `0x0D`. The five special
366 /// characters: apostrophe, double quote, ampersand, less than, and
367 /// greater than are escaped in the output XML. If `value` is of type
368 /// `char`, it is cast to a signed byte value with a range of '[ -128 ..
369 /// 127 ]`. Optionally specify the `formattingMode' and
370 /// `encoderOptions` to specify the format used to encode `value`.
371 ///
372 /// \pre The behavior is undefined if the call is made when there are no opened
373 /// elements.
374 template <class VALUE_TYPE>
375 static bsl::ostream& addData(
376 bsl::ostream& stream,
377 State *state,
378 const VALUE_TYPE& value,
379 int formattingMode = 0,
380 const EncoderOptions& encoderOptions = EncoderOptions());
381
382 /// Add element of the specified `name` and the specified `value` as the
383 /// data content to the specified `stream`, with formatting depending on
384 /// the specified `state` and the optionally specified `encoderOptions`,
385 /// and update `state` accordingly. Return the `stream`. This has the
386 /// same effect as calling the following sequence: 'openElement(name);
387 /// addData(value), closeElement(name);'. Optionally specify the
388 /// `formattingMode`.
389 template <class TYPE>
390 static bsl::ostream& addElementAndData(
391 bsl::ostream& stream,
392 State *state,
393 const bsl::string_view& name,
394 const TYPE& value,
395 int formattingMode = 0,
396 const EncoderOptions& encoderOptions = EncoderOptions());
397
398 /// Add XML header with optionally specified `encoding` to the specified
399 /// `stream`, with formatting depending on the specified `state`, and
400 /// update `state` accordingly. Return the `stream`. Version is always "1.0".
401 ///
402 /// \pre The behavior is undefined unless `addHeader` is the first
403 /// manipulator (with the exception of `rawOutputStream`) after
404 /// construction or `reset`.
405 static bsl::ostream& addHeader(bsl::ostream& stream,
406 State *state,
407 const bsl::string_view& encoding);
408
409 /// Add the specified `value` as the data content to the specified
410 /// `stream`, with formatting depending on the specified `state`, and
411 /// update `state` accordingly. Return the `stream`. `value` can be of
412 /// the following types: `char`, `short`, `int`, `bsls::Types::Int64`,
413 /// `float`, `double`, `bsl::string`, `bdlt::Datetime`, `bdlt::Date`,
414 /// and `bdlt::Time`. Prefix the `value` with a space(`0x20`) unless
415 /// the data being added is the first data on a line. When adding the
416 /// data makes the line too long, perform line-wrapping and indentation
417 /// as determined by the whitespace constraint used when the current
418 /// element is opened with `openElement`. If `value` is of type
419 /// `bsl::string`, it is truncated at any invalid UTF-8 byte-sequence or
420 /// any control character. The list of invalid control characters
421 /// includes characters in the range `[0x00, 0x20)` and `0x7F` (DEL) but
422 /// does not include `0x9`, `0xA`, and `0x0D`. The five special
423 /// characters: apostrophe, double quote, ampersand, less than, and
424 /// greater than are escaped in the output XML. If `value` is of type
425 /// `char`, it is cast to a signed byte value with a range of '[ -128 ..
426 /// 127 ]`. Optionally specify the `formattingMode' and
427 /// `encoderOptions` to specify the format used to encode `value`.
428 ///
429 /// \pre The behavior is undefined if the call is made when there are no opened
430 /// elements.
431 template <class VALUE_TYPE>
432 static bsl::ostream& addListData(
433 bsl::ostream& stream,
434 State *state,
435 const VALUE_TYPE& value,
436 int formattingMode = 0,
437 const EncoderOptions& encoderOptions = EncoderOptions());
438
439 /// Insert a literal newline into the XML output of the specified
440 /// `stream`, with formatting depending on the specified `state`, and
441 /// update `state` accordingly. Return the `stream`. If following a
442 /// call to `openElement`, or `addAttribute`, add a closing `>` to the
443 /// opened tag.
444 static bsl::ostream& addNewline(bsl::ostream& stream, State *state);
445
446 /// Write the specified `comment` into the specified `stream`, with
447 /// formatting depending on the specified `state`, and update the
448 /// `state` accordingly. If the optionally specified `forceNewline` is
449 /// `true` then a new line is inserted for comments not already on a new
450 /// line. Also optionally specify an `omitEnclosingWhitespace` that
451 /// specifies if a space character should be omitted before and after
452 /// `comment`. If `omitEnclosingWhitespace` is not specified then a
453 /// space character is inserted before and after `comment`. Return 0 on success, and non-zero value otherwise.
454 ///
455 /// \note Note that a non-zero return
456 /// value is returned if either `comment` contains `--` or if
457 /// `omitEnclosingWhitespace` is `true` and `comment` ends with `-`.
458 /// Also note that if an element-opening tag is not completed with a
459 /// `>`, `addValidComment` will add `>`.
460 static int addValidComment(
461 bsl::ostream& stream,
462 State *state,
463 const bsl::string_view& comment,
464 bool forceNewline = true,
465 bool omitEnclosingWhitespace = false);
466
467 /// Decrement the indent level and add the closing tag for the element
468 /// of the specified `name` to the specified `stream`, with formatting
469 /// depending on the specified `state`, and update `state` accordingly.
470 /// Return the `stream`. If the element does not have content, write
471 /// `/>` and a newline into stream. Otherwise, write `</name>` and a
472 /// newline. If this `</name>` does not share the same line with data,
473 /// or it follows another element's closing tag, indent properly before
474 /// writing `</name>` and the newline. If `name` is root element, flush the output stream.
475 ///
476 /// \pre The behavior is undefined if `name` is not the
477 /// most recently opened element that's yet to be closed.
478 static bsl::ostream& closeElement(bsl::ostream& stream,
479 State *state,
480 const bsl::string_view& name);
481
482 /// Insert the closing `>` if there is an incomplete tag, and flush the
483 /// specified output `stream`, with formatting depending on the
484 /// specified `state`, and update `state` accordingly. Return the
485 /// `stream`.
486 static bsl::ostream& flush(bsl::ostream& stream, State *state);
487
488 /// Open an element of the specified `name` at current indent level with
489 /// the optionally specified whitespace constraint `whitespaceMode` for
490 /// its textual data to the specified `stream`, with formatting
491 /// depending on the specified `state`, and update `state` accordingly,
492 /// incrementing the indent level. Return the `stream`.
493 /// `whitespaceMode` constrains how textual data is written with
494 /// `addListData` for the current element, but not its nested elements.
495 ///
496 /// \pre The behavior is undefined if `openElement` is called after the root
497 /// element is closed and there is no subsequent call to `reset`.
498 static bsl::ostream&
499 openElement(bsl::ostream& stream,
500 State *state,
501 const bsl::string_view& name,
502 WhitespaceType::Enum whitespaceMode =
504
505 /// Reset the specified formatter `state` such that it can be used to
506 /// format a new XML document as if the formatter were just constructed.
507 static void reset(State *state);
508};
509
510// ============================================================================
511// INLINE DEFINITIONS
512// ============================================================================
513
514 // --------------------------------
515 // class Formatter_CompactImplState
516 // --------------------------------
517
518// CREATORS
519inline
521: d_id()
522, d_indentLevel()
523, d_initialIndentLevel()
524, d_spacesPerLevel()
525, d_column()
526{
527}
528
529inline
531 int spacesPerLevel)
532: d_id()
533, d_indentLevel(indentLevel)
534, d_initialIndentLevel(indentLevel)
535, d_spacesPerLevel(spacesPerLevel)
536, d_column()
537{
538}
539
540inline
542 Id::Enum id,
543 int indentLevel,
544 int initialIndentLevel,
545 int spacesPerLevel,
546 int column)
547: d_id(id)
548, d_indentLevel(indentLevel)
549, d_initialIndentLevel(initialIndentLevel)
550, d_spacesPerLevel(spacesPerLevel)
551, d_column(column)
552{
553}
554
555// MANIPULATORS
556inline
558{
559 return d_column;
560}
561
562inline
567
568inline
570{
571 return d_indentLevel;
572}
573
574inline
576{
577 return d_initialIndentLevel;
578}
579
580inline
582{
583 return d_spacesPerLevel;
584}
585
586// ACCESSORS
587inline
589{
590 return d_column;
591}
592
593inline
596{
597 return d_id;
598}
599
600inline
602{
603 return d_indentLevel;
604}
605
606inline
608{
609 return d_initialIndentLevel;
610}
611
612inline
614{
615 return d_spacesPerLevel;
616}
617
618 // --------------------------------
619 // struct Formatter_CompactImplUtil
620 // --------------------------------
621
622// CLASS METHODS
623template <class VALUE_TYPE>
625 bsl::ostream& stream,
626 State *state,
627 const bsl::string_view& name,
628 const VALUE_TYPE& value,
629 int formattingMode,
630 const EncoderOptions& encoderOptions)
631{
632
633 stream << ' ' << name << "=\"";
634 TypesPrintUtil::print(stream, value, formattingMode, &encoderOptions);
635 stream << '"';
636
637 // Minimum output if value is empty.
638 state->column() += static_cast<int>(name.length()) + 4;
639
640 return stream;
641}
642
643
644template <class VALUE_TYPE>
646 bsl::ostream& stream,
647 State *state,
648 const VALUE_TYPE& value,
649 int formattingMode,
650 const EncoderOptions& encoderOptions)
651{
652 // Step 1: Print a sequence of conditional tokens to 'stream' and update
653 // the column number and indentation level of 'state'.
654
655 if (StateId::e_IN_TAG == state->id()) {
656 stream << '>';
657 state->column() += 1;
658 }
659
660 TypesPrintUtil::print(stream, value, formattingMode, &encoderOptions);
661 state->column() += 1;
662
663 // Step 2: Update the ID of 'state'.
664
666
667 return stream;
668}
669
670template <class TYPE>
672 bsl::ostream& stream,
673 State *state,
674 const bsl::string_view& name,
675 const TYPE& value,
676 int formattingMode,
677 const EncoderOptions& encoderOptions)
678{
680 addData(stream, state, value, formattingMode, encoderOptions);
681 closeElement(stream, state, name);
682
683 return stream;
684}
685
686template <class VALUE_TYPE>
688 bsl::ostream& stream,
689 State *state,
690 const VALUE_TYPE& value,
691 int formattingMode,
692 const EncoderOptions& encoderOptions)
693{
694 // Step 1: Print a sequence of conditional tokens to 'stream' and update
695 // the column number and indentation level of 'state'.
696
697 if (StateId::e_IN_TAG == state->id()) {
698 stream << '>';
699 state->column() += 1;
700 }
701
702 if (StateId::e_FIRST_DATA_BETWEEN_TAGS != state->id() &&
703 StateId::e_IN_TAG != state->id()) {
704 stream << ' ';
705 state->column() += 1;
706 }
707
708 TypesPrintUtil::print(stream, value, formattingMode, &encoderOptions);
709 state->column() += 1; // assume value is not empty
710
711 // Step 2: Update the ID of 'state'.
712
714
715 return stream;
716}
717
718inline
720{
721 state->column() = 0;
722 state->id() = StateId::e_AT_START;
723 state->indentLevel() = state->initialIndentLevel();
724}
725
726} // close package namespace
727
728
729#endif // INCLUDED_BALXML_FORMATTER_COMPACTIMPL
730
731// ----------------------------------------------------------------------------
732// Copyright 2021 Bloomberg Finance L.P.
733//
734// Licensed under the Apache License, Version 2.0 (the "License");
735// you may not use this file except in compliance with the License.
736// You may obtain a copy of the License at
737//
738// http://www.apache.org/licenses/LICENSE-2.0
739//
740// Unless required by applicable law or agreed to in writing, software
741// distributed under the License is distributed on an "AS IS" BASIS,
742// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
743// See the License for the specific language governing permissions and
744// limitations under the License.
745// ----------------------------- END-OF-FILE ----------------------------------
746
747/** @} */
748/** @} */
749/** @} */
Definition balxml_encoderoptions.h:89
Definition balxml_formatter_compactimpl.h:164
int & indentLevel()
Definition balxml_formatter_compactimpl.h:569
int & initialIndentLevel()
Definition balxml_formatter_compactimpl.h:575
int & column()
Definition balxml_formatter_compactimpl.h:557
int & spacesPerLevel()
Definition balxml_formatter_compactimpl.h:581
Id::Enum & id()
Definition balxml_formatter_compactimpl.h:563
Formatter_CompactImplState()
Definition balxml_formatter_compactimpl.h:520
Formatter_CompactImplStateId Id
Definition balxml_formatter_compactimpl.h:168
Definition bslstl_stringview.h:471
BSLS_KEYWORD_CONSTEXPR size_type length() const BSLS_KEYWORD_NOEXCEPT
Return the length of this view.
Definition bslstl_stringview.h:1913
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition balxml_base64parser.h:150
Definition balxml_formatterwhitespacetype.h:70
Enum
Definition balxml_formatterwhitespacetype.h:73
@ e_PRESERVE_WHITESPACE
Definition balxml_formatterwhitespacetype.h:74
Definition balxml_formatter_compactimpl.h:83
Enum
Definition balxml_formatter_compactimpl.h:86
@ e_TRAILING_DATA_BETWEEN_TAGS
Definition balxml_formatter_compactimpl.h:150
@ e_IN_TAG
Definition balxml_formatter_compactimpl.h:111
@ e_AT_START
Definition balxml_formatter_compactimpl.h:90
@ e_FIRST_DATA_BETWEEN_TAGS
Definition balxml_formatter_compactimpl.h:134
Definition balxml_formatter_compactimpl.h:273
static bsl::ostream & addElementAndData(bsl::ostream &stream, State *state, const bsl::string_view &name, const TYPE &value, int formattingMode=0, const EncoderOptions &encoderOptions=EncoderOptions())
Definition balxml_formatter_compactimpl.h:671
Formatter_CompactImplStateId StateId
Definition balxml_formatter_compactimpl.h:277
static bsl::ostream & addComment(bsl::ostream &stream, State *state, const bsl::string_view &comment, bool forceNewline=true)
static bsl::ostream & addAttribute(bsl::ostream &stream, State *state, const bsl::string_view &name, const VALUE_TYPE &value, int valueFormattingMode=0, const EncoderOptions &encoderOptions=EncoderOptions())
Definition balxml_formatter_compactimpl.h:624
static bsl::ostream & addListData(bsl::ostream &stream, State *state, const VALUE_TYPE &value, int formattingMode=0, const EncoderOptions &encoderOptions=EncoderOptions())
Definition balxml_formatter_compactimpl.h:687
static bsl::ostream & addNewline(bsl::ostream &stream, State *state)
static int addValidComment(bsl::ostream &stream, State *state, const bsl::string_view &comment, bool forceNewline=true, bool omitEnclosingWhitespace=false)
static bsl::ostream & openElement(bsl::ostream &stream, State *state, const bsl::string_view &name, WhitespaceType::Enum whitespaceMode=WhitespaceType::e_PRESERVE_WHITESPACE)
static bsl::ostream & flush(bsl::ostream &stream, State *state)
static bsl::ostream & addHeader(bsl::ostream &stream, State *state, const bsl::string_view &encoding)
Formatter_CompactImplState State
Definition balxml_formatter_compactimpl.h:276
static bsl::ostream & closeElement(bsl::ostream &stream, State *state, const bsl::string_view &name)
FormatterWhitespaceType WhitespaceType
Definition balxml_formatter_compactimpl.h:278
static bsl::ostream & addData(bsl::ostream &stream, State *state, const VALUE_TYPE &value, int formattingMode=0, const EncoderOptions &encoderOptions=EncoderOptions())
Definition balxml_formatter_compactimpl.h:645
static bsl::ostream & addBlankLine(bsl::ostream &stream, State *state)
static void reset(State *state)
Definition balxml_formatter_compactimpl.h:719
static bsl::ostream & print(bsl::ostream &stream, const TYPE &object, int formattingMode, const EncoderOptions *encoderOptions=0)
Definition balxml_typesprintutil.h:1166