1#ifndef SIMDJSON_PADDED_STRING_H
2#define SIMDJSON_PADDED_STRING_H
4#include "simdjson/base.h"
5#include "simdjson/error.h"
7#include "simdjson/error-inl.h"
16class padded_string_view;
81 size_t size() const noexcept;
88 size_t length() const noexcept;
93 const
char *
data() const noexcept;
94 const uint8_t *u8data() const noexcept {
return static_cast<const uint8_t*
>(
static_cast<const void*
>(data_ptr));}
99 char *
data() noexcept;
134 size_t viable_size{0};
135 char *data_ptr{
nullptr};
146inline std::ostream& operator<<(std::ostream& out,
const padded_string& s) {
return out << s.
data(); }
148#if SIMDJSON_EXCEPTIONS
178inline char *allocate_padded_buffer(
size_t length)
noexcept;
User-provided string that promises it has extra padded bytes at the end for use with parser::parse().
The top level simdjson namespace, containing everything the library provides.
String with extra allocation for ease of use with parser::parse()
size_t size() const noexcept
The length of the string.
operator std::string_view() const
Create a std::string_view with the same content.
size_t length() const noexcept
The length of the string.
padded_string() noexcept
Create a new, empty padded string.
padded_string & operator=(padded_string &&o) noexcept
Move one padded string into another.
const char * data() const noexcept
The string data.
static simdjson_result< padded_string > load(std::string_view path) noexcept
Load this padded string from a file.
The result of a simdjson operation that could fail.