SofaBuffers C++ 0.12.0
Pure-C++20 SofaBuffers — API Documentation
Loading...
Searching...
No Matches
C++20 API

Namespaces

namespace  sofab
 

Macros

#define SOFAB_STRICT_UTF8   1
 Compile-time gate for strict UTF-8 validation of string payloads (spec MESSAGE_SPEC §8, CORELIB_PLAN §6.4).
 

Detailed Description

Macro Definition Documentation

◆ SOFAB_STRICT_UTF8

#define SOFAB_STRICT_UTF8   1

Compile-time gate for strict UTF-8 validation of string payloads (spec MESSAGE_SPEC §8, CORELIB_PLAN §6.4).

SofaBuffers string fields carry UTF-8 text; blob is the type for opaque bytes. With the check ON (the default, 1) an invalid-UTF-8 string is rejected symmetrically: on decode it is the INVALID outcome (sofab::Error::InvalidMessage), on encode it is refused with sofab::Error::InvalidArgument. blob is never validated in either direction, and a skipped string is never validated (only a materialised read is).

The knob is compile-time because this header carries no runtime encode-side configuration object (an OStream is constructed from buffers only), so a single #define is the only way to gate encode and decode with one symmetric switch — the "compile-time (`#define`)" option §6.4 explicitly permits for C++. Define SOFAB_STRICT_UTF8 to 0 before including this header for a documented non-strict build: the validation code then folds away entirely (zero .text/.rodata cost) and payloads are stored verbatim — raw, never lossy. Such a build is expected to still build and conformance-test the check-ON configuration (§6.4).

Definition at line 73 of file sofab.hpp.