How to use BSON document validation interfaces.
Basic Usage
void example() {
{
std::uint8_t bytes[1]{};
std::size_t offset;
EXPECT(offset == 0u);
}
const std::uint8_t* data = owner.data();
const std::size_t length = owner.length();
{
EXPECT(doc_opt);
EXPECT(doc.data() == data);
EXPECT(doc.length() == length);
EXPECT(doc == owner.view());
}
{
std::size_t offset = 123u;
EXPECT(offset == 123u);
}
}
With Validator
void example(const std::uint8_t* bytes, std::size_t length) {
{
std::size_t offset;
}
{
std::size_t offset;
options.check_utf8(true);
EXPECT(offset == 4u);
options.check_utf8_allow_null(true);
}
{
std::size_t offset;
options.check_dot_keys(true);
EXPECT(offset == 15u);
}
{
std::size_t offset;
options.check_dollar_keys(true);
EXPECT(offset == 4u);
}
}