MySQL 9.1.0
Source Code Documentation
Json_scalar Class Reference

Abstract base class for all Json scalars. More...

#include <json_dom.h>

Inheritance diagram for Json_scalar:
[legend]

Public Member Functions

uint32 depth () const final
 Compute the depth of a document. More...
 
bool is_scalar () const final
 
- Public Member Functions inherited from Json_dom
virtual ~Json_dom ()=default
 
void * operator new (size_t size, const std::nothrow_t &) noexcept
 Allocate space on the heap for a Json_dom object. More...
 
void operator delete (void *ptr) noexcept
 Deallocate the space used by a Json_dom object. More...
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 Nothrow delete. More...
 
Json_containerparent () const
 Get the parent dom to which this dom is attached. More...
 
virtual enum_json_type json_type () const =0
 
virtual bool is_number () const
 
virtual Json_dom_ptr clone () const =0
 Make a deep clone. More...
 
Json_path get_location () const
 Get the path location of this dom, measured from the outermost document it nests inside. More...
 
bool seek (const Json_seekable_path &path, size_t legs, Json_dom_vector *hits, bool auto_wrap, bool only_need_one)
 Finds all of the json sub-documents which match the path expression. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Json_dom
static Json_dom_ptr parse (const char *text, size_t length, const JsonParseErrorHandler &error_handler, const JsonErrorHandler &depth_handler)
 Parse Json text to DOM (using rapidjson). More...
 
static Json_dom_ptr parse (const json_binary::Value &v)
 Construct a DOM object based on a binary JSON value. More...
 

Detailed Description

Abstract base class for all Json scalars.

Member Function Documentation

◆ depth()

uint32 Json_scalar::depth ( ) const
inlinefinalvirtual

Compute the depth of a document.

This is the value which would be returned by the JSON_DEPTH() system function.

  • for scalar values, empty array and empty object: 1
  • for non-empty array: 1+ max(depth of array elements)
  • for non-empty objects: 1+ max(depth of object values)

For example: "abc", [] and {} have depth 1. ["abc", [3]] and {"a": "abc", "b": [3]} have depth 3.

Returns
the depth of the document

Implements Json_dom.

◆ is_scalar()

bool Json_scalar::is_scalar ( ) const
inlinefinalvirtual
Returns
true if the object is a subclass of Json_scalar

Reimplemented from Json_dom.


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