|
SofaBuffers C/C++ 0.12.0
API Documentation
|
Namespaces | |
| namespace | sofab |
Macros | |
| #define | SOFAB_CPP_HAVE_HOSTED __STDC_HOSTED__ |
| 1 if the hosted standard library is available, else 0. | |
| #define | SOFAB_CPP_HAVE_FP64 1 |
1 if the wrapper exposes 64-bit float (double) fields, else 0 (mirrors SOFAB_DISABLE_FP64_SUPPORT in the C core). | |
| #define | SOFAB_CPP_HAVE_INT64 1 |
1 if the wrapper exposes 64-bit integer fields, else 0 (mirrors SOFAB_DISABLE_INT64_SUPPORT in the C core). | |
| #define | SOFAB_CPP_HAVE_ARRAY 1 |
1 if the wrapper exposes array/span fields, else 0 (mirrors SOFAB_DISABLE_ARRAY_SUPPORT in the C core). | |
| #define | SOFAB_CPP_HAVE_ENCODE_BOUNDS 1 |
| 1 if generated code refuses an over-bound value at encode, else 0. | |
| #define SOFAB_CPP_HAVE_ARRAY 1 |
| #define SOFAB_CPP_HAVE_ENCODE_BOUNDS 1 |
1 if generated code refuses an over-bound value at encode, else 0.
A value past a bound only the schema knows – a string or blob longer than its maxlen, an array with more elements than its count – is refused by the generated serialize() through sofab::OStreamImpl::rejectArgument. Each such check is written if (sofab::ENCODE_BOUNDS && ...), so defining SOFAB_DISABLE_ENCODE_BOUNDS removes all of them from the image: a footprint switch for a caller that guarantees its values fit. The decode-side bound checks are not affected.
| #define SOFAB_CPP_HAVE_FP64 1 |
| #define SOFAB_CPP_HAVE_HOSTED __STDC_HOSTED__ |
1 if the hosted standard library is available, else 0.
Gates the convenience layer that needs an allocator: the std::string / std::vector overloads, OStream (a std::shared_ptr buffer owner) and the std::function callback typedefs. Every gated entity has a heap-free counterpart that stays available freestanding — FixedString, FixedBytes, InlineVector, OStreamInline, OStreamView and plain function pointers — so the wire API is complete in both modes.
Defaults to the compiler's own answer (__STDC_HOSTED__ is 0 under -ffreestanding, 1 otherwise) and can be forced either way with -DSOFAB_CPP_HAVE_HOSTED=0/1.