Public Member Functions | Private Attributes | List of all members
sajson::mutable_string_view Class Reference

#include <sajson.h>

Public Member Functions

char * get_data () const
 
size_t length () const
 
 mutable_string_view ()
 Creates an empty, zero-sized view. More...
 
 mutable_string_view (size_t length, char *data_)
 
 mutable_string_view (const literal &s)
 
 mutable_string_view (const string &s)
 
 mutable_string_view (const mutable_string_view &that)
 
 mutable_string_view (mutable_string_view &&that)
 Move constructor - neuters the old mutable_string_view. More...
 
mutable_string_viewoperator= (mutable_string_view &&that)
 
mutable_string_viewoperator= (const mutable_string_view &that)
 

Private Attributes

internal::allocated_buffer buffer
 
char * data
 
size_t length_
 

Detailed Description

A pointer to a mutable buffer, its size in bytes, and strong ownership of any copied memory.

Definition at line 260 of file sajson.h.

Constructor & Destructor Documentation

◆ mutable_string_view() [1/6]

sajson::mutable_string_view::mutable_string_view ( )
inline

Creates an empty, zero-sized view.

Definition at line 263 of file sajson.h.

◆ mutable_string_view() [2/6]

sajson::mutable_string_view::mutable_string_view ( size_t  length,
char *  data_ 
)
inline

Given a length in bytes and a pointer, constructs a view that does not allocate a copy of the data or maintain its life. The given pointer must stay valid for the duration of the parse and the resulting document's life.

Definition at line 273 of file sajson.h.

◆ mutable_string_view() [3/6]

sajson::mutable_string_view::mutable_string_view ( const literal s)
inline

Allocates a copy of the given literal string and exposes a mutable view into it. Throws std::bad_alloc if allocation fails.

Definition at line 281 of file sajson.h.

◆ mutable_string_view() [4/6]

sajson::mutable_string_view::mutable_string_view ( const string s)
inline

Allocates a copy of the given string and exposes a mutable view into it. Throws std::bad_alloc if allocation fails.

Definition at line 291 of file sajson.h.

◆ mutable_string_view() [5/6]

sajson::mutable_string_view::mutable_string_view ( const mutable_string_view that)
inline

Copies a mutable_string_view. If any backing memory has been allocated, its refcount is incremented - both views can safely use the memory.

Definition at line 302 of file sajson.h.

◆ mutable_string_view() [6/6]

sajson::mutable_string_view::mutable_string_view ( mutable_string_view &&  that)
inline

Move constructor - neuters the old mutable_string_view.

Definition at line 309 of file sajson.h.

Member Function Documentation

◆ get_data()

char* sajson::mutable_string_view::get_data ( ) const
inline

Definition at line 342 of file sajson.h.

◆ length()

size_t sajson::mutable_string_view::length ( ) const
inline

Definition at line 338 of file sajson.h.

◆ operator=() [1/2]

mutable_string_view& sajson::mutable_string_view::operator= ( mutable_string_view &&  that)
inline

Definition at line 318 of file sajson.h.

◆ operator=() [2/2]

mutable_string_view& sajson::mutable_string_view::operator= ( const mutable_string_view that)
inline

Definition at line 329 of file sajson.h.

Member Data Documentation

◆ buffer

internal::allocated_buffer sajson::mutable_string_view::buffer
private

Definition at line 349 of file sajson.h.

◆ data

char* sajson::mutable_string_view::data
private

Definition at line 348 of file sajson.h.

◆ length_

size_t sajson::mutable_string_view::length_
private

Definition at line 347 of file sajson.h.


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


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:23