simdjson 4.3.1
Ridiculously Fast JSON
Loading...
Searching...
No Matches
simdjson::padded_string_builder Class Reference

Builder for constructing padded_string incrementally. More...

#include <padded_string.h>

Public Member Functions

 padded_string_builder () noexcept
 Create a new, empty padded string builder.
 
 padded_string_builder (size_t capacity) noexcept
 Create a new padded string builder with initial capacity.
 
 padded_string_builder (padded_string_builder &&o) noexcept
 Move constructor.
 
padded_string_builderoperator= (padded_string_builder &&o) noexcept
 Move assignment.
 
 padded_string_builder (const padded_string_builder &)=delete
 Copy constructor (deleted).
 
padded_string_builderoperator= (const padded_string_builder &)=delete
 Copy assignment (deleted).
 
 ~padded_string_builder () noexcept
 Destructor.
 
bool append (const char *newdata, size_t length) noexcept
 Append data to the builder.
 
bool append (std::string_view sv) noexcept
 Append a string view to the builder.
 
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.
 
padded_string convert () noexcept
 Convert the current content into a padded_string.
 

Detailed Description

Builder for constructing padded_string incrementally.

This class allows efficient appending of data and then building a padded_string.

Definition at line 168 of file padded_string.h.

Constructor & Destructor Documentation

◆ padded_string_builder() [1/2]

simdjson::padded_string_builder::padded_string_builder ( size_t  capacity)
inlinenoexcept

Create a new padded string builder with initial capacity.

Parameters
capacitythe initial capacity of the builder.

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

◆ padded_string_builder() [2/2]

simdjson::padded_string_builder::padded_string_builder ( padded_string_builder &&  o)
inlinenoexcept

Move constructor.

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

◆ ~padded_string_builder()

simdjson::padded_string_builder::~padded_string_builder ( )
inlinenoexcept

Destructor.

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

Member Function Documentation

◆ append() [1/2]

bool simdjson::padded_string_builder::append ( const char *  newdata,
size_t  length 
)
inlinenoexcept

Append data to the builder.

Parameters
newdatathe buffer to append
lengththe number of bytes to append
Returns
true if the append succeeded, false if allocation failed

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

◆ append() [2/2]

bool simdjson::padded_string_builder::append ( std::string_view  sv)
inlinenoexcept

Append a string view to the builder.

Parameters
svthe string view to append
Returns
true if the append succeeded, false if allocation failed

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

◆ build()

padded_string simdjson::padded_string_builder::build ( ) const
inlinenoexcept

Build a padded_string from the current content.

The builder's content is not modified. If you want to avoid the copy, use convert() instead.

Returns
a padded_string containing a copy of the built content.

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

◆ convert()

padded_string simdjson::padded_string_builder::convert ( )
inlinenoexcept

Convert the current content into a padded_string.

The builder's content is emptied, the capacity is lost.

Returns
a padded_string containing the built content.

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

◆ length()

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

Get the current length of the built string.

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

◆ operator=()

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

Move assignment.

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


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