v8toolkit
0.0.1
Utility library for embedding V8 Javascript engine in a c++ program
|
#include <vector>
#include <string>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <regex>
#include <fmt/ostream.h>
#include "clang.h"
#include "class_parser.h"
#include "wrapped_class.h"
#include "ast_action.h"
#include "ast_consumer.h"
#include "annotations.h"
#include "class_handler.h"
#include "parsed_method.h"
Go to the source code of this file.
Classes | |
struct | ClassTemplate |
struct | FunctionTemplate |
Macros | |
#define | TEMPLATE_FILTER_STD |
#define | TEMPLATED_CLASS_PRINT_THRESHOLD 10 |
#define | TEMPLATED_FUNCTION_PRINT_THRESHOLD 100 |
Functions | |
void | print_vector (const vector< string > &vec, const string &header, const string &indentation, bool ignore_empty) |
bool | is_good_record_decl (const CXXRecordDecl *decl) |
std::string | get_include_string_for_fileid (CompilerInstance &compiler_instance, FileID &file_id) |
std::string | get_include_for_source_location (CompilerInstance &compiler_instance, const SourceLocation &source_location) |
std::string | get_include_for_type_decl (CompilerInstance &compiler_instance, const TypeDecl *type_decl) |
std::string | get_source_for_source_range (SourceManager &sm, SourceRange source_range) |
bool | has_wrapped_class (const CXXRecordDecl *decl) |
string | get_sfinae_matching_wrapped_classes (const vector< unique_ptr< WrappedClass >> &wrapped_classes) |
std::string | get_type_string (QualType qual_type, const std::string &indentation) |
vector< string > | get_default_argument_values (CompilerInstance &compiler_instance, const CXXMethodDecl *method, const string &annotation="") |
vector< QualType > | get_method_param_qual_types (CompilerInstance &compiler_instance, const CXXMethodDecl *method, string const &annotation) |
vector< string > | generate_variable_names (vector< QualType > qual_types, bool with_std_move) |
void | print_specialization_info (const CXXRecordDecl *decl) |
Variables | |
bool | generate_v8classwrapper_sfinae = true |
vector< string > | base_types_to_ignore = {"class v8toolkit::WrappedClassBase", "class Subscriber"} |
vector< string > | types_to_ignore_regex = {"^struct has_custom_process[<].*[>]::mixin$"} |
vector< string > | includes_for_every_class_wrapper_file = {"\"js_casts.h\"", "<v8toolkit/v8_class_wrapper_impl.h>"} |
string | header_for_every_class_wrapper_file = "#define NEED_BIDIRECTIONAL_TYPES\n#undef V8TOOLKIT_WRAPPER_FAST_COMPILE\n" |
vector< string > | never_include_for_any_file = {"\"v8helpers.h\""} |
map< string, string > | static_method_renames = {{"name", "get_name"}} |
map< string, string > | cpp_to_js_type_conversions |
std::string | js_api_header |
int | print_logging = 1 |
int | matched_classes_returned = 0 |
vector< std::unique_ptr< ClassTemplate > > | class_templates |
vector< unique_ptr< FunctionTemplate > > | function_templates |
std::vector< std::string > | used_constructor_names |
map< string, int > | template_instantiations |
#define TEMPLATE_FILTER_STD |
Definition at line 52 of file class_parser.cpp.
#define TEMPLATED_CLASS_PRINT_THRESHOLD 10 |
Definition at line 54 of file class_parser.cpp.
Referenced by generate_bidirectional_classes().
#define TEMPLATED_FUNCTION_PRINT_THRESHOLD 100 |
Definition at line 55 of file class_parser.cpp.
Referenced by generate_bidirectional_classes().
void print_vector | ( | const vector< string > & | vec, |
const string & | header, | ||
const string & | indentation, | ||
bool | ignore_empty | ||
) |
Definition at line 200 of file class_parser.cpp.
Referenced by ClassFunction::TypeInfo::get_jsdoc_type_name(), print_specialization_info(), and WrappedClass::WrappedClass().
bool is_good_record_decl | ( | const CXXRecordDecl * | decl | ) |
Definition at line 221 of file class_parser.cpp.
References is_good_record_decl().
Referenced by is_good_record_decl(), and ClassHandler::run().
std::string get_include_string_for_fileid | ( | CompilerInstance & | compiler_instance, |
FileID & | file_id | ||
) |
Definition at line 244 of file class_parser.cpp.
Referenced by get_include_for_source_location(), and ClassHandler::run().
std::string get_include_for_source_location | ( | CompilerInstance & | compiler_instance, |
const SourceLocation & | source_location | ||
) |
Definition at line 270 of file class_parser.cpp.
References get_include_string_for_fileid().
Referenced by get_include_for_type_decl().
std::string get_include_for_type_decl | ( | CompilerInstance & | compiler_instance, |
const TypeDecl * | type_decl | ||
) |
Definition at line 277 of file class_parser.cpp.
References get_include_for_source_location().
Referenced by update_wrapped_class_for_type(), and WrappedClass::WrappedClass().
std::string get_source_for_source_range | ( | SourceManager & | sm, |
SourceRange | source_range | ||
) |
Definition at line 295 of file class_parser.cpp.
References print_logging.
Referenced by ClassFunction::ClassFunction(), get_default_argument_values(), and ClassFunction::ParameterInfo::ParameterInfo().
bool has_wrapped_class | ( | const CXXRecordDecl * | decl | ) |
Definition at line 429 of file class_parser.cpp.
References get_canonical_name_for_decl().
Referenced by update_wrapped_class_for_type().
string get_sfinae_matching_wrapped_classes | ( | const vector< unique_ptr< WrappedClass >> & | wrapped_classes | ) |
Definition at line 445 of file class_parser.cpp.
References FOUND_INHERITANCE, join(), and print_logging.
std::string get_type_string | ( | QualType | qual_type, |
const std::string & | indentation | ||
) |
Definition at line 557 of file class_parser.cpp.
References get_type_string(), and print_logging.
Referenced by ClassFunction::get_default_argument_tuple_string(), get_type_string(), ClassHandler::onEndOfTranslationUnit(), and WrappedClass::parse_all_methods().
vector<string> get_default_argument_values | ( | CompilerInstance & | compiler_instance, |
const CXXMethodDecl * | method, | ||
const string & | annotation = "" |
||
) |
Returns a vector of the default value for each parameter for the method - if there is no default parameter, an empty string is returned in that position (which is different than a default parameter of an empty string which would be returned as the string '""'
Definition at line 742 of file class_parser.cpp.
References get_source_for_source_range().
vector<QualType> get_method_param_qual_types | ( | CompilerInstance & | compiler_instance, |
const CXXMethodDecl * | method, | ||
string const & | annotation | ||
) |
Definition at line 763 of file class_parser.cpp.
References Annotations::has(), and print_logging.
Referenced by generate_bidirectional_classes().
vector<string> generate_variable_names | ( | vector< QualType > | qual_types, |
bool | with_std_move | ||
) |
Definition at line 783 of file class_parser.cpp.
Referenced by generate_bidirectional_classes().
void print_specialization_info | ( | const CXXRecordDecl * | decl | ) |
Definition at line 800 of file class_parser.cpp.
References get_canonical_name_for_decl(), and print_vector().
Referenced by ClassHandler::run().
bool generate_v8classwrapper_sfinae = true |
Definition at line 59 of file class_parser.cpp.
vector< string > base_types_to_ignore = {"class v8toolkit::WrappedClassBase", "class Subscriber"} |
Definition at line 62 of file class_parser.cpp.
Referenced by WrappedClass::get_base_class_string(), and WrappedClass::WrappedClass().
vector<string> types_to_ignore_regex = {"^struct has_custom_process[<].*[>]::mixin$"} |
Definition at line 66 of file class_parser.cpp.
vector<string> includes_for_every_class_wrapper_file = {"\"js_casts.h\"", "<v8toolkit/v8_class_wrapper_impl.h>"} |
Definition at line 68 of file class_parser.cpp.
Referenced by write_classes().
string header_for_every_class_wrapper_file = "#define NEED_BIDIRECTIONAL_TYPES\n#undef V8TOOLKIT_WRAPPER_FAST_COMPILE\n" |
Definition at line 72 of file class_parser.cpp.
Referenced by write_classes().
vector<string> never_include_for_any_file = {"\"v8helpers.h\""} |
Definition at line 75 of file class_parser.cpp.
Referenced by write_classes().
map<string, string> static_method_renames = {{"name", "get_name"}} |
Definition at line 79 of file class_parser.cpp.
Referenced by StaticFunction::StaticFunction().
map<string, string> cpp_to_js_type_conversions |
Definition at line 82 of file class_parser.cpp.
Referenced by ClassFunction::TypeInfo::TypeInfo().
std::string js_api_header |
Definition at line 96 of file class_parser.cpp.
Referenced by generate_javascript_stub().
int print_logging = 1 |
Definition at line 161 of file class_parser.cpp.
Referenced by ClassFunction::TypeInfo::for_each_templated_type(), foreach_constructor(), get_method_param_qual_types(), get_sfinae_matching_wrapped_classes(), get_source_for_source_range(), get_type_string(), PrintLoggingGuard::log(), WrappedClass::parse_all_methods(), ClassHandler::run(), update_wrapped_class_for_type(), WrappedClass::WrappedClass(), write_classes(), and PrintLoggingGuard::~PrintLoggingGuard().
int matched_classes_returned = 0 |
Definition at line 172 of file class_parser.cpp.
Referenced by generate_bindings(), and ClassHandler::run().
vector<std::unique_ptr<ClassTemplate> > class_templates |
Definition at line 352 of file class_parser.cpp.
Referenced by generate_bidirectional_classes().
vector<unique_ptr<FunctionTemplate> > function_templates |
Definition at line 379 of file class_parser.cpp.
Referenced by generate_bidirectional_classes().
std::vector<std::string> used_constructor_names |
Definition at line 410 of file class_parser.cpp.
Referenced by ConstructorFunction::ConstructorFunction().
map<string, int> template_instantiations |
Definition at line 896 of file class_parser.cpp.
Referenced by WrappedClass::WrappedClass().