CCF
|
#include <context.h>
Public Member Functions | |
Context (TxAccess acc) | |
virtual | ~Context () |
Context (const Context &)=delete | |
Context & | operator= (const Context &)=delete |
Runtime & | runtime () |
operator JSContext * () const | |
void | set_module_loader (const modules::ModuleLoaderPtr &ml) |
virtual std::optional< JSWrappedValue > | get_module (std::string_view module_name) |
JSWrappedValue | wrap (JSValue &&val) const |
JSWrappedValue | wrap (const JSValue &val) const |
JSValue | extract_string_array (JSValueConst &argv, std::vector< std::string > &out) |
std::pair< std::string, std::optional< std::string > > | error_message () |
JSWrappedValue | get_property (JSValue object, char const *property_name) const |
JSWrappedValue | get_global_obj () const |
JSWrappedValue | get_global_property (const char *s) const |
JSWrappedValue | get_or_create_global_property (const char *s, JSWrappedValue default_value) const |
JSWrappedValue | get_typed_array_buffer (const JSWrappedValue &obj, size_t *pbyte_offset, size_t *pbyte_length, size_t *pbytes_per_element) const |
JSWrappedValue | get_exported_function (const std::string &code, const std::string &func, const std::string &path) |
JSWrappedValue | get_exported_function (const JSWrappedValue &module, const std::string &func, const std::string &path) |
JSWrappedValue | null () const |
JSWrappedValue | undefined () const |
JSWrappedValue | new_obj () const |
JSWrappedValue | new_obj_class (JSClassID class_id) const |
JSWrappedValue | new_array () const |
JSWrappedValue | new_array_buffer_copy (const uint8_t *buf, size_t buf_len) const |
JSWrappedValue | new_array_buffer_copy (const char *buf, size_t buf_len) const |
JSWrappedValue | new_array_buffer_copy (std::span< const uint8_t > data) const |
JSWrappedValue | new_string (const std::string_view &str) const |
JSWrappedValue | new_string_len (const char *buf, size_t buf_len) const |
JSWrappedValue | new_string_len (const std::span< const uint8_t > buf) const |
JSWrappedValue | new_type_error (const char *fmt,...) const |
JSWrappedValue | new_internal_error (const char *fmt,...) const |
JSWrappedValue | new_tag_value (int tag, int32_t val=0) const |
JSWrappedValue | new_c_function (JSCFunction *func, const char *name, int length) const |
JSWrappedValue | new_getter_c_function (JSCFunction *func, const char *name, size_t arg_count=0) const |
JSWrappedValue | duplicate_value (JSValueConst original) const |
JSWrappedValue | eval (const char *input, size_t input_len, const char *filename, int eval_flags) const |
JSWrappedValue | read_object (const uint8_t *buf, size_t buf_len, int flags) const |
JSWrappedValue | call_with_rt_options (const JSWrappedValue &f, const std::vector< JSWrappedValue > &argv, const std::optional< ccf::JSRuntimeOptions > &options, RuntimeLimitsPolicy policy) |
JSWrappedValue | inner_call (const JSWrappedValue &f, const std::vector< JSWrappedValue > &argv) |
JSWrappedValue | json_stringify (const JSWrappedValue &obj) const |
JSWrappedValue | parse_json (const nlohmann::json &j) const |
JSWrappedValue | parse_json (const char *buf, size_t buf_len, const char *filename) const |
std::optional< std::string > | to_str (const JSWrappedValue &x) const |
std::optional< std::string > | to_str (const JSValue &x) const |
std::optional< std::string > | to_str (const JSValue &x, size_t &len) const |
std::optional< std::string > | to_str (const JSAtom &atom) const |
void | add_extension (const js::extensions::ExtensionPtr &extension) |
bool | remove_extension (const js::extensions::ExtensionPtr &extension) |
template<typename TExtension > | |
TExtension * | get_extension () |
Public Attributes | |
ccf::pal::Mutex | lock |
const TxAccess | access |
InterruptData | interrupt_data |
bool | log_execution_metrics = true |
ccf::js::core::Context::Context | ( | TxAccess | acc | ) |
|
virtual |
|
delete |
void ccf::js::core::Context::add_extension | ( | const js::extensions::ExtensionPtr & | extension | ) |
JSWrappedValue ccf::js::core::Context::call_with_rt_options | ( | const JSWrappedValue & | f, |
const std::vector< JSWrappedValue > & | argv, | ||
const std::optional< ccf::JSRuntimeOptions > & | options, | ||
RuntimeLimitsPolicy | policy | ||
) |
JSWrappedValue ccf::js::core::Context::duplicate_value | ( | JSValueConst | original | ) | const |
std::pair< std::string, std::optional< std::string > > ccf::js::core::Context::error_message | ( | ) |
JSWrappedValue ccf::js::core::Context::eval | ( | const char * | input, |
size_t | input_len, | ||
const char * | filename, | ||
int | eval_flags | ||
) | const |
JSValue ccf::js::core::Context::extract_string_array | ( | JSValueConst & | argv, |
std::vector< std::string > & | out | ||
) |
JSWrappedValue ccf::js::core::Context::get_exported_function | ( | const JSWrappedValue & | module, |
const std::string & | func, | ||
const std::string & | path | ||
) |
JSWrappedValue ccf::js::core::Context::get_exported_function | ( | const std::string & | code, |
const std::string & | func, | ||
const std::string & | path | ||
) |
|
inline |
JSWrappedValue ccf::js::core::Context::get_global_obj | ( | ) | const |
JSWrappedValue ccf::js::core::Context::get_global_property | ( | const char * | s | ) | const |
|
virtual |
JSWrappedValue ccf::js::core::Context::get_or_create_global_property | ( | const char * | s, |
JSWrappedValue | default_value | ||
) | const |
JSWrappedValue ccf::js::core::Context::get_property | ( | JSValue | object, |
char const * | property_name | ||
) | const |
JSWrappedValue ccf::js::core::Context::get_typed_array_buffer | ( | const JSWrappedValue & | obj, |
size_t * | pbyte_offset, | ||
size_t * | pbyte_length, | ||
size_t * | pbytes_per_element | ||
) | const |
JSWrappedValue ccf::js::core::Context::inner_call | ( | const JSWrappedValue & | f, |
const std::vector< JSWrappedValue > & | argv | ||
) |
JSWrappedValue ccf::js::core::Context::json_stringify | ( | const JSWrappedValue & | obj | ) | const |
JSWrappedValue ccf::js::core::Context::new_array | ( | ) | const |
JSWrappedValue ccf::js::core::Context::new_array_buffer_copy | ( | const char * | buf, |
size_t | buf_len | ||
) | const |
JSWrappedValue ccf::js::core::Context::new_array_buffer_copy | ( | const uint8_t * | buf, |
size_t | buf_len | ||
) | const |
JSWrappedValue ccf::js::core::Context::new_array_buffer_copy | ( | std::span< const uint8_t > | data | ) | const |
JSWrappedValue ccf::js::core::Context::new_c_function | ( | JSCFunction * | func, |
const char * | name, | ||
int | length | ||
) | const |
JSWrappedValue ccf::js::core::Context::new_getter_c_function | ( | JSCFunction * | func, |
const char * | name, | ||
size_t | arg_count = 0 |
||
) | const |
JSWrappedValue ccf::js::core::Context::new_internal_error | ( | const char * | fmt, |
... | |||
) | const |
JSWrappedValue ccf::js::core::Context::new_obj | ( | ) | const |
JSWrappedValue ccf::js::core::Context::new_obj_class | ( | JSClassID | class_id | ) | const |
JSWrappedValue ccf::js::core::Context::new_string | ( | const std::string_view & | str | ) | const |
JSWrappedValue ccf::js::core::Context::new_string_len | ( | const char * | buf, |
size_t | buf_len | ||
) | const |
JSWrappedValue ccf::js::core::Context::new_string_len | ( | const std::span< const uint8_t > | buf | ) | const |
JSWrappedValue ccf::js::core::Context::new_tag_value | ( | int | tag, |
int32_t | val = 0 |
||
) | const |
JSWrappedValue ccf::js::core::Context::new_type_error | ( | const char * | fmt, |
... | |||
) | const |
JSWrappedValue ccf::js::core::Context::null | ( | ) | const |
|
inline |
JSWrappedValue ccf::js::core::Context::parse_json | ( | const char * | buf, |
size_t | buf_len, | ||
const char * | filename | ||
) | const |
JSWrappedValue ccf::js::core::Context::parse_json | ( | const nlohmann::json & | j | ) | const |
JSWrappedValue ccf::js::core::Context::read_object | ( | const uint8_t * | buf, |
size_t | buf_len, | ||
int | flags | ||
) | const |
bool ccf::js::core::Context::remove_extension | ( | const js::extensions::ExtensionPtr & | extension | ) |
|
inline |
|
inline |
std::optional< std::string > ccf::js::core::Context::to_str | ( | const JSAtom & | atom | ) | const |
std::optional< std::string > ccf::js::core::Context::to_str | ( | const JSValue & | x | ) | const |
std::optional< std::string > ccf::js::core::Context::to_str | ( | const JSValue & | x, |
size_t & | len | ||
) | const |
std::optional< std::string > ccf::js::core::Context::to_str | ( | const JSWrappedValue & | x | ) | const |
JSWrappedValue ccf::js::core::Context::undefined | ( | ) | const |
JSWrappedValue ccf::js::core::Context::wrap | ( | const JSValue & | val | ) | const |
JSWrappedValue ccf::js::core::Context::wrap | ( | JSValue && | val | ) | const |
const TxAccess ccf::js::core::Context::access |
InterruptData ccf::js::core::Context::interrupt_data |
ccf::pal::Mutex ccf::js::core::Context::lock |
bool ccf::js::core::Context::log_execution_metrics = true |