pjson 1.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. 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(). More...

#include <pjson.h>

Public Member Functions

 StringView () noexcept
 Public API member StringView; see the API overview for its contract. / Returns the borrowed first byte; a default view returns null.
 
const chardata () const noexcept
 Public API member data; see the API overview for its contract. / Returns the number of bytes in the view, including embedded NUL bytes.
 
size_t size () const noexcept
 Public API member size; see the API overview for its contract. / Returns whether size() is zero.
 
bool empty () const noexcept
 Public API member empty; see the API overview for its contract.
 

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 484 of file pjson.h.

Constructor & Destructor Documentation

◆ StringView()

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

Public API member StringView; see the API overview for its contract. / Returns the borrowed first byte; a default view returns null.

Member Function Documentation

◆ data()

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

Public API member data; see the API overview for its contract. / Returns the number of bytes in the view, including embedded NUL bytes.

◆ empty()

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

Public API member empty; see the API overview for its contract.

◆ size()

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

Public API member size; see the API overview for its contract. / Returns whether size() is zero.


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