simdjson  3.11.0
Ridiculously Fast JSON
simdjson::padded_string_view Class Reference

User-provided string that promises it has extra padded bytes at the end for use with parser::parse(). More...

Inheritance diagram for simdjson::padded_string_view:

Public Member Functions

 padded_string_view () noexcept=default
 Create an empty padded_string_view.
 
 padded_string_view (const char *s, size_t len, size_t capacity) noexcept
 Promise the given buffer has at least SIMDJSON_PADDING extra bytes allocated to it. More...
 
 padded_string_view (const uint8_t *s, size_t len, size_t capacity) noexcept
 overload explicit inline padded_string_view(const char* s, size_t len) noexcept
 
 padded_string_view (const std::string &s) noexcept
 Promise the given string has at least SIMDJSON_PADDING extra bytes allocated to it. More...
 
 padded_string_view (std::string_view s, size_t capacity) noexcept
 Promise the given string_view has at least SIMDJSON_PADDING extra bytes allocated to it. More...
 
size_t capacity () const noexcept
 The number of allocated bytes.
 
bool remove_utf8_bom () noexcept
 Remove the UTF-8 Byte Order Mark (BOM) if it exists. More...
 
size_t padding () const noexcept
 The amount of padding on the string (capacity() - length())
 

Detailed Description

User-provided string that promises it has extra padded bytes at the end for use with parser::parse().

Definition at line 18 of file padded_string_view.h.

Constructor & Destructor Documentation

◆ padded_string_view() [1/3]

simdjson::padded_string_view::padded_string_view ( const char *  s,
size_t  len,
size_t  capacity 
)
inlineexplicitnoexcept

Promise the given buffer has at least SIMDJSON_PADDING extra bytes allocated to it.

Parameters
sThe string.
lenThe length of the string (not including padding).
capacityThe allocated length of the string, including padding. If the capacity is less than the length, the capacity will be set to the length.

Definition at line 11 of file padded_string_view-inl.h.

◆ padded_string_view() [2/3]

simdjson::padded_string_view::padded_string_view ( const std::string &  s)
inlineexplicitnoexcept

Promise the given string has at least SIMDJSON_PADDING extra bytes allocated to it.

The capacity of the string will be used to determine its padding.

Parameters
sThe string.

Definition at line 27 of file padded_string_view-inl.h.

◆ padded_string_view() [3/3]

simdjson::padded_string_view::padded_string_view ( std::string_view  s,
size_t  capacity 
)
inlineexplicitnoexcept

Promise the given string_view has at least SIMDJSON_PADDING extra bytes allocated to it.

Parameters
sThe string.
capacityThe allocated length of the string, including padding. If the capacity is less than the length, the capacity will be set to the length.

Definition at line 32 of file padded_string_view-inl.h.

Member Function Documentation

◆ remove_utf8_bom()

bool simdjson::padded_string_view::remove_utf8_bom ( )
inlinenoexcept

Remove the UTF-8 Byte Order Mark (BOM) if it exists.

Returns
whether a BOM was found and removed

Definition at line 42 of file padded_string_view-inl.h.


The documentation for this class was generated from the following files: