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