How to use BSON document validation interfaces.
Basic Usage
void example() {
{
std::uint8_t bytes[1]{};
std::size_t offset;
ASSERT(offset == 0u);
}
const std::uint8_t* data = owner.data();
const std::size_t length = owner.length();
{
ASSERT(doc_opt);
ASSERT(doc.data() == data);
ASSERT(doc.length() == length);
ASSERT(doc == owner.view());
}
{
std::size_t offset = 123u;
ASSERT(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);
ASSERT(offset == 4u);
options.check_utf8_allow_null(true);
}
{
std::size_t offset;
options.check_dot_keys(true);
ASSERT(offset == 15u);
}
{
std::size_t offset;
options.check_dollar_keys(true);
ASSERT(offset == 4u);
}
}