Skip to content

Class jac::Class

template <class Builder>

ClassList > jac > Class

Public Static Functions

Type Name
std::enable_if_t< is_base_of_template_v< ProtoBuilder::Opaque, Bdr > &&std::is_base_of_v< typename Bdr::OpaqueType, T > &&std::is_same_v< Bdr, Builder >, Value > createInstance (ContextRef ctx, T * instance)
Create a new instance of this class in given context.
JSClassID getClassId ()
Get the class id of this class.
Function getConstructor (ContextRef ctx)
Get the constructor object of this class in given context.
Object getProto (ContextRef ctx)
Get the prototype object of this class in given context.
void init (std::string name, bool isCtor=false)
Initialize the class.
void initContext (ContextRef ctx)
Initialize the class prototype.

Public Static Functions Documentation

function createInstance

Create a new instance of this class in given context.

template<typename T, typename Bdr>
static inline std::enable_if_t< is_base_of_template_v< ProtoBuilder::Opaque , Bdr > &&std::is_base_of_v< typename Bdr::OpaqueType, T > &&std::is_same_v< Bdr, Builder >, Value > jac::Class::createInstance (
    ContextRef ctx,
    T * instance
) 

Note:

if the class wasn't initialized in the context, it will be initialized

Parameters:

  • ctx the context
  • instance a new-allocated instance to be saved as opaque data

Returns:

The new instance


function getClassId

Get the class id of this class.

static inline JSClassID jac::Class::getClassId () 

Returns:

JSClassID


function getConstructor

Get the constructor object of this class in given context.

static inline Function jac::Class::getConstructor (
    ContextRef ctx
) 

Note:

if the class wasn't initialized in the context, it will be initialized

Parameters:

  • ctx context to work in

Returns:

The constructor object


function getProto

Get the prototype object of this class in given context.

static inline Object jac::Class::getProto (
    ContextRef ctx
) 

Note:

if the class wasn't initialized in the context, it will be initialized

Parameters:

  • ctx context to work in

Returns:

The prototype object


function init

Initialize the class.

static inline void jac::Class::init (
    std::string name,
    bool isCtor=false
) 

Note:

This function should be called only once. Any subsequent calls with different parameters will throw an exception

Parameters:

  • name name of the class
  • isCtor whether or not the class is callable a constructor (if it's callable at all)

function initContext

Initialize the class prototype.

static inline void jac::Class::initContext (
    ContextRef ctx
) 

Note:

If the class is already initialized, this function does nothing

Parameters:

  • ctx context to work in


The documentation for this class was generated from the following file src/jac/machine/class.h