Quick Links:

bal | bbl | bdl | bsl

Classes | Public Member Functions | Friends

balxml::Encoder Class Reference

#include <balxml_encoder.h>

List of all members.

Classes

class  MemOutStream

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (Encoder, bslma::UsesBslmaAllocator)
 Encoder (const EncoderOptions *options, bslma::Allocator *basicAllocator)
 Encoder (const EncoderOptions *options, bsl::ostream *errorStream=0, bsl::ostream *warningStream=0, bslma::Allocator *basicAllocator=0)
 ~Encoder ()
template<class TYPE >
int encode (bsl::streambuf *buffer, const TYPE &object)
template<class TYPE >
int encodeToStream (bsl::ostream &stream, const TYPE &object)
template<class TYPE >
bsl::ostream & encode (bsl::ostream &stream, const TYPE &object)
template<class TYPE >
int encode (Formatter &formatter, const TYPE &object)
const EncoderOptionsoptions () const
bool isCompact () const
bsl::ostream * errorStream () const
bsl::ostream * warningStream () const
ErrorInfo::Severity errorSeverity () const
bslstl::StringRef loggedMessages () const

Friends

class Encoder_Context

Detailed Description

This class contains the parameterized encode functions that encode bdlat types in XML format.

See Component balxml_encoder


Constructor & Destructor Documentation

balxml::Encoder::Encoder ( const EncoderOptions options,
bslma::Allocator basicAllocator 
)
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.

balxml::Encoder::~Encoder (  ) 

Destroy this object. This destruction has no effect on objects pointed-to by the pointers provided at construction.


Member Function Documentation

balxml::Encoder::BSLMF_NESTED_TRAIT_DECLARATION ( Encoder  ,
bslma::UsesBslmaAllocator   
)
template<class TYPE >
int balxml::Encoder::encode ( bsl::streambuf *  buffer,
const TYPE &  object 
)

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.

template<class TYPE >
int balxml::Encoder::encodeToStream ( bsl::ostream &  stream,
const TYPE &  object 
)

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.

template<class TYPE >
bsl::ostream& balxml::Encoder::encode ( bsl::ostream &  stream,
const TYPE &  object 
)

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.

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.

const EncoderOptions* balxml::Encoder::options (  )  const

Return the encoder options.

bool balxml::Encoder::isCompact (  )  const

Return true if the encoding style in the encoder options is defined as EncodingStyle::BAEXML_COMPACT, and false otherwise.

bsl::ostream* balxml::Encoder::errorStream (  )  const

Return pointer to the error stream.

bsl::ostream* balxml::Encoder::warningStream (  )  const

Return pointer to the warning stream.

ErrorInfo::Severity balxml::Encoder::errorSeverity (  )  const

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.

bslstl::StringRef balxml::Encoder::loggedMessages (  )  const

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.


Friends And Related Function Documentation

friend class Encoder_Context [friend]

The documentation for this class was generated from the following file: