64 void print_vector(
const vector<string> & vec,
const string & header =
"",
const string & indentation =
"",
bool ignore_empty =
true);
72 const CXXMethodDecl * method,
73 bool add_leading_comma =
false,
74 bool insert_variable_names =
false,
75 const string & annotation =
"");
82 void write_classes(
int file_count, vector<WrappedClass*> & classes,
bool last_one);
86 const CXXMethodDecl * method,
87 string const & annotation =
"");
97 template<
class Callback>
103 const CXXMethodDecl * method);
114 bool logging =
false;
123 if (logging ==
true) {
136 if (source.empty()) {
140 if (leading_between) {
144 for (
auto & str : source) {
149 if (!first) { result << between;}
160 template<
class Callback>
164 if (klass ==
nullptr) {
165 cerr << fmt::format(
"Skipping foreach_constructor because decl was nullptr") << endl;
169 string class_name = klass->getNameAsString();
170 if (
print_logging) cerr <<
"Enumerating constructors for " << class_name <<
" with optional annotation: " << annotation << endl;
172 for(CXXMethodDecl * method : klass->methods()) {
173 CXXConstructorDecl * constructor = dyn_cast<CXXConstructorDecl>(method);
178 if (constructor ==
nullptr) {
183 if (constructor->getAccess() != AS_public) {
184 if (
print_logging) cerr <<
" Skipping non-public constructor" << endl;
188 if (
print_logging) cerr <<
" Skipping constructor marked for begin skipped" << endl;
192 if (annotation !=
"" && !annotations.
has(annotation)) {
193 if (
print_logging) cerr <<
" Annotation " << annotation <<
" requested, but constructor doesn't have it" << endl;
197 if (
print_logging) cerr <<
" Annotation " << annotation <<
" found, but constructor skipped for reason(s) listed above" << endl;
205 if (
print_logging) cerr <<
" Running callback on constructor" << endl;
206 callback(constructor);
209 cerr << fmt::format(
"Done enumerating constructors for {}", class_name) << endl;
void print_vector(const vector< string > &vec, const string &header="", const string &indentation="", bool ignore_empty=true)
std::string js_api_header
void update_wrapped_class_for_type(WrappedClass &wrapped_class, QualType qual_type)
string header_for_every_class_wrapper_file
EXPORT_TYPE get_export_type(const NamedDecl *decl, EXPORT_TYPE previous=EXPORT_UNSPECIFIED)
PrintLoggingGuard()=default
void write_classes(int file_count, vector< WrappedClass * > &classes, bool last_one)
void data_warning(const string &warning)
bool has_wrapped_class(const CXXRecordDecl *decl)
std::string get_type_string(QualType qual_type, const std::string &indentation="")
void generate_javascript_stub(string const &)
vector< string > includes_for_every_class_wrapper_file
std::string get_method_string(CompilerInstance &compiler_instance, WrappedClass &wrapped_class, const CXXMethodDecl *method)
vector< string > data_warnings
map< string, string > cpp_to_js_type_conversions
void generate_bidirectional_classes(CompilerInstance &compiler_instance)
QualType get_plain_type(QualType qual_type)
void print_specialization_info(const CXXRecordDecl *decl)
std::string get_canonical_name_for_decl(const TypeDecl *decl)
std::string get_include_string_for_fileid(CompilerInstance &compiler_instance, FileID &file_id)
std::vector< std::string > used_constructor_names
vector< string > base_types_to_ignore
vector< string > data_errors
std::string get_source_for_source_range(SourceManager &sm, SourceRange source_range)
vector< string > types_to_ignore_regex
bool has(const std::string &target) const
int matched_classes_returned
map< string, string > static_method_renames
std::string get_include_for_type_decl(CompilerInstance &compiler_instance, const TypeDecl *type_decl)
CXXRecordDecl const * decl
map< string, int > template_instantiations
std::string join(const T &source, const std::string &between=", ", bool leading_between=false)
CompilerInstance & compiler_instance
vector< string > never_include_for_any_file
void data_error(const string &error)
vector< QualType > get_method_param_qual_types(CompilerInstance &compiler_instance, const CXXMethodDecl *method, string const &annotation="")
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 foreach_constructor(const CXXRecordDecl *klass, Callback &&callback, const std::string &annotation="")
vector< string > generate_variable_names(vector< QualType > qual_types, bool with_std_move=false)
bool is_good_record_decl(const CXXRecordDecl *decl)