simdjson 4.2.2
Ridiculously Fast JSON
Loading...
Searching...
No Matches
simdjson::padded_string Struct Referencefinal

String with extra allocation for ease of use with parser::parse() More...

#include <padded_string.h>

Public Member Functions

 padded_string () noexcept
 Create a new, empty padded string.
 
 padded_string (size_t length) noexcept
 Create a new padded string buffer.
 
 padded_string (const char *data, size_t length) noexcept
 Create a new padded string by copying the given input.
 
 padded_string (const std::string &str_) noexcept
 Create a new padded string by copying the given input.
 
 padded_string (std::string_view sv_) noexcept
 Create a new padded string by copying the given input.
 
 padded_string (padded_string &&o) noexcept
 Move one padded string into another.
 
padded_stringoperator= (padded_string &&o) noexcept
 Move one padded string into another.
 
void swap (padded_string &o) noexcept
 
size_t size () const noexcept
 The length of the string.
 
size_t length () const noexcept
 The length of the string.
 
const char * data () const noexcept
 The string data.
 
const uint8_t * u8data () const noexcept
 
char * data () noexcept
 The string data.
 
 operator std::string_view () const
 Create a std::string_view with the same content.
 
 operator padded_string_view () const noexcept
 Create a padded_string_view with the same content.
 

Static Public Member Functions

static simdjson_result< padded_stringload (std::string_view path) noexcept
 Load this padded string from a file.
 

Detailed Description

String with extra allocation for ease of use with parser::parse()

This is a move-only class, it cannot be copied.

Definition at line 23 of file padded_string.h.

Constructor & Destructor Documentation

◆ padded_string() [1/5]

simdjson::padded_string::padded_string ( size_t  length)
inlineexplicitnoexcept

Create a new padded string buffer.

Parameters
lengththe size of the string.

Definition at line 49 of file padded_string-inl.h.

◆ padded_string() [2/5]

simdjson::padded_string::padded_string ( const char *  data,
size_t  length 
)
inlineexplicitnoexcept

Create a new padded string by copying the given input.

Parameters
datathe buffer to copy
lengththe number of bytes to copy

Definition at line 52 of file padded_string-inl.h.

◆ padded_string() [3/5]

simdjson::padded_string::padded_string ( const std::string &  str_)
inlinenoexcept

Create a new padded string by copying the given input.

Parameters
str_the string to copy

Definition at line 73 of file padded_string-inl.h.

◆ padded_string() [4/5]

simdjson::padded_string::padded_string ( std::string_view  sv_)
inlinenoexcept

Create a new padded string by copying the given input.

Parameters
sv_the string to copy

Definition at line 82 of file padded_string-inl.h.

◆ padded_string() [5/5]

simdjson::padded_string::padded_string ( padded_string &&  o)
inlinenoexcept

Move one padded string into another.

The original padded string will be reduced to zero capacity.

Parameters
othe string to move.

Definition at line 93 of file padded_string-inl.h.

◆ ~padded_string()

simdjson::padded_string::~padded_string ( )
inlinenoexcept

Definition at line 117 of file padded_string-inl.h.

Member Function Documentation

◆ data() [1/2]

const char * simdjson::padded_string::data ( ) const
inlinenoexcept

The string data.

Definition at line 125 of file padded_string-inl.h.

◆ data() [2/2]

char * simdjson::padded_string::data ( )
inlinenoexcept

The string data.

Definition at line 127 of file padded_string-inl.h.

◆ length()

size_t simdjson::padded_string::length ( ) const
inlinenoexcept

The length of the string.

Does not include padding.

Definition at line 123 of file padded_string-inl.h.

◆ load()

simdjson_result< padded_string > simdjson::padded_string::load ( std::string_view  path)
inlinestaticnoexcept

Load this padded string from a file.

Windows and Unicode

Windows users who need to read files with non-ANSI characters in the name should set their code page to UTF-8 (65001) before calling this function. This should be the default with Windows 11 and better. Further, they may use the AreFileApisANSI function to determine whether the filename is interpreted using the ANSI or the system default OEM codepage, and they may call SetFileApisToOEM accordingly.

Returns
IO_ERROR on error. Be mindful that on some 32-bit systems, the file size might be limited to 2 GB.
Parameters
paththe path to the file.

Definition at line 135 of file padded_string-inl.h.

◆ operator padded_string_view()

simdjson::padded_string::operator padded_string_view ( ) const
inlinenoexcept

Create a padded_string_view with the same content.

Definition at line 131 of file padded_string-inl.h.

◆ operator std::string_view()

simdjson::padded_string::operator std::string_view ( ) const
inline

Create a std::string_view with the same content.

Definition at line 129 of file padded_string-inl.h.

◆ operator=()

padded_string & simdjson::padded_string::operator= ( padded_string &&  o)
inlinenoexcept

Move one padded string into another.

The original padded string will be reduced to zero capacity.

Parameters
othe string to move.

Definition at line 99 of file padded_string-inl.h.

◆ size()

size_t simdjson::padded_string::size ( ) const
inlinenoexcept

The length of the string.

Does not include padding.

Definition at line 121 of file padded_string-inl.h.

◆ swap()

void simdjson::padded_string::swap ( padded_string o)
inlinenoexcept

Definition at line 108 of file padded_string-inl.h.

◆ u8data()

const uint8_t * simdjson::padded_string::u8data ( ) const
inlinenoexcept

Definition at line 94 of file padded_string.h.


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