v8toolkit
0.0.1
Utility library for embedding V8 Javascript engine in a c++ program
|
#include <map>
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include "clang.h"
#include "annotations.h"
Go to the source code of this file.
Classes | |
class | PrintLoggingGuard |
Enumerations | |
enum | FOUND_METHOD { FOUND_UNSPECIFIED = 0, FOUND_ANNOTATION, FOUND_INHERITANCE, FOUND_GENERATED, FOUND_BASE_CLASS, FOUND_NEVER_WRAP } |
enum | EXPORT_TYPE { EXPORT_UNSPECIFIED = 0, EXPORT_NONE, EXPORT_SOME, EXPORT_EXCEPT, EXPORT_ALL } |
Functions | |
bool | has_wrapped_class (const CXXRecordDecl *decl) |
EXPORT_TYPE | get_export_type (const NamedDecl *decl, EXPORT_TYPE previous=EXPORT_UNSPECIFIED) |
template<class T > | |
std::string | join (const T &source, const std::string &between=", ", bool leading_between=false) |
void | data_error (const string &error) |
void | data_warning (const string &warning) |
QualType | get_plain_type (QualType qual_type) |
std::string | get_include_for_type_decl (CompilerInstance &compiler_instance, const TypeDecl *type_decl) |
void | print_vector (const vector< string > &vec, const string &header="", const string &indentation="", bool ignore_empty=true) |
std::string | get_source_for_source_range (SourceManager &sm, SourceRange source_range) |
std::string | get_canonical_name_for_decl (const TypeDecl *decl) |
bool | is_good_record_decl (const CXXRecordDecl *decl) |
std::string | get_include_string_for_fileid (CompilerInstance &compiler_instance, FileID &file_id) |
std::string | get_method_parameters (CompilerInstance &compiler_instance, WrappedClass &wrapped_class, const CXXMethodDecl *method, bool add_leading_comma=false, bool insert_variable_names=false, const string &annotation="") |
void | update_wrapped_class_for_type (WrappedClass &wrapped_class, QualType qual_type) |
void | write_classes (int file_count, vector< WrappedClass * > &classes, bool last_one) |
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=false) |
void | print_specialization_info (const CXXRecordDecl *decl) |
std::string | get_type_string (QualType qual_type, const std::string &indentation="") |
template<class Callback > | |
void | foreach_constructor (const CXXRecordDecl *klass, Callback &&callback, const std::string &annotation="") |
std::string | get_method_string (CompilerInstance &compiler_instance, WrappedClass &wrapped_class, const CXXMethodDecl *method) |
void | generate_javascript_stub (string const &) |
void | generate_bidirectional_classes (CompilerInstance &compiler_instance) |
void | generate_bindings () |
Variables | |
map< string, string > | cpp_to_js_type_conversions |
vector< string > | base_types_to_ignore |
int | print_logging |
map< string, string > | static_method_renames |
map< string, int > | template_instantiations |
vector< string > | types_to_ignore_regex |
std::vector< std::string > | used_constructor_names |
int | matched_classes_returned |
vector< string > | data_warnings |
vector< string > | data_errors |
std::string | js_api_header |
vector< string > | never_include_for_any_file |
string | header_for_every_class_wrapper_file |
vector< string > | includes_for_every_class_wrapper_file |
enum FOUND_METHOD |
Enumerator | |
---|---|
FOUND_UNSPECIFIED | |
FOUND_ANNOTATION | |
FOUND_INHERITANCE | |
FOUND_GENERATED | |
FOUND_BASE_CLASS | |
FOUND_NEVER_WRAP |
Definition at line 39 of file helper_functions.h.
enum EXPORT_TYPE |
Enumerator | |
---|---|
EXPORT_UNSPECIFIED | |
EXPORT_NONE | |
EXPORT_SOME | |
EXPORT_EXCEPT | |
EXPORT_ALL |
Definition at line 49 of file helper_functions.h.
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().
EXPORT_TYPE get_export_type | ( | const NamedDecl * | decl, |
EXPORT_TYPE | previous = EXPORT_UNSPECIFIED |
||
) |
Definition at line 118 of file helper_functions.cpp.
References data_error(), EXPORT_ALL, EXPORT_EXCEPT, EXPORT_NONE, EXPORT_SOME, get_canonical_name_for_decl(), V8TOOLKIT_ALL_STRING, and V8TOOLKIT_NONE_STRING.
Referenced by foreach_constructor(), WrappedClass::get_members(), ClassHandler::onEndOfTranslationUnit(), and WrappedClass::parse_all_methods().
std::string join | ( | const T & | source, |
const std::string & | between = ", " , |
||
bool | leading_between = false |
||
) |
Definition at line 135 of file helper_functions.h.
Referenced by generate_bidirectional_classes(), WrappedClass::get_derived_classes_string(), WrappedClass::get_derived_type_includes(), get_sfinae_matching_wrapped_classes(), and WrappedClass::should_be_wrapped().
void data_error | ( | const string & | error | ) |
Definition at line 202 of file helper_functions.cpp.
Referenced by ConstructorFunction::ConstructorFunction(), WrappedClass::get_base_class_string(), get_export_type(), ClassHandler::onEndOfTranslationUnit(), WrappedClass::parse_all_methods(), WrappedClass::should_be_wrapped(), and WrappedClass::WrappedClass().
void data_warning | ( | const string & | warning | ) |
Definition at line 208 of file helper_functions.cpp.
Referenced by ClassFunction::ClassFunction(), and ClassFunction::ParameterInfo::ParameterInfo().
QualType get_plain_type | ( | QualType | qual_type | ) |
Definition at line 213 of file helper_functions.cpp.
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().
void print_vector | ( | const vector< string > & | vec, |
const string & | header = "" , |
||
const string & | indentation = "" , |
||
bool | ignore_empty = true |
||
) |
Definition at line 200 of file class_parser.cpp.
Referenced by ClassFunction::TypeInfo::get_jsdoc_type_name(), print_specialization_info(), 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().
std::string get_canonical_name_for_decl | ( | const TypeDecl * | decl | ) |
Definition at line 174 of file helper_functions.cpp.
Referenced by Annotations::Annotations(), get_export_type(), WrappedClass::get_or_insert_wrapped_class(), has_wrapped_class(), print_specialization_info(), ClassHandler::run(), 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_method_parameters | ( | CompilerInstance & | compiler_instance, |
WrappedClass & | wrapped_class, | ||
const CXXMethodDecl * | method, | ||
bool | add_leading_comma = false , |
||
bool | insert_variable_names = false , |
||
const string & | annotation = "" |
||
) |
void update_wrapped_class_for_type | ( | WrappedClass & | wrapped_class, |
QualType | qual_type | ||
) |
Definition at line 21 of file helper_functions.cpp.
References WrappedClass::class_name, WrappedClass::compiler_instance, FOUND_UNSPECIFIED, get_include_for_type_decl(), WrappedClass::get_or_insert_wrapped_class(), has_wrapped_class(), WrappedClass::include_files, WrappedClass::name_alias, print_logging, update_wrapped_class_for_type(), and WrappedClass::used_classes.
Referenced by ClassFunction::ClassFunction(), DataMember::DataMember(), ClassHandler::onEndOfTranslationUnit(), update_wrapped_class_for_type(), and WrappedClass::WrappedClass().
void write_classes | ( | int | file_count, |
vector< WrappedClass * > & | classes, | ||
bool | last_one | ||
) |
Definition at line 14 of file ast_action.cpp.
References header_for_every_class_wrapper_file, includes_for_every_class_wrapper_file, never_include_for_any_file, and print_logging.
Referenced by generate_bindings().
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 = false |
||
) |
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().
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().
void foreach_constructor | ( | const CXXRecordDecl * | klass, |
Callback && | callback, | ||
const std::string & | annotation = "" |
||
) |
Definition at line 161 of file helper_functions.h.
References EXPORT_NONE, get_export_type(), Annotations::has(), and print_logging.
Referenced by WrappedClass::WrappedClass().
std::string get_method_string | ( | CompilerInstance & | compiler_instance, |
WrappedClass & | wrapped_class, | ||
const CXXMethodDecl * | method | ||
) |
void generate_javascript_stub | ( | string const & | ) |
Definition at line 343 of file helper_functions.cpp.
References js_api_header, and WrappedClass::wrapped_classes.
Referenced by ClassHandler::onEndOfTranslationUnit().
void generate_bidirectional_classes | ( | CompilerInstance & | compiler_instance | ) |
Definition at line 366 of file helper_functions.cpp.
References class_templates, function_templates, generate_variable_names(), get_method_param_qual_types(), join(), make_macro_safe_comma(), ClassFunction::parameters, TEMPLATED_CLASS_PRINT_THRESHOLD, TEMPLATED_FUNCTION_PRINT_THRESHOLD, and WrappedClass::wrapped_classes.
Referenced by ClassHandler::onEndOfTranslationUnit().
void generate_bindings | ( | ) |
Definition at line 223 of file helper_functions.cpp.
References matched_classes_returned, MAX_DECLARATIONS_PER_FILE, WrappedClass::wrapped_classes, and write_classes().
Referenced by ClassHandler::onEndOfTranslationUnit().
map<string, string> cpp_to_js_type_conversions |
Definition at line 82 of file class_parser.cpp.
Referenced by ClassFunction::TypeInfo::TypeInfo().
vector<string> base_types_to_ignore |
Definition at line 25 of file helper_functions.h.
Referenced by WrappedClass::get_base_class_string(), and WrappedClass::WrappedClass().
int print_logging |
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().
map<string, string> static_method_renames |
Definition at line 79 of file class_parser.cpp.
Referenced by StaticFunction::StaticFunction().
map<string, int> template_instantiations |
Definition at line 896 of file class_parser.cpp.
Referenced by WrappedClass::WrappedClass().
vector<string> types_to_ignore_regex |
Definition at line 66 of file class_parser.cpp.
std::vector<std::string> used_constructor_names |
Definition at line 410 of file class_parser.cpp.
Referenced by ConstructorFunction::ConstructorFunction().
int matched_classes_returned |
Definition at line 172 of file class_parser.cpp.
Referenced by generate_bindings(), and ClassHandler::run().
vector<string> data_warnings |
Definition at line 207 of file helper_functions.cpp.
Referenced by ClassHandler::onEndOfTranslationUnit().
vector<string> data_errors |
Definition at line 201 of file helper_functions.cpp.
Referenced by ClassHandler::onEndOfTranslationUnit().
std::string js_api_header |
Definition at line 96 of file class_parser.cpp.
Referenced by generate_javascript_stub().
vector<string> never_include_for_any_file |
Definition at line 75 of file class_parser.cpp.
Referenced by write_classes().
string header_for_every_class_wrapper_file |
Definition at line 72 of file class_parser.cpp.
Referenced by write_classes().
vector<string> includes_for_every_class_wrapper_file |
Definition at line 68 of file class_parser.cpp.
Referenced by write_classes().