BDE 4.14.0 Production release
|
#include <bslx_testinstream.h>
Public Member Functions | |
TestInStream () | |
TestInStream (const char *buffer, bsl::size_t numBytes) | |
TestInStream (const bslstl::StringRef &srcData) | |
Create a test input stream containing the specified srcData . | |
~TestInStream () | |
Destroy this test input stream. | |
TestInStream & | getLength (int &variable) |
TestInStream & | getVersion (int &variable) |
void | invalidate () |
void | reset () |
void | reset (const char *buffer, bsl::size_t numBytes) |
void | reset (const bslstl::StringRef &srcData) |
void | seek (bsl::size_t offset) |
void | setInputLimit (int limit) |
void | setQuiet (bool flagValue) |
TestInStream & | getInt64 (bsls::Types::Int64 &variable) |
TestInStream & | getUint64 (bsls::Types::Uint64 &variable) |
TestInStream & | getInt56 (bsls::Types::Int64 &variable) |
TestInStream & | getUint56 (bsls::Types::Uint64 &variable) |
TestInStream & | getInt48 (bsls::Types::Int64 &variable) |
TestInStream & | getUint48 (bsls::Types::Uint64 &variable) |
TestInStream & | getInt40 (bsls::Types::Int64 &variable) |
TestInStream & | getUint40 (bsls::Types::Uint64 &variable) |
TestInStream & | getInt32 (int &variable) |
TestInStream & | getUint32 (unsigned int &variable) |
TestInStream & | getInt24 (int &variable) |
TestInStream & | getUint24 (unsigned int &variable) |
TestInStream & | getInt16 (short &variable) |
TestInStream & | getUint16 (unsigned short &variable) |
TestInStream & | getInt8 (char &variable) |
TestInStream & | getInt8 (signed char &variable) |
TestInStream & | getUint8 (char &variable) |
TestInStream & | getUint8 (unsigned char &variable) |
TestInStream & | getFloat64 (double &variable) |
TestInStream & | getFloat32 (float &variable) |
TestInStream & | getString (bsl::string &variable) |
TestInStream & | getArrayInt64 (bsls::Types::Int64 *variables, int numVariables) |
TestInStream & | getArrayUint64 (bsls::Types::Uint64 *variables, int numVariables) |
TestInStream & | getArrayInt56 (bsls::Types::Int64 *variables, int numVariables) |
TestInStream & | getArrayUint56 (bsls::Types::Uint64 *variables, int numVariables) |
TestInStream & | getArrayInt48 (bsls::Types::Int64 *variables, int numVariables) |
TestInStream & | getArrayUint48 (bsls::Types::Uint64 *variables, int numVariables) |
TestInStream & | getArrayInt40 (bsls::Types::Int64 *variables, int numVariables) |
TestInStream & | getArrayUint40 (bsls::Types::Uint64 *variables, int numVariables) |
TestInStream & | getArrayInt32 (int *variables, int numVariables) |
TestInStream & | getArrayUint32 (unsigned int *variables, int numVariables) |
TestInStream & | getArrayInt24 (int *variables, int numVariables) |
TestInStream & | getArrayUint24 (unsigned int *variables, int numVariables) |
TestInStream & | getArrayInt16 (short *variables, int numVariables) |
TestInStream & | getArrayUint16 (unsigned short *variables, int numVariables) |
TestInStream & | getArrayInt8 (char *variables, int numVariables) |
TestInStream & | getArrayInt8 (signed char *variables, int numVariables) |
TestInStream & | getArrayUint8 (char *variables, int numVariables) |
TestInStream & | getArrayUint8 (unsigned char *variables, int numVariables) |
TestInStream & | getArrayFloat64 (double *variables, int numVariables) |
TestInStream & | getArrayFloat32 (float *variables, int numVariables) |
operator const void * () const | |
bsl::size_t | cursor () const |
Return the index of the next byte to be extracted from this stream. | |
const char * | data () const |
int | inputLimit () const |
bool | isEmpty () const |
bool | isQuiet () const |
bool | isValid () const |
bsl::size_t | length () const |
Friends | |
bsl::ostream & | operator<< (bsl::ostream &, const TestInStream &) |
This class provides input methods to unexternalize values, and C-style arrays of values, of fundamental types from their byte representations. Each input method also verifies the input value type. By default, if invalid data is detected, error messages are displayed on stdout
; this error reporting may be disabled via the setQuiet
method. Note that attempting to read beyond the end of a stream will automatically invalidate the stream. See the bslx
package-level documentation for the definition of the BDEX InStream
protocol.
|
explicit |
Create an empty test input stream. Note that the constructed object is useless until a buffer is set with the reset
method.
bslx::TestInStream::TestInStream | ( | const char * | buffer, |
bsl::size_t | numBytes | ||
) |
Create a test input stream containing the specified initial numBytes
from the specified buffer
. The behavior is undefined unless 0 == numBytes
if 0 == buffer
.
|
explicit |
bslx::TestInStream::~TestInStream | ( | ) |
|
inline |
|
inline |
TestInStream & bslx::TestInStream::getArrayFloat32 | ( | float * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that IEEE single-precision (4-byte) floating-point array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity. Note that for non-conforming platforms, this operation may be lossy.
TestInStream & bslx::TestInStream::getArrayFloat64 | ( | double * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that IEEE double-precision (8-byte) floating-point array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity. Note that for non-conforming platforms, this operation may be lossy.
TestInStream & bslx::TestInStream::getArrayInt16 | ( | short * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 16-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt24 | ( | int * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 24-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt32 | ( | int * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 32-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt40 | ( | bsls::Types::Int64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 40-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt48 | ( | bsls::Types::Int64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 48-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt56 | ( | bsls::Types::Int64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 56-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt64 | ( | bsls::Types::Int64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 64-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt8 | ( | char * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 8-bit signed integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayInt8 | ( | signed char * | variables, |
int | numVariables | ||
) |
TestInStream & bslx::TestInStream::getArrayUint16 | ( | unsigned short * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 16-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint24 | ( | unsigned int * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 24-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint32 | ( | unsigned int * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 32-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint40 | ( | bsls::Types::Uint64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 40-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint48 | ( | bsls::Types::Uint64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 48-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint56 | ( | bsls::Types::Uint64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 56-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint64 | ( | bsls::Types::Uint64 * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 64-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint8 | ( | char * | variables, |
int | numVariables | ||
) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 8-bit unsigned integer array value into the specified variables
of the specified numVariables
if its type and length are appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variables
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables
is undefined. The behavior is undefined unless 0 <= numVariables
and variables
has sufficient capacity.
TestInStream & bslx::TestInStream::getArrayUint8 | ( | unsigned char * | variables, |
int | numVariables | ||
) |
TestInStream & bslx::TestInStream::getFloat32 | ( | float & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that IEEE single-precision (4-byte) floating-point value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined. Note that for non-conforming platforms, this operation may be lossy.
TestInStream & bslx::TestInStream::getFloat64 | ( | double & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that IEEE double-precision (8-byte) floating-point value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined. Note that for non-conforming platforms, this operation may be lossy.
TestInStream & bslx::TestInStream::getInt16 | ( | short & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 16-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt24 | ( | int & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 24-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt32 | ( | int & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 32-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt40 | ( | bsls::Types::Int64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 40-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt48 | ( | bsls::Types::Int64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 48-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt56 | ( | bsls::Types::Int64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 56-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt64 | ( | bsls::Types::Int64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 64-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt8 | ( | char & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 8-bit signed integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getInt8 | ( | signed char & | variable | ) |
TestInStream & bslx::TestInStream::getLength | ( | int & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 8-bit unsigned integer or 32-bit signed integer value representing a length (see the bslx
package-level documentation) into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. Consume an 8-bit unsigned integer if the most significant bit of this byte is 0, otherwise consume a 32-bit signed integer and set the most significant bit to zero in the resultant variable
. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getString | ( | bsl::string & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume a string from this input stream, assign that value to the specified variable
, update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined. The string must be prefaced by a non-negative integer indicating the number of characters composing the string. The behavior is undefined unless the length indicator is non-negative.
TestInStream & bslx::TestInStream::getUint16 | ( | unsigned short & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 16-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint24 | ( | unsigned int & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 24-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint32 | ( | unsigned int & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 32-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint40 | ( | bsls::Types::Uint64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 40-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint48 | ( | bsls::Types::Uint64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 48-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint56 | ( | bsls::Types::Uint64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 56-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint64 | ( | bsls::Types::Uint64 & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 64-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint8 | ( | char & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 8-bit unsigned integer value into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
TestInStream & bslx::TestInStream::getUint8 | ( | unsigned char & | variable | ) |
TestInStream & bslx::TestInStream::getVersion | ( | int & | variable | ) |
If required, throw a TestInStreamException
(see throwExceptionIfInputLimitExhausted
); otherwise, consume the 8-bit unsigned integer type code, verify the type of the next value in this stream, consume that 8-bit unsigned integer value representing a version (see the bslx
package-level documentation) into the specified variable
if its type is appropriate, update the cursor location, and return a reference to this stream. If the type is incorrect, then this stream is marked invalid and the value of variable
is unchanged. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable
is undefined.
|
inline |
Return the current number of input requests left before an exception is thrown. A negative value indicates that no exception is scheduled.
|
inline |
Put this input stream in an invalid state. This function has no effect if this stream is already invalid. Note that this function should be called whenever a value extracted from this stream is determined to be invalid, inconsistent, or otherwise incorrect.
|
inline |
Return true
if this stream is empty, and false
otherwise. Note that this function enables higher-level types to verify that, after successfully reading all expected data, no data remains.
|
inline |
Return true
if this stream's quiet mode is ON, and false
otherwise.
|
inline |
Return true
if this stream is valid, and false
otherwise. An invalid stream is a stream in which insufficient or invalid data was detected during an extraction operation. Note that an empty stream will be valid unless an extraction attempt or explicit invalidation causes it to be otherwise.
|
inline |
Return the total number of bytes stored in the external memory buffer.
|
inline |
Return a non-zero value if this stream is valid, and 0 otherwise. An invalid stream is a stream for which an input operation was detected to have failed.
|
inline |
Set the index of the next byte to be extracted from this stream to 0 (i.e., the beginning of the stream) and validate this stream if it is currently invalid.
|
inline |
Reset this stream to extract from the specified srcData
, set the index of the next byte to be extracted to 0 (i.e., the beginning of the stream), and validate this stream if it is currently invalid.
|
inline |
Reset this stream to extract from the specified buffer
containing the specified numBytes
, set the index of the next byte to be extracted to 0 (i.e., the beginning of the stream), and validate this stream if it is currently invalid. The behavior is undefined unless 0 == numBytes
if 0 == buffer
.
|
inline |
Set the index of the next byte to be extracted from this stream to the specified offset
from the beginning of the stream, and validate this stream if it is currently invalid. The behavior is undefined unless offset <= length()
.
|
inline |
Set the number of input operations allowed on this stream to the specified limit
before an exception is thrown. If limit
is less than 0, no exception is to be thrown. By default, no exception is scheduled.
|
inline |
Set the quiet mode for this test stream to the specified (boolean) flagValue
. If flagValue
is true
, then quiet mode is turned ON and no error messages will be written to standard output. If flagValue
is false
, then quiet mode is turned OFF. Note that quiet mode is turned OFF by default.
|
friend |
Write the specified object
to the specified output stream
in some reasonable (multi-line) format, and return a reference to stream
.