Fix Java interface with SplitSource.
This commit is contained in:
parent
ac74ecaad5
commit
a7f8ff6eef
@ -168,7 +168,7 @@ static jint register_native(JavaVM *vm) {
|
|||||||
#undef TD_OBJECT
|
#undef TD_OBJECT
|
||||||
|
|
||||||
td::jni::init_vars(env, PACKAGE_NAME);
|
td::jni::init_vars(env, PACKAGE_NAME);
|
||||||
td::td_api::set_package_name(PACKAGE_NAME);
|
td::td_api::get_package_name_ref() = PACKAGE_NAME;
|
||||||
|
|
||||||
return JAVA_VERSION;
|
return JAVA_VERSION;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ class DoxygenTlDocumentationGenerator extends TlDocumentationGenerator
|
|||||||
strpos($tline, 'result += ') === 0 || strpos($tline, 'result = ') || strpos($tline, ' : values') ||
|
strpos($tline, 'result += ') === 0 || strpos($tline, 'result = ') || strpos($tline, ' : values') ||
|
||||||
strpos($line, 'JNIEnv') || strpos($line, 'jfieldID') || $tline === 'virtual ~Object() {' ||
|
strpos($line, 'JNIEnv') || strpos($line, 'jfieldID') || $tline === 'virtual ~Object() {' ||
|
||||||
$tline === 'virtual void store(TlStorerToString &s, const char *field_name) const = 0;' ||
|
$tline === 'virtual void store(TlStorerToString &s, const char *field_name) const = 0;' ||
|
||||||
$tline === 'void set_package_name(const char *new_package_name);';
|
$tline === 'const char *&get_package_name_ref();';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isHeaderLine($line)
|
protected function isHeaderLine($line)
|
||||||
|
@ -13,9 +13,9 @@ namespace td {
|
|||||||
|
|
||||||
std::string TD_TL_writer_jni_cpp::gen_output_begin_once() const {
|
std::string TD_TL_writer_jni_cpp::gen_output_begin_once() const {
|
||||||
return TD_TL_writer_cpp::gen_output_begin_once() +
|
return TD_TL_writer_cpp::gen_output_begin_once() +
|
||||||
"\nstatic const char *package_name = \"Call set_package_name\";\n\n"
|
"\nconst char *&get_package_name_ref() {\n"
|
||||||
"void set_package_name(const char *new_package_name) {\n"
|
" static const char *package_name = \"Package name must be initialized first\";\n"
|
||||||
" package_name = new_package_name;\n"
|
" return package_name;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ std::string TD_TL_writer_jni_cpp::gen_basic_java_class_name(std::string name) co
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string TD_TL_writer_jni_cpp::gen_java_class_name(std::string name) const {
|
std::string TD_TL_writer_jni_cpp::gen_java_class_name(std::string name) const {
|
||||||
return "(PSLICE() << package_name << \"/TdApi$" + gen_basic_java_class_name(name) + "\").c_str()";
|
return "(PSLICE() << get_package_name_ref() << \"/TdApi$" + gen_basic_java_class_name(name) + "\").c_str()";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TD_TL_writer_jni_cpp::gen_type_signature(const tl::tl_tree_type *tree_type) const {
|
std::string TD_TL_writer_jni_cpp::gen_type_signature(const tl::tl_tree_type *tree_type) const {
|
||||||
@ -600,7 +600,7 @@ std::string TD_TL_writer_jni_cpp::gen_additional_function(const std::string &fun
|
|||||||
std::string new_type_signature = "(PSLICE()";
|
std::string new_type_signature = "(PSLICE()";
|
||||||
std::size_t pos = type_signature.find("%PACKAGE_NAME%");
|
std::size_t pos = type_signature.find("%PACKAGE_NAME%");
|
||||||
while (pos != std::string::npos) {
|
while (pos != std::string::npos) {
|
||||||
new_type_signature += " << \"" + type_signature.substr(0, pos) + "\" << package_name";
|
new_type_signature += " << \"" + type_signature.substr(0, pos) + "\" << get_package_name_ref()";
|
||||||
type_signature = type_signature.substr(pos + 14);
|
type_signature = type_signature.substr(pos + 14);
|
||||||
pos = type_signature.find("%PACKAGE_NAME%");
|
pos = type_signature.find("%PACKAGE_NAME%");
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ std::string TD_TL_writer_jni_h::gen_output_begin_once() const {
|
|||||||
";\n"
|
";\n"
|
||||||
"using BaseObject = " +
|
"using BaseObject = " +
|
||||||
gen_base_tl_class_name());
|
gen_base_tl_class_name());
|
||||||
return result + "void set_package_name(const char *new_package_name);\n\n";
|
return result + "const char *&get_package_name_ref();\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TD_TL_writer_jni_h::gen_class_begin(const std::string &class_name, const std::string &base_class_name,
|
std::string TD_TL_writer_jni_h::gen_class_begin(const std::string &class_name, const std::string &base_class_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user