simdjson: include/simdjson/padded_string.h Source File
1#ifndef SIMDJSON_PADDED_STRING_H
2#define SIMDJSON_PADDED_STRING_H
7#include "simdjson/error-inl.h"
50 inline padded_string(const std::string & str_ ) noexcept;
56 inline padded_string(std::string_view sv_) noexcept;
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;
109 inline bool append(const char *data, size_t length) noexcept;
214 inline bool append(const char *newdata, size_t length) noexcept;
222 inline bool append(std::string_view sv) noexcept;
227 inline size_t length() const noexcept;
265inline std::ostream& operator<<(std::ostream& out, const padded_string& s) { return out << s.data(); }
277inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string> &s) noexcept(false) { return out << s.value(); }
297inline char *allocate_padded_buffer(size_t length) noexcept;
Builder for constructing padded_string incrementally.
padded_string convert() noexcept
Convert the current content into a padded_string.
size_t length() const noexcept
Get the current length of the built string.
padded_string build() const noexcept
Build a padded_string from the current content.
bool append(const char *newdata, size_t length) noexcept
Append data to the builder.
padded_string_builder() noexcept
Create a new, empty padded string builder.
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.
bool append(const char *data, size_t length) noexcept
Append data to the padded string.
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.