v8toolkit  0.0.1
Utility library for embedding V8 Javascript engine in a c++ program
Classes | Namespaces | Macros | Typedefs | Functions | Variables
v8_class_wrapper.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <type_traits>
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
#include <assert.h>
#include <EASTL/vector_map.h>
#include "wrapped_class_base.h"
#include "v8toolkit.h"
#include "casts.hpp"
#include "v8_class_wrapper_impl.h"
Include dependency graph for v8_class_wrapper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  v8toolkit::DestructorBehavior
 
struct  v8toolkit::DestructorBehavior_Delete< T >
 
struct  v8toolkit::DestructorBehavior_LeaveAlone
 
struct  v8toolkit::TypeCheckerBase< T >
 
struct  v8toolkit::WrapAsMostDerivedBase< T >
 
struct  v8toolkit::WrapAsMostDerived< class, class, class >
 
struct  v8toolkit::WrapAsMostDerived< T, TypeList<> >
 
struct  v8toolkit::WrapAsMostDerived< T, TypeList< Head, Tail... >, std::enable_if_t<!std::is_const< T >::value||std::is_const< Head >::value > >
 
struct  v8toolkit::WrapAsMostDerived< T, TypeList< Head, Tail... >, std::enable_if_t< std::is_const< T >::value &&!std::is_const< Head >::value > >
 
struct  v8toolkit::TypeChecker< class, class, class >
 
struct  v8toolkit::TypeChecker< T, TypeList<> >
 
struct  v8toolkit::TypeChecker< T, v8toolkit::TypeList< Head, Tail... >, std::enable_if_t<!std::is_const< T >::value &&std::is_const< Head >::value > >
 
struct  v8toolkit::TypeChecker< T, v8toolkit::TypeList< Head, Tail... >, std::enable_if_t< std::is_const< T >::value||!std::is_const< Head >::value > >
 
class  v8toolkit::V8ClassWrapperInstanceRegistry
 
class  v8toolkit::V8ClassWrapper< T >
 
class  v8toolkit::V8ClassWrapper< T, V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE >
 
struct  v8toolkit::V8ClassWrapper< T, V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE >::NamedPropertyCallbackData
 
class  v8toolkit::V8ClassWrapper< T, V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE >::NoResultAvailable
 
class  v8toolkit::JSWrapper< T >
 
struct  v8toolkit::CastToJS< T, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToJS< std::unique_ptr< T, Rest... >, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToJS< T *, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToJS< T &, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToJS< T &&, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToNative< T, std::enable_if_t<!std::is_const_v< T > &&std::is_copy_constructible< T >::value &&is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToNative< T, std::enable_if_t<!std::is_copy_constructible< T >::value &&is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToNative< T &, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToNative< T &&, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToNative< T *, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::CastToNative< std::unique_ptr< T, Rest... >, std::enable_if_t< is_wrapped_type_v< T > > >
 
struct  v8toolkit::ParameterBuilder< T, std::enable_if_t< std::is_reference_v< T > &&is_wrapped_type_v< std::remove_reference_t< T > > > >
 
struct  v8toolkit::ParameterBuilder< T, std::enable_if_t< std::is_copy_constructible_v< T > &&is_wrapped_type_v< T > > >
 

Namespaces

 v8toolkit
 

Macros

#define USE_EASTL_FOR_INTERNALS
 
#define V8TOOLKIT_DEBUG(format_string, ...)
 
#define V8TOOLKIT_V8CLASSWRAPPER_NO_POINTER_NO_REFERENCE_SFINAE   !std::is_pointer<T>::value && !std::is_reference<T>::value
 
#define V8TOOLKIT_V8CLASSWRAPPER_FULL_TEMPLATE_SFINAE_PREFIX   std::is_base_of<WrappedClassBase, T>::value
 
#define V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE
 
#define V8TOOLKIT_V8CLASSWRAPPER_USE_FAKE_TEMPLATE_SFINAE
 

Typedefs

template<class... ArgTs>
using MapT = eastl::vector_map< ArgTs... >
 

Functions

template<class T >
std::string v8toolkit::type_details ()
 
template<class T , std::enable_if_t< std::is_pointer< T >::value||std::is_reference< T >::value, int > = 0>
T & v8toolkit::get_object_from_embedded_cpp_object (v8::Isolate *isolate, v8::Local< v8::Value > value)
 

Variables

V8ClassWrapperInstanceRegistry v8toolkit::wrapper_registery
 
std::map< v8::Isolate *, std::vector< std::string > > v8toolkit::used_constructor_name_list_map
 

Class Documentation

struct v8toolkit::WrapAsMostDerived

template<class, class, class = void>
struct v8toolkit::WrapAsMostDerived< class, class, class >

Definition at line 160 of file v8_class_wrapper.h.

struct v8toolkit::TypeChecker

template<class, class, class = void>
struct v8toolkit::TypeChecker< class, class, class >

Definition at line 190 of file v8_class_wrapper.h.

class v8toolkit::V8ClassWrapper

template<class T>
class v8toolkit::V8ClassWrapper< T >

Provides a mechanism for creating javascript-ready objects from an arbitrary C++ class Can provide a JS constructor method or wrap objects created in another c++ function

Const types should not be wrapped directly. Instead, a const version of a non-const type will automatically be created and populated with read-only members and any const-qualified method added to the non-const version.

All members/methods must be added, then finalize() called, then any desired constructors may be created.

Definition at line 16 of file sample2.h.

struct v8toolkit::V8ClassWrapper< T, V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE >::NamedPropertyCallbackData

template<class T>
struct v8toolkit::V8ClassWrapper< T, V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE >::NamedPropertyCallbackData

Definition at line 1477 of file v8_class_wrapper.h.

Collaboration diagram for v8toolkit::V8ClassWrapper< T, V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE >::NamedPropertyCallbackData:
Class Members
T * cpp_object
function< void(Local< Name >
property_name,
PropertyCallbackInfo< Value >
const &)>
getter
function< void(Local< Name >
property_name, Local< Value >
new_property_value,
PropertyCallbackInfo< Value >
const &)>
setter

Macro Definition Documentation

#define USE_EASTL_FOR_INTERNALS

Definition at line 15 of file v8_class_wrapper.h.

#define V8TOOLKIT_DEBUG (   format_string,
  ... 
)
#define V8TOOLKIT_V8CLASSWRAPPER_NO_POINTER_NO_REFERENCE_SFINAE   !std::is_pointer<T>::value && !std::is_reference<T>::value

Definition at line 276 of file v8_class_wrapper.h.

#define V8TOOLKIT_V8CLASSWRAPPER_FULL_TEMPLATE_SFINAE_PREFIX   std::is_base_of<WrappedClassBase, T>::value

Definition at line 278 of file v8_class_wrapper.h.

#define V8TOOLKIT_V8CLASSWRAPPER_USE_REAL_TEMPLATE_SFINAE
Value:
#define V8TOOLKIT_V8CLASSWRAPPER_FULL_TEMPLATE_SFINAE_PREFIX
#define V8TOOLKIT_V8CLASSWRAPPER_NO_POINTER_NO_REFERENCE_SFINAE

Allows user to specify a list of types to instantiate real V8ClassWrapper template for – CastToNative/CastToJS will otherwise try to instantiate it for a very large number of types which can drastically slow down compilation. Setting an explicit value for this is NOT required - it is just a compile-time, compile-RAM (and maybe binary size) optimizatioan

Definition at line 297 of file v8_class_wrapper.h.

#define V8TOOLKIT_V8CLASSWRAPPER_USE_FAKE_TEMPLATE_SFINAE
Value:
#define V8TOOLKIT_V8CLASSWRAPPER_FULL_TEMPLATE_SFINAE_PREFIX
#define V8TOOLKIT_V8CLASSWRAPPER_NO_POINTER_NO_REFERENCE_SFINAE

Definition at line 301 of file v8_class_wrapper.h.

Typedef Documentation

template<class... ArgTs>
using MapT = eastl::vector_map<ArgTs...>

Definition at line 20 of file v8_class_wrapper.h.