v8toolkit  0.0.1
Utility library for embedding V8 Javascript engine in a c++ program
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
WrappedClass Class Reference

#include <wrapped_class.h>

Inheritance diagram for WrappedClass:
Inheritance graph
[legend]
Collaboration diagram for WrappedClass:
Collaboration graph
[legend]

Public Types

enum  EnumClass { EnumClass::A, EnumClass::B, EnumClass::C, EnumClass::D }
 

Public Member Functions

 WrappedClass (int a, int b=2, int c=3, WrappedClass *wc_ptr=nullptr)
 
int simple_member_function (char const *some_string="asdf")
 
void std_function_default_parameter (std::function< void()> some_function=std::function< void()>())
 
template<class A = int, int b = 4>
void templated_method ()
 
void after_templated_method ()
 
void parse_all_methods ()
 
set< unique_ptr< MemberFunction > > const & get_member_functions ()
 
set< unique_ptr< StaticFunction > > const & get_static_functions ()
 
set< unique_ptr< DataMember > > & get_members ()
 
set< unique_ptr< ConstructorFunction > > const & get_constructors ()
 
void set_error (string const &error_message)
 
std::string get_short_name () const
 
bool has_static_method ()
 
bool is_template_specialization ()
 
void foreach_inheritance_level (function< void(WrappedClass &)> callback)
 
void add_member_name (string const &name)
 
void add_static_name (string const &name)
 
void update_data ()
 
std::string make_sfinae_to_match_wrapped_class () const
 
bool should_be_wrapped () const
 
bool ready_for_wrapping (set< WrappedClass * > dumped_classes) const
 
std::set< stringget_base_type_includes ()
 
std::set< stringget_derived_type_includes ()
 
 WrappedClass (const WrappedClass &)=delete
 
WrappedClassoperator= (const WrappedClass &)=delete
 
 WrappedClass (const std::string class_name, CompilerInstance &compiler_instance)
 
 WrappedClass (const CXXRecordDecl *decl, CompilerInstance &compiler_instance, FOUND_METHOD found_method)
 
std::string generate_js_stub ()
 
std::string get_derived_classes_string (int level=0, const std::string indent="")
 
std::string get_base_class_string ()
 
std::string get_bindings ()
 
bool found_method_means_wrapped ()
 
 WrappedClass ()=default
 
 WrappedClass (WrappedClass const &)=default
 
 WrappedClass (WrappedClass &&)=default
 
virtual ~WrappedClass ()
 
int takes_int_5 (int x)
 
int takes_const_int_6 (int const x) const
 
void default_parameters (int j=1, char const *s="asdf", vector< std::string > &&={}, CopyableWrappedClass={}, CopyableWrappedClass &&={}, CopyableWrappedClass *=nullptr)
 

Static Public Member Functions

static V8TOOLKIT_EXTEND_WRAPPER void extend_wrapper ()
 
static V8TOOLKIT_CUSTOM_EXTENSION void custom_extension ()
 
static std::string simple_static_function (double some_double)
 
static void insert_wrapped_class (WrappedClass *wrapped_class)
 
static WrappedClassget_if_exists (const CXXRecordDecl *decl)
 
static WrappedClassget_or_insert_wrapped_class (const CXXRecordDecl *decl, CompilerInstance &compiler_instance, FOUND_METHOD found_method)
 
static std::string static_method ()
 

Public Attributes

double double_member_readwrite
 
V8TOOLKIT_READONLY double double_member_readonly1
 
double const double_member_readonly2
 
std::vector< std::string > vector_of_ints
 
std::vector< WrappedClass * > vector_of_selfs
 
CXXRecordDecl const * decl = nullptr
 
CXXRecordDecl const * instantiation_pattern = nullptr
 
string class_name
 
string name_alias
 this is the possibly shortened javascript name of the type - not necessarily valid in generated c++ More...
 
set< stringinclude_files
 
int declaration_count = 3
 
string my_header_filename = ""
 
set< stringused_member_names
 
set< stringused_static_names
 
vector< stringdata_errors
 
set< WrappedClass * > derived_types
 
set< WrappedClass * > base_types
 tracked base_types - if it's more than one, that's a data error because javascript only allows one More...
 
set< stringwrapper_extension_methods
 
set< stringwrapper_custom_extensions
 
CompilerInstance & compiler_instance
 
string my_include
 
bool done = false
 
bool valid = false
 
Annotations annotations
 
bool dumped = false
 
set< WrappedClass * > used_classes
 
FOUND_METHOD found_method
 
bool force_no_constructors = false
 
bool bidirectional = false
 
CXXConstructorDecl const * bidirectional_constructor = nullptr
 
int i = 5
 
int ci = 5
 
std::unique_ptr< float > upf = std::make_unique<float>(3.5)
 
std::unique_ptr< float > cupf = std::make_unique<float>(4.5)
 
std::string string = "string value"
 
bool default_parameters_called = false
 
CopyableWrappedClass copyable_wrapped_class
 
std::unique_ptr< WrappedClassup_wrapped_class
 

Static Public Attributes

static vector< WrappedClass * > wrapped_classes
 

Detailed Description

Definition at line 55 of file sample.cpp.

Member Enumeration Documentation

Enumerator

Definition at line 72 of file sample.cpp.

Constructor & Destructor Documentation

WrappedClass::WrappedClass ( int  a,
int  b = 2,
int  c = 3,
WrappedClass wc_ptr = nullptr 
)
WrappedClass::WrappedClass ( const WrappedClass )
delete
WrappedClass::WrappedClass ( const std::string  class_name,
CompilerInstance &  compiler_instance 
)

Definition at line 488 of file wrapped_class.cpp.

References wrapped_classes.

WrappedClass::WrappedClass ( const CXXRecordDecl *  decl,
CompilerInstance &  compiler_instance,
FOUND_METHOD  found_method 
)
WrappedClass::WrappedClass ( )
default

Referenced by get_or_insert_wrapped_class(), make_sfinae_to_match_wrapped_class(), and WrappedClass().

Here is the caller graph for this function:

WrappedClass::WrappedClass ( WrappedClass const &  )
default
WrappedClass::WrappedClass ( WrappedClass &&  )
default
virtual WrappedClass::~WrappedClass ( )
inlinevirtual

Definition at line 27 of file wrapped_types_test.cpp.

Member Function Documentation

static V8TOOLKIT_EXTEND_WRAPPER void WrappedClass::extend_wrapper ( )
static
static V8TOOLKIT_CUSTOM_EXTENSION void WrappedClass::custom_extension ( )
static
int WrappedClass::simple_member_function ( char const *  some_string = "asdf")
static std::string WrappedClass::simple_static_function ( double  some_double)
static
void WrappedClass::std_function_default_parameter ( std::function< void()>  some_function = std::function< void()>())
template<class A = int, int b = 4>
void WrappedClass::templated_method ( )
void WrappedClass::after_templated_method ( )
void WrappedClass::parse_all_methods ( )
set< unique_ptr< MemberFunction > > const & WrappedClass::get_member_functions ( )

Definition at line 239 of file wrapped_class.cpp.

References parse_all_methods().

Referenced by generate_js_stub(), and get_bindings().

Here is the call graph for this function:

Here is the caller graph for this function:

set< unique_ptr< StaticFunction > > const & WrappedClass::get_static_functions ( )

Definition at line 245 of file wrapped_class.cpp.

References parse_all_methods().

Referenced by generate_js_stub(), and get_bindings().

Here is the call graph for this function:

Here is the caller graph for this function:

set< unique_ptr< DataMember > > & WrappedClass::get_members ( )

Definition at line 456 of file wrapped_class.cpp.

References decl, EXPORT_ALL, EXPORT_EXCEPT, foreach_inheritance_level(), get_export_type(), and PRINT_SKIPPED_EXPORT_REASONS.

Referenced by generate_js_stub().

Here is the call graph for this function:

Here is the caller graph for this function:

set< unique_ptr< ConstructorFunction > > const & WrappedClass::get_constructors ( )

Definition at line 233 of file wrapped_class.cpp.

References parse_all_methods().

Referenced by generate_js_stub(), and get_bindings().

Here is the call graph for this function:

Here is the caller graph for this function:

void WrappedClass::set_error ( string const &  error_message)

Definition at line 729 of file wrapped_class.cpp.

References data_errors, and valid.

Referenced by add_member_name(), add_static_name(), and WrappedClass().

Here is the caller graph for this function:

std::string WrappedClass::get_short_name ( ) const
inline

Definition at line 88 of file wrapped_class.h.

Referenced by ClassHandler::run().

Here is the caller graph for this function:

bool WrappedClass::has_static_method ( )
inline

Definition at line 95 of file wrapped_class.h.

References add_member_name(), add_static_name(), foreach_inheritance_level(), and is_template_specialization().

Referenced by get_bindings(), and ClassHandler::run().

Here is the call graph for this function:

Here is the caller graph for this function:

bool WrappedClass::is_template_specialization ( )
Returns
whether this type is a specialization of a template

Definition at line 779 of file wrapped_class.cpp.

References decl.

Referenced by has_static_method().

Here is the caller graph for this function:

void WrappedClass::foreach_inheritance_level ( function< void(WrappedClass &)>  callback)
Parameters
callbackcalled on each parameterized type for this template specialization

Definition at line 442 of file wrapped_class.cpp.

References base_types.

Referenced by get_members(), and has_static_method().

Here is the caller graph for this function:

void WrappedClass::add_member_name ( string const &  name)

Sets a member name as being in use and sets valid = false if it was already in use For member functions and data members (not constructors or static methods)

Parameters
namename to add

Definition at line 710 of file wrapped_class.cpp.

References set_error(), and used_member_names.

Referenced by DataMember::DataMember(), has_static_method(), and MemberFunction::MemberFunction().

Here is the call graph for this function:

Here is the caller graph for this function:

void WrappedClass::add_static_name ( string const &  name)

Definition at line 718 of file wrapped_class.cpp.

References set_error(), and used_static_names.

Referenced by has_static_method(), and StaticFunction::StaticFunction().

Here is the call graph for this function:

Here is the caller graph for this function:

void WrappedClass::update_data ( )
inline

Definition at line 118 of file wrapped_class.h.

References decl, Annotations::get(), and Annotations::names_for_record_decls.

Here is the call graph for this function:

std::string WrappedClass::make_sfinae_to_match_wrapped_class ( ) const
inline
bool WrappedClass::should_be_wrapped ( ) const
bool WrappedClass::ready_for_wrapping ( set< WrappedClass * >  dumped_classes) const

Definition at line 617 of file wrapped_class.cpp.

References base_types, class_name, and should_be_wrapped().

Referenced by make_sfinae_to_match_wrapped_class().

Here is the call graph for this function:

Here is the caller graph for this function:

std::set< string > WrappedClass::get_base_type_includes ( )

Definition at line 737 of file wrapped_class.cpp.

References base_types, include_files, and my_include.

Referenced by make_sfinae_to_match_wrapped_class().

Here is the caller graph for this function:

std::set< string > WrappedClass::get_derived_type_includes ( )

Definition at line 757 of file wrapped_class.cpp.

References derived_types, join(), my_include, and name_alias.

Referenced by make_sfinae_to_match_wrapped_class().

Here is the call graph for this function:

Here is the caller graph for this function:

WrappedClass& WrappedClass::operator= ( const WrappedClass )
delete

Referenced by make_sfinae_to_match_wrapped_class().

Here is the caller graph for this function:

std::string WrappedClass::generate_js_stub ( )

Definition at line 501 of file wrapped_class.cpp.

References base_types, get_constructors(), get_member_functions(), get_members(), get_static_functions(), and name_alias.

Referenced by make_sfinae_to_match_wrapped_class().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string WrappedClass::get_derived_classes_string ( int  level = 0,
const std::string  indent = "" 
)
inline

Definition at line 166 of file wrapped_class.h.

References join().

Referenced by get_bindings().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string WrappedClass::get_base_class_string ( )
inline

Definition at line 178 of file wrapped_class.h.

References base_types_to_ignore, data_error(), get_bindings(), and i.

Referenced by get_bindings().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string WrappedClass::get_bindings ( )
static void WrappedClass::insert_wrapped_class ( WrappedClass wrapped_class)
inlinestatic

Definition at line 197 of file wrapped_class.h.

References wrapped_classes.

Referenced by ClassHandler::run(), and WrappedClass().

Here is the caller graph for this function:

static WrappedClass* WrappedClass::get_if_exists ( const CXXRecordDecl *  decl)
inlinestatic

Returns the wrapped class corresponding to the decl if it exists

Parameters
declthe decl to search for in existing wrapped classes
Returns
the existing wrapped class or nullptr if no match found

Definition at line 206 of file wrapped_class.h.

References wrapped_classes.

Referenced by ClassHandler::run().

Here is the caller graph for this function:

static WrappedClass& WrappedClass::get_or_insert_wrapped_class ( const CXXRecordDecl *  decl,
CompilerInstance &  compiler_instance,
FOUND_METHOD  found_method 
)
inlinestatic

Definition at line 218 of file wrapped_class.h.

References FOUND_BASE_CLASS, found_method_means_wrapped(), get_canonical_name_for_decl(), wrapped_classes, and WrappedClass().

Referenced by ClassHandler::run(), update_wrapped_class_for_type(), and WrappedClass().

Here is the call graph for this function:

Here is the caller graph for this function:

bool WrappedClass::found_method_means_wrapped ( )

Definition at line 788 of file wrapped_class.cpp.

References FOUND_ANNOTATION, FOUND_BASE_CLASS, FOUND_GENERATED, FOUND_INHERITANCE, and found_method.

Referenced by get_or_insert_wrapped_class(), and WrappedClass().

Here is the caller graph for this function:

int WrappedClass::takes_int_5 ( int  x)
inline

Definition at line 36 of file wrapped_types_test.cpp.

References EXPECT_EQ.

Referenced by WrappedClassFixture::WrappedClassFixture().

Here is the caller graph for this function:

int WrappedClass::takes_const_int_6 ( int const  x) const
inline

Definition at line 40 of file wrapped_types_test.cpp.

References EXPECT_EQ.

Referenced by WrappedClassFixture::WrappedClassFixture().

Here is the caller graph for this function:

void WrappedClass::default_parameters ( int  j = 1,
char const *  s = "asdf",
vector< std::string > &&  = {},
CopyableWrappedClass  = {},
CopyableWrappedClass &&  = {},
CopyableWrappedClass = nullptr 
)
inline

Definition at line 47 of file wrapped_types_test.cpp.

References EXPECT_EQ, and EXPECT_STREQ.

Referenced by WrappedClassFixture::WrappedClassFixture().

Here is the caller graph for this function:

static std::string WrappedClass::static_method ( )
inlinestatic

Definition at line 58 of file wrapped_types_test.cpp.

Referenced by WrappedClassFixture::WrappedClassFixture().

Here is the caller graph for this function:

Member Data Documentation

double WrappedClass::double_member_readwrite

Definition at line 58 of file sample.cpp.

V8TOOLKIT_READONLY double WrappedClass::double_member_readonly1

Definition at line 59 of file sample.cpp.

double const WrappedClass::double_member_readonly2

Definition at line 60 of file sample.cpp.

std::vector<std::string> WrappedClass::vector_of_ints

Definition at line 61 of file sample.cpp.

std::vector<WrappedClass *> WrappedClass::vector_of_selfs

Definition at line 62 of file sample.cpp.

vector< WrappedClass * > WrappedClass::wrapped_classes
static
CXXRecordDecl const* WrappedClass::decl = nullptr
CXXRecordDecl const* WrappedClass::instantiation_pattern = nullptr

Definition at line 34 of file wrapped_class.h.

string WrappedClass::class_name
string WrappedClass::name_alias
set<string> WrappedClass::include_files
int WrappedClass::declaration_count = 3

Definition at line 52 of file wrapped_class.h.

Referenced by ClassFunction::ClassFunction(), and DataMember::DataMember().

string WrappedClass::my_header_filename = ""

Definition at line 54 of file wrapped_class.h.

set<string> WrappedClass::used_member_names

Definition at line 61 of file wrapped_class.h.

Referenced by add_member_name().

set<string> WrappedClass::used_static_names

Definition at line 62 of file wrapped_class.h.

Referenced by add_static_name().

vector<string> WrappedClass::data_errors

Definition at line 63 of file wrapped_class.h.

Referenced by set_error().

set<WrappedClass *> WrappedClass::derived_types
set<WrappedClass *> WrappedClass::base_types

tracked base_types - if it's more than one, that's a data error because javascript only allows one

Definition at line 67 of file wrapped_class.h.

Referenced by foreach_inheritance_level(), generate_js_stub(), get_base_type_includes(), ready_for_wrapping(), should_be_wrapped(), and WrappedClass().

set<string> WrappedClass::wrapper_extension_methods

Definition at line 69 of file wrapped_class.h.

Referenced by get_bindings(), and parse_all_methods().

set<string> WrappedClass::wrapper_custom_extensions

Definition at line 70 of file wrapped_class.h.

Referenced by get_bindings(), and parse_all_methods().

CompilerInstance& WrappedClass::compiler_instance

Definition at line 71 of file wrapped_class.h.

Referenced by update_wrapped_class_for_type().

string WrappedClass::my_include

Definition at line 73 of file wrapped_class.h.

Referenced by get_base_type_includes(), get_derived_type_includes(), and WrappedClass().

bool WrappedClass::done = false

Definition at line 74 of file wrapped_class.h.

bool WrappedClass::valid = false

Definition at line 75 of file wrapped_class.h.

Referenced by set_error().

Annotations WrappedClass::annotations
bool WrappedClass::dumped = false

Definition at line 77 of file wrapped_class.h.

set<WrappedClass *> WrappedClass::used_classes

Definition at line 78 of file wrapped_class.h.

Referenced by update_wrapped_class_for_type().

FOUND_METHOD WrappedClass::found_method
bool WrappedClass::force_no_constructors = false

Definition at line 80 of file wrapped_class.h.

Referenced by parse_all_methods(), and ClassHandler::run().

bool WrappedClass::bidirectional = false

Definition at line 85 of file wrapped_class.h.

Referenced by WrappedClass().

CXXConstructorDecl const* WrappedClass::bidirectional_constructor = nullptr

Definition at line 86 of file wrapped_class.h.

Referenced by WrappedClass().

int WrappedClass::i = 5
int WrappedClass::ci = 5

Definition at line 30 of file wrapped_types_test.cpp.

Referenced by WrappedClassFixture::WrappedClassFixture().

std::unique_ptr<float> WrappedClass::upf = std::make_unique<float>(3.5)

Definition at line 31 of file wrapped_types_test.cpp.

Referenced by WrappedClassFixture::WrappedClassFixture().

std::unique_ptr<float> WrappedClass::cupf = std::make_unique<float>(4.5)

Definition at line 32 of file wrapped_types_test.cpp.

Referenced by WrappedClassFixture::WrappedClassFixture().

std::string WrappedClass::string = "string value"

Definition at line 34 of file wrapped_types_test.cpp.

Referenced by WrappedClassFixture::WrappedClassFixture().

bool WrappedClass::default_parameters_called = false

Definition at line 45 of file wrapped_types_test.cpp.

Referenced by TEST_F().

CopyableWrappedClass WrappedClass::copyable_wrapped_class

Definition at line 60 of file wrapped_types_test.cpp.

Referenced by WrappedClassFixture::WrappedClassFixture().

std::unique_ptr<WrappedClass> WrappedClass::up_wrapped_class

Definition at line 61 of file wrapped_types_test.cpp.

Referenced by WrappedClassFixture::WrappedClassFixture().


The documentation for this class was generated from the following files: