#include <balxml_decoder.h>
|
| Decoder (const DecoderOptions *options, Reader *reader, ErrorInfo *errInfo, bslma::Allocator *basicAllocator) |
|
| Decoder (const DecoderOptions *options, Reader *reader, ErrorInfo *errInfo=0, bsl::ostream *errorStream=0, bsl::ostream *warningStream=0, bslma::Allocator *basicAllocator=0) |
|
| ~Decoder () |
| Call close and destroy this object.
|
|
void | close () |
|
int | open (bsl::istream &stream, const char *uri=0) |
|
int | open (bsl::streambuf *buffer, const char *uri=0) |
|
int | open (const char *buffer, bsl::size_t length, const char *uri=0) |
|
int | open (const char *filename) |
|
template<class TYPE > |
bsl::istream & | decode (bsl::istream &stream, TYPE *object, const char *uri=0) |
|
template<class TYPE > |
int | decode (bsl::streambuf *buffer, TYPE *object, const char *uri=0) |
|
template<class TYPE > |
int | decode (const char *buffer, bsl::size_t length, TYPE *object, const char *uri=0) |
|
template<class TYPE > |
int | decode (const char *filename, TYPE *object) |
|
template<class TYPE > |
int | decode (TYPE *object) |
|
void | setNumUnknownElementsSkipped (int value) |
|
const DecoderOptions * | options () const |
|
Reader * | reader () const |
|
ErrorInfo * | errorInfo () const |
|
bsl::ostream * | errorStream () const |
| Return pointer to the error stream.
|
|
bsl::ostream * | warningStream () const |
| Return pointer to the warning stream.
|
|
int | numUnknownElementsSkipped () const |
|
ErrorInfo::Severity | errorSeverity () const |
|
bslstl::StringRef | loggedMessages () const |
|
int | errorCount () const |
|
int | warningCount () const |
|
Engine for decoding value-semantic objects in XML format. The decode
methods are function templates that will decode any object that meets the requirements of a sequence or choice object as defined in the bdlat_sequencefunctions and bdlat_choicefunctions components. These generic frameworks provide a common compile-time interface for manipulating struct-like and union-like objects.
See balxml_decoder
◆ Decoder() [1/2]
◆ Decoder() [2/2]
Construct a decoder object using the specified options
and the specified reader
to perform the XML-level parsing. If the (optionally) specified errorInfo
is non-null, it is used to store information about most serious error encountered during parsing. During parsing, error and warning messages will be written to the (optionally) specified errorStream
and warningStream
respectively. The behavior is undefined unless options
and reader
are both non-zero. The behavior becomes undefined if the objects pointed to by any of the arguments is destroyed before this object has completed parsing.
◆ ~Decoder()
balxml::Decoder::~Decoder |
( |
| ) |
|
◆ close()
void balxml::Decoder::close |
( |
| ) |
|
Put the associated Reader
object (i.e., the reader
specified at construction) into a closed state.
◆ decode() [1/5]
template<class TYPE >
bsl::istream & balxml::Decoder::decode |
( |
bsl::istream & |
stream, |
|
|
TYPE * |
object, |
|
|
const char * |
uri = 0 |
|
) |
| |
Decode the specified object
of parameterized TYPE
from the specified input stream
. Return a reference to the modifiable stream
. If a decoding error is detected, stream.fail()
will be true
after this method returns. The (optionally) specified uri
is used for identifying the input document in error messages. A compilation error will result unless TYPE
conforms to the requirements of a bdlat
sequence or choice, as described in bdlat_sequencefunctions and bdlat_choicefunctions .
◆ decode() [2/5]
template<class TYPE >
int balxml::Decoder::decode |
( |
bsl::streambuf * |
buffer, |
|
|
TYPE * |
object, |
|
|
const char * |
uri = 0 |
|
) |
| |
Decode the specified object
of parameterized TYPE
from the specified stream buffer
. The (optionally) specified uri
is used for identifying the input document in error messages. Return 0 on success, and a non-zero value otherwise. A compilation error will result unless TYPE
conforms to the requirements of a bdlat sequence or choice, as described in bdlat_sequencefunctions and bdlat_choicefunctions .
◆ decode() [3/5]
template<class TYPE >
int balxml::Decoder::decode |
( |
const char * |
buffer, |
|
|
bsl::size_t |
length, |
|
|
TYPE * |
object, |
|
|
const char * |
uri = 0 |
|
) |
| |
Decode the specified object
of parameterized TYPE
from the memory at the specified buffer
address, having the specified length
. The (optionally) specified uri
is used for identifying the input document in error messages. Return 0 on success, and a non-zero value otherwise. A compilation error will result unless TYPE
conforms to the requirements of a bdlat sequence or choice, as described in bdlat_sequencefunctions and bdlat_choicefunctions .
◆ decode() [4/5]
template<class TYPE >
int balxml::Decoder::decode |
( |
const char * |
filename, |
|
|
TYPE * |
object |
|
) |
| |
Decode the specified object
of parameterized TYPE
from the file with the specified filename
. Return 0 on success, and a non-zero value otherwise. A compilation error will result unless TYPE
conforms to the requirements of a bdlat sequence or choice, as described in bdlat_sequencefunctions and bdlat_choicefunctions .
◆ decode() [5/5]
template<class TYPE >
int balxml::Decoder::decode |
( |
TYPE * |
object | ) |
|
|
inline |
Decode the specified object
of parameterized TYPE
from the input source specified by a previous call to open
and leave the reader in an open state. Return 0 on success, and a non-zero value otherwise. A compilation error will result unless TYPE
conforms to the requirements of a bdlat sequence or choice, as described in bdlat_sequencefunctions and bdlat_choicefunctions . The behavior is undefined unless this call was preceded by a prior successful call to open
◆ errorCount()
int balxml::Decoder::errorCount |
( |
| ) |
const |
|
inline |
Return the number of errors that occurred during decoding. This number is reset to zero on a call to open
.
◆ errorInfo()
ErrorInfo * balxml::Decoder::errorInfo |
( |
| ) |
const |
|
inline |
Return a pointer to the modifiable error-reporting structure associated with this decoder (i.e., the errInfo
pointer provided at construction). The value stored in the error structure is reset to indicate no error on a successful call to open
.
◆ errorSeverity()
Return the severity of the most severe warning or error encountered during the last call to the decode
method. The severity is reset each time decode
is called.
◆ errorStream()
bsl::ostream * balxml::Decoder::errorStream |
( |
| ) |
const |
|
inline |
◆ loggedMessages()
Return a string containing any error, warning, or trace messages that were logged during the last call to the decode
method. The log is reset each time decode
is called.
◆ numUnknownElementsSkipped()
int balxml::Decoder::numUnknownElementsSkipped |
( |
| ) |
const |
|
inline |
Return the number of unknown elements that were skipped during the previous decoding operation. Note that unknown elements are skipped only if true == options()->skipUnknownElements()
.
◆ open() [1/4]
int balxml::Decoder::open |
( |
bsl::istream & |
stream, |
|
|
const char * |
uri = 0 |
|
) |
| |
|
inline |
Open the associated Reader
object (see Reader::open
) to read XML data from the specified stream
. The (optionally) specified uri
is used for identifying the input document in error messages. Return 0 on success and non-zero otherwise.
◆ open() [2/4]
int balxml::Decoder::open |
( |
bsl::streambuf * |
buffer, |
|
|
const char * |
uri = 0 |
|
) |
| |
Open the associated Reader
object (see Reader::open
) to read XML data from the specified stream buffer
. The (optionally) specified uri
is used for identifying the input document in error messages. Return 0 on success and non-zero otherwise.
◆ open() [3/4]
int balxml::Decoder::open |
( |
const char * |
buffer, |
|
|
bsl::size_t |
length, |
|
|
const char * |
uri = 0 |
|
) |
| |
Open the associated Reader
object (see Reader::open
) to read XML data from memory at the specified buffer
, with the specified length
. The (optionally) specified uri
is used for identifying the input document in error messages. Return 0 on success and non-zero otherwise.
◆ open() [4/4]
int balxml::Decoder::open |
( |
const char * |
filename | ) |
|
Open the associated Reader
object (see Reader::open
) to read XML data from the file with the specified filename
. Return 0 on success and non-zero otherwise.
◆ options()
Return a pointer to the non-modifiable decoder options provided at construction.
◆ reader()
Reader * balxml::Decoder::reader |
( |
| ) |
const |
|
inline |
Return the a pointer to the modifiable reader associated with this decoder (i.e., the reader
pointer provided at construction).
◆ setNumUnknownElementsSkipped()
void balxml::Decoder::setNumUnknownElementsSkipped |
( |
int |
value | ) |
|
|
inline |
Set the number of unknown elements skipped by the decoder during the current decoding operation to the specified value
. The behavior is undefined unless 0 <= value
.
◆ warningCount()
int balxml::Decoder::warningCount |
( |
| ) |
const |
|
inline |
Return the number of warnings that occurred during decoding. This number is reset to zero on a call to open
.
◆ warningStream()
bsl::ostream * balxml::Decoder::warningStream |
( |
| ) |
const |
|
inline |
◆ Decoder_decodeImpProxy
◆ Decoder_ElementContext
◆ Decoder_ErrorLogger
The documentation for this class was generated from the following file: