1#ifndef SIMDJSON_PADDED_STRING_VIEW_H
2#define SIMDJSON_PADDED_STRING_VIEW_H
4#include "simdjson/portability.h"
5#include "simdjson/base.h"
6#include "simdjson/error.h"
12#if SIMDJSON_CPLUSPLUS17
62 inline size_t capacity() const noexcept;
75 inline
size_t padding() const noexcept;
90#if SIMDJSON_CPLUSPLUS17
104 inline explicit padded_input(std::string_view sv);
110 inline explicit padded_input(
const char *data,
size_t length);
117 inline explicit padded_input(
const std::string &s);
124 inline bool is_view()
const noexcept;
134 std::variant<simdjson::padded_string_view, simdjson::padded_string> storage;
136 static inline bool needs_allocation(
const char* buf,
size_t len,
size_t padding =
SIMDJSON_PADDING)
noexcept;
141#if SIMDJSON_EXCEPTIONS
196 size_t block_size,
size_t index)
noexcept;
User-provided string that promises it has extra padded bytes at the end for use with parser::parse().
bool remove_utf8_bom() noexcept
Remove the UTF-8 Byte Order Mark (BOM) if it exists.
size_t padding() const noexcept
The amount of padding on the string (capacity() - length())
size_t capacity() const noexcept
The number of allocated bytes.
padded_string_view() noexcept=default
Create an empty padded_string_view.
bool has_sufficient_padding() const noexcept
check that the view has sufficient padding
The top level simdjson namespace, containing everything the library provides.
padded_string_view slice_at(padded_string_view data, char delimiter, size_t block_size, size_t index) noexcept
Return the index-th document-aligned slice of a delimited stream.
padded_string_view pad_with_reserve(std::string &s) noexcept
Create a padded_string_view from a string.
uint32_t get_page_size() noexcept
Get the system's memory page size.
padded_string_view pad(std::string &s) noexcept
Create a padded_string_view from a string.
constexpr size_t SIMDJSON_PADDING
The amount of padding needed in a buffer to parse JSON.
The result of a simdjson operation that could fail.