 |
simdjson
0.9.0
Ridiculously Fast JSON
|
1 #ifndef SIMDJSON_PADDED_STRING_H
2 #define SIMDJSON_PADDED_STRING_H
4 #include "simdjson/portability.h"
5 #include "simdjson/common_defs.h"
6 #include "simdjson/error.h"
14 class padded_string_view;
76 size_t size()
const noexcept;
83 size_t length()
const noexcept;
88 const char *
data()
const noexcept;
89 const uint8_t *u8data()
const noexcept {
return static_cast<const uint8_t*
>(
static_cast<const void*
>(data_ptr));}
94 char *
data() noexcept;
99 operator std::string_view()
const;
120 size_t viable_size{0};
121 char *data_ptr{
nullptr};
132 inline std::ostream& operator<<(std::ostream& out,
const padded_string& s) {
return out << s.
data(); }
134 #if SIMDJSON_EXCEPTIONS
144 inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string> &s) noexcept(
false) {
return out << s.value(); }
163 inline char *allocate_padded_buffer(
size_t length) noexcept;
168 #endif // SIMDJSON_PADDED_STRING_H
size_t length() const noexcept
The length of the 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(const std::string &path) noexcept
Load this padded string from a file.
The result of a simdjson operation that could fail.
size_t size() const noexcept
The length of the string.
padded_string() noexcept
Create a new, empty padded string.
String with extra allocation for ease of use with parser::parse()
User-provided string that promises it has extra padded bytes at the end for use with parser::parse().