You are here: Start » Function Reference » All Functions » Binary Data » WriteBoolToBuffer
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | STD.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Converts boolean value into specified integer binary representation and writes it to a byte buffer.
Syntax
void fil::WriteBoolToBuffer ( const fil::ByteBuffer& inBuffer, ftl::Optional<int> inOffset, bool inValue, fil::IntegerBinaryFormat::Type inFormat, int inTrueValue, int inFalseValue, fil::ByteBuffer& outBuffer )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inBuffer | const ByteBuffer& | Initial buffer to be expanded | ||
![]() |
inOffset | Optional<int> | 0 - ![]() |
NIL | Write destination position |
![]() |
inValue | bool | Value to be written | ||
![]() |
inFormat | IntegerBinaryFormat::Type | Signed_32Bit_LittleEndian | Binary serialization format of integer data | |
![]() |
inTrueValue | int | 1 | Integer value representing True | |
![]() |
inFalseValue | int | 0 | Integer value representing False | |
![]() |
outBuffer | ByteBuffer& | Resulting data |
In-place Processing
This function supports in-place data processing - you can pass the same reference to inBuffer and outBuffer
Read more about In-place Computation.
Description
This filter is intended for generating a raw binary data in the ByteBuffer by writing a properly serialized boolean value into it.
Resulting ByteBuffer data on the outBuffer output is created by expanding data from buffer on the inBuffer input. Data is written starting at the position specified by the inOffset input (in bytes). When written data spans beyond the end of the input buffer the resulting buffer length is expanded (event when inOffset points beyond the end of the input buffer). When the inOffset input is set to Auto data is written at the end of the input buffer.
A boolean value is actually stored as an integer data with contractual numeric value representing True and False. This values can be set respectively on the inTrueValue and inFalseValue inputs. Usually a value of zero is used to represent False, and a value different that zero (most commonly 1 or -1) to represent True. This value is than stored like in the WriteIntegerToBuffer filter.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Input value is out of the valid range for specified integer binary format. Value provided on inValue input cannot be cast to the type specified by the inFormat input. |
DomainError | Not supported integer binary format. |
IoError | Resulting byte buffer size is too large. |
See Also
- ReadBoolFromBuffer – Reads boolean value in specified binary format from byte buffer.