MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
shcore::polyglot Namespace Reference

Namespaces

namespace  anonymous_namespace{jit_executor_type_conversion.cc}
 
namespace  anonymous_namespace{polyglot_array_wrapper.cc}
 
namespace  anonymous_namespace{polyglot_column.cc}
 
namespace  anonymous_namespace{polyglot_common_context.cc}
 
namespace  anonymous_namespace{polyglot_date.cc}
 
namespace  anonymous_namespace{polyglot_error.cc}
 
namespace  anonymous_namespace{polyglot_file_system_wrapper.cc}
 
namespace  anonymous_namespace{polyglot_function_wrapper.cc}
 
namespace  anonymous_namespace{polyglot_iterator_wrapper.cc}
 
namespace  anonymous_namespace{polyglot_map_wrapper.cc}
 
namespace  anonymous_namespace{polyglot_object_wrapper.cc}
 
namespace  anonymous_namespace{polyglot_result.cc}
 
namespace  anonymous_namespace{polyglot_row.cc}
 
namespace  anonymous_namespace{polyglot_seekable_channel_wrapper.cc}
 
namespace  anonymous_namespace{polyglot_session.cc}
 
namespace  anonymous_namespace{polyglot_utils.cc}
 
namespace  database
 

Classes

class  Closed_channel_exception
 
class  Collectable
 Represents a data object to be associated to a Polyglot wrapper for C++ elements. More...
 
class  Collectable_registry
 When a Polyglot wrapper for a C++ object is created, a collectable instance is created to be passed to the Polyglot object (Java). More...
 
class  Column
 
class  Date
 
class  Directory_not_empty_exception
 
class  File_already_exists_exception
 
class  File_system_exception
 
class  Garbage_collector
 The Garbage Collection logic is determined by the occurrence of events such as: More...
 
class  ICollectable
 Base collectable interface to be able to determine the type of a collectable object without with no need to cast it. More...
 
class  IDirectory_stream
 
class  IFile_system
 
class  Illegal_argument_exception
 
class  IO_exception
 
class  IPolyglot_iterator
 
class  ISeekable_channel
 
class  Java_script_interface
 
class  Jit_executor_exception
 
class  No_such_file_exception
 
class  Not_directory_exception
 
class  Object_bridge
 
class  Object_method
 
class  Polyglot_array_wrapper
 
class  Polyglot_common_context
 Common context for GraalVM Languages. More...
 
class  Polyglot_error
 Represents polyglot errors that will be created from information available in the polyglot library state, it handles cases like: More...
 
class  Polyglot_file_system_wrapper
 
class  Polyglot_function
 Utility class to allow wrapping a Polyglot function to be used from C++. More...
 
class  Polyglot_function_wrapper
 
class  Polyglot_generic_error
 This class is used to represent errors occurred in the polyglot library while executing one of the functions in the API. More...
 
class  Polyglot_iterator_wrapper
 
class  Polyglot_language
 The polyglot library may support several languages (guest languages), and provides out of the box C++ interfaces to handle common language elements, such as Objects, Maps, Arrays, Functions and primitive data types. More...
 
class  Polyglot_map_wrapper
 
class  Polyglot_method_wrapper
 
class  Polyglot_native_wrapper
 Exposure of C++ objects to the polyglot library is done through the usage of Proxy objects provided by the polyglot library. More...
 
class  Polyglot_object
 Utility class to allow wrapping a Polyglot object to be used from the C++. More...
 
class  Polyglot_object_wrapper
 
class  Polyglot_scope
 Utility class to create a polyglot handle scope which is wiped out as soon as the instance goes out of scope in C++, this is used to avoid polluting the main scope with references preventing garbage collection from cleaning no longer needed objects. More...
 
class  Polyglot_seekable_channel_wrapper
 
class  Polyglot_storage
 A container for stored values. More...
 
struct  Polyglot_type_bridger
 
class  PolyResult
 
class  Row
 
class  Scoped_global
 Allows creating a temporary global variable with a random name which will only live until the execution context of the instance of this class ends. More...
 
class  Security_exception
 
class  Session
 
class  Store
 Helper class to handle polyglot values made permanent. More...
 
class  Unsupported_operation_exception
 

Typedefs

typedef std::shared_ptr< Object_bridgeObject_bridge_t
 

Enumerations

enum class  Collectable_type {
  OBJECT , FUNCTION , METHOD , ARRAY ,
  MAP , ITERATOR
}
 
enum class  Language { JAVASCRIPT }
 

Functions

template<typename F , typename... Args>
void throw_if_error (F f, poly_thread thread, Args &&...args)
 
size_t parse_callback_args (poly_thread thread, poly_callback_info args, std::vector< poly_value > *argv, void **data)
 Parses the callback information sent by polyglot, returning if requested a vector with the arguments as well as the collectable associated to the call. More...
 
bool get_data (poly_thread thread, poly_callback_info args, std::string_view name, void **data)
 Returns the collectable sent by Polyglot on a call to a C++ function. More...
 
bool get_args_and_data (poly_thread thread, poly_callback_info args, std::string_view name, void **data, size_t expected_argc, std::vector< poly_value > *argv)
 Returns the collectable and arguments sent by Polyglot on a call to a C++ function. More...
 
bool is_native_type (poly_thread thread, poly_value value, Collectable_type type, void **native_data=nullptr)
 Identifies if a given poly_value corresponds to a wrapped C++ element. More...
 
std::string to_string (poly_thread thread, poly_value obj)
 Converts a polyglot string into a C++ string. More...
 
int64_t to_int (poly_thread thread, poly_value obj)
 Converts a polyglot string into a C++ int64_t. More...
 
double to_double (poly_thread thread, poly_value obj)
 Converts a polyglot string into a C++ double. More...
 
double to_boolean (poly_thread thread, poly_value obj)
 Converts a polyglot string into a C++ double. More...
 
poly_value poly_string (poly_thread thread, poly_context context, std::string_view data)
 Converts a string into a polyglot string. More...
 
poly_value poly_bool (poly_thread thread, poly_context context, bool value)
 Converts a bool into a polyglot boolean. More...
 
poly_value poly_int (poly_thread thread, poly_context context, int64_t value)
 Converts a bool into a polyglot boolean. More...
 
poly_value poly_uint (poly_thread thread, poly_context context, uint64_t value)
 Converts a bool into a polyglot boolean. More...
 
poly_value poly_double (poly_thread thread, poly_context context, double value)
 Converts a double into a polyglot double. More...
 
poly_value poly_null (poly_thread thread, poly_context context)
 Returns a polyglot null value. More...
 
poly_value poly_array (poly_thread thread, poly_context context, const std::vector< poly_value > &values)
 Converts an array of poly_values into a polyglot array. More...
 
std::vector< std::string > get_member_keys (poly_thread thread, poly_context context, poly_value object)
 Retrieves the names of the members of the given poly_value. More...
 
void throw_callback_exception (poly_thread thread, const char *error)
 The integration of the PolyglotAPI is mostly centered in the registration of C++ callbacks to implement the functionality for the different proxy objects. More...
 
poly_value get_member (poly_thread thread, poly_value object, const std::string &name)
 Retrieves a member identified with name from the given object. More...
 
bool is_executable (poly_thread thread, poly_value object)
 Returns true if the given value is executable. More...
 
bool get_member (poly_thread thread, poly_value object, const char *name, poly_value *member)
 
bool is_object (poly_thread thread, poly_value object, std::string *class_name)
 
template<typename Target , typename Config >
static poly_value polyglot_handler_fixed_args (poly_thread thread, poly_callback_info args)
 Generic handler to be used with functions that interact with the polyglot library, this is: More...
 
template<typename Target , typename Config >
static poly_value native_handler_fixed_args (poly_thread thread, poly_callback_info args)
 Generic handler to be used with pure native functions, no interaction with the polyglot library is done: More...
 
template<typename Target , typename Config >
static poly_value polyglot_handler_no_args (poly_thread thread, poly_callback_info args)
 Generic handler to be used with functions that interact with the polyglot library: More...
 
template<typename Target , typename Config >
static poly_value native_handler_no_args (poly_thread thread, poly_callback_info args)
 Generic handler to be used with pure native functions, no interaction with the polyglot library is done: More...
 
template<typename Target , typename Config >
static poly_value native_handler_variable_args (poly_thread thread, poly_callback_info args)
 Generic handler to be used with pure native functions, no interaction with the polyglot library is done: More...
 

Variables

const char * k_key_message {"message"}
 
const char * k_origin_shell {"(shell)"}
 
const char * k_syntax_error {"SyntaxError"}
 
const char * k_interrupted_error {"InterruptedError"}
 

Typedef Documentation

◆ Object_bridge_t

Enumeration Type Documentation

◆ Collectable_type

Enumerator
OBJECT 
FUNCTION 
METHOD 
ARRAY 
MAP 
ITERATOR 

◆ Language

enum class shcore::polyglot::Language
strong
Enumerator
JAVASCRIPT 

Function Documentation

◆ get_args_and_data()

bool shcore::polyglot::get_args_and_data ( poly_thread  thread,
poly_callback_info  args,
std::string_view  name,
void **  data,
size_t  expected_argc,
std::vector< poly_value > *  argv 
)

Returns the collectable and arguments sent by Polyglot on a call to a C++ function.

This function is meant to be used in C++ functions that expect a specific number of arguments since it centralizes a validation to ensure the expected arguments were received.

◆ get_data()

bool shcore::polyglot::get_data ( poly_thread  thread,
poly_callback_info  args,
std::string_view  name,
void **  data 
)

Returns the collectable sent by Polyglot on a call to a C++ function.

This function is meant to be used in C++ functions that have no arguments.

It also centralizes a validation to ensure no arguments are sent by Polyglot.

◆ get_member() [1/2]

bool shcore::polyglot::get_member ( poly_thread  thread,
poly_value  object,
const char *  name,
poly_value *  member 
)

◆ get_member() [2/2]

poly_value shcore::polyglot::get_member ( poly_thread  thread,
poly_value  object,
const std::string &  name 
)

Retrieves a member identified with name from the given object.

◆ get_member_keys()

std::vector< std::string > shcore::polyglot::get_member_keys ( poly_thread  thread,
poly_context  context,
poly_value  object 
)

Retrieves the names of the members of the given poly_value.

◆ is_executable()

bool shcore::polyglot::is_executable ( poly_thread  thread,
poly_value  object 
)

Returns true if the given value is executable.

◆ is_native_type()

bool shcore::polyglot::is_native_type ( poly_thread  thread,
poly_value  value,
Collectable_type  type,
void **  native_data 
)

Identifies if a given poly_value corresponds to a wrapped C++ element.

◆ is_object()

bool shcore::polyglot::is_object ( poly_thread  thread,
poly_value  object,
std::string *  class_name 
)

◆ native_handler_fixed_args()

template<typename Target , typename Config >
static poly_value shcore::polyglot::native_handler_fixed_args ( poly_thread  thread,
poly_callback_info  args 
)
static

Generic handler to be used with pure native functions, no interaction with the polyglot library is done:

  • Receive a vector of Values as arguments
  • Return a Value as result

◆ native_handler_no_args()

template<typename Target , typename Config >
static poly_value shcore::polyglot::native_handler_no_args ( poly_thread  thread,
poly_callback_info  args 
)
static

Generic handler to be used with pure native functions, no interaction with the polyglot library is done:

  • Receive no arguments
  • Return a Value as result

◆ native_handler_variable_args()

template<typename Target , typename Config >
static poly_value shcore::polyglot::native_handler_variable_args ( poly_thread  thread,
poly_callback_info  args 
)
static

Generic handler to be used with pure native functions, no interaction with the polyglot library is done:

  • Receive a vector of Values as arguments
  • Return a Value as result

◆ parse_callback_args()

size_t shcore::polyglot::parse_callback_args ( poly_thread  thread,
poly_callback_info  args,
std::vector< poly_value > *  argv,
void **  data 
)

Parses the callback information sent by polyglot, returning if requested a vector with the arguments as well as the collectable associated to the call.

Returns the collectable and arguments sent by Polyglot on a call to a C++ function.

This function is meant to be used by a C++ function that does not require to validate the argument count.

◆ poly_array()

poly_value shcore::polyglot::poly_array ( poly_thread  thread,
poly_context  context,
const std::vector< poly_value > &  values 
)

Converts an array of poly_values into a polyglot array.

◆ poly_bool()

poly_value shcore::polyglot::poly_bool ( poly_thread  thread,
poly_context  context,
bool  value 
)

Converts a bool into a polyglot boolean.

◆ poly_double()

poly_value shcore::polyglot::poly_double ( poly_thread  thread,
poly_context  context,
double  value 
)

Converts a double into a polyglot double.

◆ poly_int()

poly_value shcore::polyglot::poly_int ( poly_thread  thread,
poly_context  context,
int64_t  value 
)

Converts a bool into a polyglot boolean.

◆ poly_null()

poly_value shcore::polyglot::poly_null ( poly_thread  thread,
poly_context  context 
)

Returns a polyglot null value.

◆ poly_string()

poly_value shcore::polyglot::poly_string ( poly_thread  thread,
poly_context  context,
std::string_view  data 
)

Converts a string into a polyglot string.

◆ poly_uint()

poly_value shcore::polyglot::poly_uint ( poly_thread  thread,
poly_context  context,
uint64_t  value 
)

Converts a bool into a polyglot boolean.

◆ polyglot_handler_fixed_args()

template<typename Target , typename Config >
static poly_value shcore::polyglot::polyglot_handler_fixed_args ( poly_thread  thread,
poly_callback_info  args 
)
static

Generic handler to be used with functions that interact with the polyglot library, this is:

  • Require the language instance for the execution
  • Receive a vector of polyglot values as arguments
  • Return a polyglot value as result

◆ polyglot_handler_no_args()

template<typename Target , typename Config >
static poly_value shcore::polyglot::polyglot_handler_no_args ( poly_thread  thread,
poly_callback_info  args 
)
static

Generic handler to be used with functions that interact with the polyglot library:

  • Receive no arguments
  • Return a poly_value as result

◆ throw_callback_exception()

void shcore::polyglot::throw_callback_exception ( poly_thread  thread,
const char *  error 
)

The integration of the PolyglotAPI is mostly centered in the registration of C++ callbacks to implement the functionality for the different proxy objects.

Whenever an exception is reported from any of these callbacks, a CallbackException object is created in the PolyglotAPI.

This function is to report a callback exception from C++.

◆ throw_if_error()

template<typename F , typename... Args>
void shcore::polyglot::throw_if_error ( F  f,
poly_thread  thread,
Args &&...  args 
)
inline

◆ to_boolean()

double shcore::polyglot::to_boolean ( poly_thread  thread,
poly_value  obj 
)

Converts a polyglot string into a C++ double.

◆ to_double()

double shcore::polyglot::to_double ( poly_thread  thread,
poly_value  obj 
)

Converts a polyglot string into a C++ double.

◆ to_int()

int64_t shcore::polyglot::to_int ( poly_thread  thread,
poly_value  obj 
)

Converts a polyglot string into a C++ int64_t.

◆ to_string()

std::string shcore::polyglot::to_string ( poly_thread  thread,
poly_value  obj 
)

Converts a polyglot string into a C++ string.

Variable Documentation

◆ k_interrupted_error

const char* shcore::polyglot::k_interrupted_error {"InterruptedError"}
inline

◆ k_key_message

const char* shcore::polyglot::k_key_message {"message"}
inline

◆ k_origin_shell

const char* shcore::polyglot::k_origin_shell {"(shell)"}
inline

◆ k_syntax_error

const char* shcore::polyglot::k_syntax_error {"SyntaxError"}
inline