sajson
High-Performance JSON Parser
Public Member Functions | List of all members
sajson::mutable_string_view Class Reference

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

#include <sajson.h>

Public Member Functions

 mutable_string_view ()
 Creates an empty, zero-sized view. More...
 
 mutable_string_view (size_t length, char *data)
 Given a length in bytes and a pointer, constructs a view that does not allocate a copy of the data or maintain its life. More...
 
 mutable_string_view (const literal &s)
 Allocates a copy of the given literal string and exposes a mutable view into it. More...
 
 mutable_string_view (const string &s)
 Allocates a copy of the given string and exposes a mutable view into it. More...
 
 mutable_string_view (const mutable_string_view &that)
 Copies a mutable_string_view. More...
 
 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)
 
size_t length () const
 
char * get_data () const
 

Detailed Description

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

Constructor & Destructor Documentation

sajson::mutable_string_view::mutable_string_view ( )
inline

Creates an empty, zero-sized view.

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.

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.

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.

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.

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

Move constructor - neuters the old mutable_string_view.


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