#include <balxml_encoder.h>
This class
contains the parameterized encode
functions that encode bdlat
types in XML format.
See balxml_encoder
◆ Encoder() [1/2]
◆ Encoder() [2/2]
balxml::Encoder::Encoder |
( |
const EncoderOptions * |
options, |
|
|
bsl::ostream * |
errorStream = 0 , |
|
|
bsl::ostream * |
warningStream = 0 , |
|
|
bslma::Allocator * |
basicAllocator = 0 |
|
) |
| |
Construct a encoder object using the specified options
. Errors and warnings will be rendered to the optionally specified errorStream
and warningStream
respectively.
◆ ~Encoder()
balxml::Encoder::~Encoder |
( |
| ) |
|
Destroy this object. This destruction has no effect on objects pointed-to by the pointers provided at construction.
◆ BSLMF_NESTED_TRAIT_DECLARATION()
◆ encode() [1/3]
template<class TYPE >
bsl::ostream & balxml::Encoder::encode |
( |
bsl::ostream & |
stream, |
|
|
const TYPE & |
object |
|
) |
| |
|
inline |
Encode the specified non-modifiable object
to the specified stream
. Return a reference to stream
. If an encoding error is detected, stream.fail()
will be true on return. Note that the encoder will use encoder options, error and warning streams specified at the construction time. IMPORTANT: The use of stream.fail()
to communicate errors to the caller has two consequences: 1) if stream
is the same as the errorStream
passed to the constructor, then the error message may be suppressed (because of the output/error stream becoming invalidated) and 2) it is important to call stream.clear()
after testing the stream state. To avoid these issues, we recommend that you use use encodeToStream
, above, instead of this version of encode
.
◆ encode() [2/3]
template<class TYPE >
int balxml::Encoder::encode |
( |
bsl::streambuf * |
buffer, |
|
|
const TYPE & |
object |
|
) |
| |
|
inline |
Encode the specified non-modifiable object
to the specified buffer
. Return 0 on success, and a non-zero value otherwise. Note that the encoder will use encoder options, error and warning streams specified at the construction time.
◆ encode() [3/3]
template<class TYPE >
int balxml::Encoder::encode |
( |
Formatter & |
formatter, |
|
|
const TYPE & |
object |
|
) |
| |
Encode the specified non-modifiable object
to the specified formatter
. Return 0 on success, and a non-zero value otherwise. Note that encoder will use encoder options, error and warning streams specified at the construction time.
◆ encodeToStream()
template<class TYPE >
int balxml::Encoder::encodeToStream |
( |
bsl::ostream & |
stream, |
|
|
const TYPE & |
object |
|
) |
| |
|
inline |
Encode the specified non-modifiable object
to the specified stream
. Return 0 on success, and a non-zero value otherwise. Note that the encoder will use encoder options, error and warning streams specified at the construction time.
◆ errorSeverity()
Return the severity of the most severe warning or error encountered during the last call to the encode
method. The severity is reset each time encode
is called.
◆ errorStream()
bsl::ostream * balxml::Encoder::errorStream |
( |
| ) |
const |
|
inline |
◆ isCompact()
bool balxml::Encoder::isCompact |
( |
| ) |
const |
|
inline |
◆ loggedMessages()
Return a string containing any error, warning, or trace messages that were logged during the last call to the encode
method. The log is reset each time encode
is called.
◆ options()
◆ warningStream()
bsl::ostream * balxml::Encoder::warningStream |
( |
| ) |
const |
|
inline |
◆ Encoder_Context
The documentation for this class was generated from the following file: