BDE 4.39.x Production Release
Loading...
Searching...
No Matches
balber::BerDecoder Class Reference

#include <balber_berdecoder.h>

Detailed Description

This class contains the parameterized decode functions that decode data (in BER format) from an incoming stream into bdlat types.

See balber_berdecoder

Public Types

enum  ErrorSeverity { e_BER_SUCCESS = 0x00 , e_BER_ERROR = 0x02 , BDEM_BER_SUCCESS = e_BER_SUCCESS , BDEM_BER_ERROR = e_BER_ERROR }
 

Public Member Functions

 BerDecoder (const BerDecoderOptions *options=0, bslma::Allocator *basicAllocator=0)
 
 ~BerDecoder ()
 
template<typename TYPE >
int decode (bsl::streambuf *streamBuf, TYPE *variable)
 
template<typename TYPE >
int decode (bsl::istream &stream, TYPE *variable)
 
template<typename TYPE >
int decodeAny (bsl::streambuf *streamBuf, TYPE *variable)
 
int decodeAny (bsl::streambuf *streamBuf, bdlar::AnyRef *variable)
 
template<typename TYPE >
int decodeAny (bsl::istream &stream, TYPE *variable)
 
int decodeAny (bsl::istream &stream, bdlar::AnyRef *variable)
 
void setNumUnknownElementsSkipped (int value)
 
const BerDecoderOptionsdecoderOptions () const
 
bool maxDepthExceeded () const
 
int numUnknownElementsSkipped () const
 
ErrorSeverity errorSeverity () const
 
bslstl::StringRef loggedMessages () const
 

Friends

class BerDecoder_Node
 

Member Enumeration Documentation

◆ ErrorSeverity

Enumerator
e_BER_SUCCESS 
e_BER_ERROR 
BDEM_BER_SUCCESS 
BDEM_BER_ERROR 

Constructor & Destructor Documentation

◆ BerDecoder()

balber::BerDecoder::BerDecoder ( const BerDecoderOptions options = 0,
bslma::Allocator basicAllocator = 0 
)

Construct a decoder object. Optionally specify decoder options. If options is 0, BerDecoderOptions() is used. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ ~BerDecoder()

balber::BerDecoder::~BerDecoder ( )

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

Member Function Documentation

◆ decode() [1/2]

template<typename TYPE >
int balber::BerDecoder::decode ( bsl::istream &  stream,
TYPE *  variable 
)
inline

Decode an object of parameterized TYPE from the specified stream and load the result into the specified modifiable variable. Return 0 on success, and a non-zero value otherwise. If the decoding fails stream will be invalidated.

◆ decode() [2/2]

template<typename TYPE >
int balber::BerDecoder::decode ( bsl::streambuf *  streamBuf,
TYPE *  variable 
)

Decode an object of parameterized TYPE from the specified streamBuf and load the result into the specified variable. Return 0 on success, and a non-zero value otherwise.

◆ decodeAny() [1/4]

int balber::BerDecoder::decodeAny ( bsl::istream &  stream,
bdlar::AnyRef variable 
)

◆ decodeAny() [2/4]

template<typename TYPE >
int balber::BerDecoder::decodeAny ( bsl::istream &  stream,
TYPE *  variable 
)
inline

Decode an object of parameterized TYPE from the specified stream and load the result into the specified modifiable variable. Return 0 on success, and a non-zero value otherwise. If the decoding fails stream will be invalidated.

Note
Note that this function behaves identically to decode, but does not instantiate any templates at compile time at the expense of being slightly slower at runtime; see the balber package documentation for more details.

◆ decodeAny() [3/4]

int balber::BerDecoder::decodeAny ( bsl::streambuf *  streamBuf,
bdlar::AnyRef variable 
)

◆ decodeAny() [4/4]

template<typename TYPE >
int balber::BerDecoder::decodeAny ( bsl::streambuf *  streamBuf,
TYPE *  variable 
)
inline

Decode an object of parameterized TYPE from the specified streamBuf and load the result into the specified variable. Return 0 on success, and a non-zero value otherwise.

Note
Note that this function behaves identically to decode, but does not instantiate any templates at compile time at the expense of being slightly slower at runtime; see the balber package documentation for more details.

◆ decoderOptions()

const BerDecoderOptions * balber::BerDecoder::decoderOptions ( ) const
inline

Return the address of the BER decoder options.

◆ errorSeverity()

BerDecoder::ErrorSeverity balber::BerDecoder::errorSeverity ( ) const
inline

Return the severity of the most severe log or error message encountered during the last call to the decode method. The severity is reset each time decode is called.

◆ loggedMessages()

bslstl::StringRef balber::BerDecoder::loggedMessages ( ) const
inline

Return a string containing any error or trace messages that were logged during the last call to the decode method. The log is reset each time decode is called.

◆ maxDepthExceeded()

bool balber::BerDecoder::maxDepthExceeded ( ) const
inline

Return 'true' if the maximum depth level is exceeded and 'false' otherwise.

◆ numUnknownElementsSkipped()

int balber::BerDecoder::numUnknownElementsSkipped ( ) const
inline

Return the number of unknown elements that were skipped during the previous decoding operation.

Note
Note that unknown elements are skipped only if true == options()->skipUnknownElements().

◆ setNumUnknownElementsSkipped()

void balber::BerDecoder::setNumUnknownElementsSkipped ( int  value)
inline

Set the number of unknown elements skipped by the decoder during the current decoding operation to the specified value.

Precondition
The behavior is undefined unless 0 <= value.

Friends And Related Symbol Documentation

◆ BerDecoder_Node

friend class BerDecoder_Node
friend

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