pjson 2.0.0
A small, owning JSON value for C++11
Loading...
Searching...
No Matches
ByteDance::pjson::StringView Class Reference

Minimal C++11-compatible, non-owning view of a JSON string. More...

#include <pjson.h>

Public Member Functions

 StringView () noexcept
 Constructs an empty view with data() == nullptr.
 
const char * data () const noexcept
 Returns the borrowed first byte; a default view returns null.
 
size_t size () const noexcept
 Returns the number of bytes in the view, including embedded NUL bytes.
 
bool empty () const noexcept
 Returns whether size() is zero.
 

Detailed Description

Minimal C++11-compatible, non-owning view of a JSON string.

A view aliases bytes owned by this pjson node and is valid only while that node remains alive and unchanged. Assignment, reset, swap, move, destruction, erasing the node, or replacing/resetting an ancestor invalidates it. Strings may contain embedded NUL bytes; use size() rather than strlen().

Definition at line 354 of file pjson.h.

Constructor & Destructor Documentation

◆ StringView()

ByteDance::pjson::StringView::StringView ( )
noexcept

Constructs an empty view with data() == nullptr.

Member Function Documentation

◆ data()

const char * ByteDance::pjson::StringView::data ( ) const
noexcept

Returns the borrowed first byte; a default view returns null.

◆ empty()

bool ByteDance::pjson::StringView::empty ( ) const
noexcept

Returns whether size() is zero.

◆ size()

size_t ByteDance::pjson::StringView::size ( ) const
noexcept

Returns the number of bytes in the view, including embedded NUL bytes.


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