Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::timeline::ParsedJson Class Reference

Parsed JSON tree that owns the source bytes referenced by node offsets. More...

#include <schema_json.hpp>

Public Member Functions

const JsonValue & root () const noexcept
 Returns the root node.
std::string_view source () const noexcept
 Returns the complete owned source.
std::string_view raw (const JsonValue &value) const noexcept
 Returns the original byte slice for a node from this parse.

Friends

runtime::Result< std::shared_ptr< const ParsedJson >, PersistenceError > parse_json (std::string_view json, const DecodeLimits &limits={})
 Parses one complete UTF-8 JSON value into an owning immutable document.

Detailed Description

Parsed JSON tree that owns the source bytes referenced by node offsets.

The object is immutable after parsing and safe for concurrent reads. Views returned by source() and raw() remain valid while this ParsedJson lives.

Member Function Documentation

◆ raw()

std::string_view pulp::timeline::ParsedJson::raw ( const JsonValue & value) const
noexcept

Returns the original byte slice for a node from this parse.

Provenance is checked by node identity, not inferred from byte offsets: value must be the exact root() object or one of its exact descendants. A copied node, a manually constructed node, or a node owned by another ParsedJson is rejected even when its bounds fit source().

Parameters
valueNode belonging to this parse tree.
Returns
The node's original source bytes, or an empty view when provenance or source bounds fail validation. The function never throws.

◆ root()

const JsonValue & pulp::timeline::ParsedJson::root ( ) const
inlinenoexcept

Returns the root node.

◆ source()

std::string_view pulp::timeline::ParsedJson::source ( ) const
inlinenoexcept

Returns the complete owned source.

◆ parse_json

runtime::Result< std::shared_ptr< const ParsedJson >, PersistenceError > parse_json ( std::string_view json,
const DecodeLimits & limits = {} )
friend

Parses one complete UTF-8 JSON value into an owning immutable document.

Duplicate object keys are rejected. Input bytes are copied, and all parser depth, value, container, and string ceilings are enforced before success.

Parameters
jsonComplete JSON text, borrowed for the call.
limitsParser resource ceilings.
Returns
An owning immutable parse tree or a structured parse error.

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/timeline/include/pulp/timeline/schema_json.hpp