MySQL 9.0.0
Source Code Documentation
Json_scalar_holder Class Reference

A class that is capable of holding objects of any sub-type of Json_scalar. More...

#include <json_dom.h>

Classes

union  Any_json_scalar
 Union of all concrete subclasses of Json_scalar. More...
 

Public Member Functions

Json_scalarget ()
 Get a pointer to the held object, or nullptr if there is none. More...
 
template<typename T , typename... Args>
void emplace (Args &&... args)
 Construct a new Json_scalar value in this Json_scalar_holder. More...
 

Private Attributes

Any_json_scalar m_buffer
 The buffer in which the Json_scalar value is stored. More...
 
Json_scalarm_scalar_ptr {nullptr}
 Pointer to the held scalar, or nullptr if no value is held. More...
 

Detailed Description

A class that is capable of holding objects of any sub-type of Json_scalar.

Used for pre-allocating space in query-duration memory for JSON scalars that are to be returned by get_json_atom_wrapper().

This class should be replaced by std::variant when moving to C++17.

Member Function Documentation

◆ emplace()

template<typename T , typename... Args>
void Json_scalar_holder::emplace ( Args &&...  args)
inline

Construct a new Json_scalar value in this Json_scalar_holder.

If a value is already held, the old value is destroyed and replaced.

Template Parameters
Twhich type of Json_scalar to create
Parameters
argsthe arguments to T's constructor

◆ get()

Json_scalar * Json_scalar_holder::get ( )
inline

Get a pointer to the held object, or nullptr if there is none.

Member Data Documentation

◆ m_buffer

Any_json_scalar Json_scalar_holder::m_buffer
private

The buffer in which the Json_scalar value is stored.

◆ m_scalar_ptr

Json_scalar* Json_scalar_holder::m_scalar_ptr {nullptr}
private

Pointer to the held scalar, or nullptr if no value is held.


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