Class jac::Atom
A wrapper around JSAtom with RAII. In the context of QuickJS, Atom is used to represent identifiers of properties, variables, functions, etc.
#include <atom.h>
Public Functions
| Type | Name |
|---|---|
| Atom (ContextRef ctx, JSAtom atom) Wrap an existing JSAtom. The JSAtom will be freed when the Atom is destroyed. |
|
| Atom (const Atom & other) |
|
| Atom (Atom && other) |
|
| JSAtom & | get () Get reference to the underlying JSAtom. |
| std::pair< ContextRef, JSAtom > | loot () Release ownership of the JSAtom. The JSAtom will have to be freed manually. |
| Atom & | operator= (const Atom & other) |
| Atom & | operator= (Atom && other) |
| StringView | toString () const Get string representation of the atom. |
| ~Atom () |
Public Static Functions
| Type | Name |
|---|---|
| Atom | create (ContextRef ctx, uint32_t value) Create a new atom from an uint32_t value. |
| Atom | create (ContextRef ctx, const char * value) Create a new atom from a string. |
| Atom | create (ContextRef ctx, std::string value) Create a new atom from a string. |
Protected Attributes
| Type | Name |
|---|---|
| JSAtom | _atom |
| ContextRef | _ctx |
Public Functions Documentation
function Atom [1/3]
Wrap an existing JSAtom. The JSAtom will be freed when the Atom is destroyed.
Note:
Used internally when directly working with QuickJS API. New Atom should be created using Atom::create().
Parameters:
ctxcontext to work inatomJSAtom to wrap
function Atom [2/3]
function Atom [3/3]
function get
Get reference to the underlying JSAtom.
Returns:
JSAtom reference
function loot
Release ownership of the JSAtom. The JSAtom will have to be freed manually.
Note:
After this call, the Atom will be in an invalid state.
Returns:
Pair of ContextRef and JSAtom
function operator=
function operator=
function toString
Get string representation of the atom.
Returns:
function ~Atom
Public Static Functions Documentation
function create [1/3]
Create a new atom from an uint32_t value.
Parameters:
ctxcontext to create the atom invaluethe value
Returns:
The newly constructed atom
function create [2/3]
Create a new atom from a string.
Parameters:
ctxcontext to create the atom invaluethe value
Returns:
The newly constructed atom
function create [3/3]
Create a new atom from a string.
Parameters:
ctxcontext to create the atom invaluethe value
Returns:
The newly constructed atom
Protected Attributes Documentation
variable _atom
variable _ctx
Friends Documentation
friend operator<<
The documentation for this class was generated from the following file src/jac/machine/atom.h