Add gen_import_declaration to TL_writer.
This commit is contained in:
parent
bdc8670646
commit
d171366faa
@ -266,16 +266,12 @@ class TlWriterCCommon final : public tl::TL_writer {
|
||||
"};\n";
|
||||
}
|
||||
if (is_header_ == -1) {
|
||||
return "#pragma once\n"
|
||||
"#include \"td/telegram/td_tdc_api.h\"\n"
|
||||
"#include \"td/telegram/td_api.h\"\n";
|
||||
return "#pragma once\n" + gen_import_declaration("td/telegram/td_tdc_api.h", false) +
|
||||
gen_import_declaration("td/telegram/td_api.h", false);
|
||||
}
|
||||
return "#include \"td/telegram/td_tdc_api_inner.h\"\n\n"
|
||||
"#include \"td/utils/format.h\"\n"
|
||||
"#include \"td/utils/logging.h\"\n"
|
||||
"#include \"td/utils/misc.h\"\n"
|
||||
"#include \"td/utils/Slice.h\"\n"
|
||||
"\n";
|
||||
return gen_import_declaration("td/telegram/td_tdc_api_inner.h", false) + "\n" +
|
||||
gen_import_declaration("td/utils/format.h", false) + gen_import_declaration("td/utils/logging.h", false) +
|
||||
gen_import_declaration("td/utils/misc.h", false) + gen_import_declaration("td/utils/Slice.h", false) + "\n";
|
||||
}
|
||||
std::string gen_output_end() const final {
|
||||
if (is_header_ == 1) {
|
||||
@ -288,6 +284,14 @@ class TlWriterCCommon final : public tl::TL_writer {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string gen_import_declaration(const std::string &name, bool is_system) const final {
|
||||
if (is_system) {
|
||||
return "#include <" + name + ">\n";
|
||||
} else {
|
||||
return "#include \"" + name + "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const final {
|
||||
if (is_header_ != 1 || class_name == "") {
|
||||
return "";
|
||||
|
@ -18,12 +18,14 @@ namespace td {
|
||||
namespace tl {
|
||||
|
||||
class TlWriterDotNet final : public TL_writer {
|
||||
public:
|
||||
bool is_header_;
|
||||
std::string prefix_;
|
||||
TlWriterDotNet(const std::string &name, bool is_header, const std::string &prefix = "")
|
||||
|
||||
public:
|
||||
TlWriterDotNet(const std::string &name, bool is_header, const std::string &prefix)
|
||||
: TL_writer(name), is_header_(is_header), prefix_(prefix) {
|
||||
}
|
||||
|
||||
int get_max_arity(void) const final {
|
||||
return 0;
|
||||
}
|
||||
@ -191,6 +193,14 @@ class TlWriterDotNet final : public TL_writer {
|
||||
"}\n";
|
||||
}
|
||||
|
||||
std::string gen_import_declaration(const std::string &name, bool is_system) const final {
|
||||
if (is_system) {
|
||||
return "#include <" + name + ">\n";
|
||||
} else {
|
||||
return "#include \"" + name + "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const final {
|
||||
if (!is_header_) {
|
||||
return "";
|
||||
|
@ -213,6 +213,10 @@ std::string TD_TL_writer_java::gen_output_end() const {
|
||||
return "}\n";
|
||||
}
|
||||
|
||||
std::string TD_TL_writer_java::gen_import_declaration(const std::string &name, bool is_system) const {
|
||||
return "import " + name + ";\n";
|
||||
}
|
||||
|
||||
std::string TD_TL_writer_java::gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const {
|
||||
return "";
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ class TD_TL_writer_java final : public tl::TL_writer {
|
||||
std::string gen_output_begin() const final;
|
||||
std::string gen_output_end() const final;
|
||||
|
||||
std::string gen_import_declaration(const std::string &name, bool is_system) const final;
|
||||
|
||||
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const final;
|
||||
|
||||
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name, bool is_proxy,
|
||||
|
@ -117,6 +117,14 @@ std::vector<std::string> TD_TL_writer::get_storers() const {
|
||||
return storers;
|
||||
}
|
||||
|
||||
std::string TD_TL_writer::gen_import_declaration(const std::string &name, bool is_system) const {
|
||||
if (is_system) {
|
||||
return "#include <" + name + ">\n";
|
||||
} else {
|
||||
return "#include \"" + name + "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
std::string TD_TL_writer::gen_base_tl_class_name() const {
|
||||
return base_tl_class_name;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ class TD_TL_writer : public tl::TL_writer {
|
||||
std::vector<std::string> get_parsers() const override;
|
||||
std::vector<std::string> get_storers() const override;
|
||||
|
||||
std::string gen_import_declaration(const std::string &package_name, bool is_system) const override;
|
||||
std::string gen_base_tl_class_name() const override;
|
||||
std::string gen_base_type_class_name(int arity) const override;
|
||||
std::string gen_base_function_class_name() const override;
|
||||
|
@ -86,6 +86,8 @@ class TL_writer {
|
||||
virtual std::string gen_output_begin() const = 0;
|
||||
virtual std::string gen_output_end() const = 0;
|
||||
|
||||
virtual std::string gen_import_declaration(const std::string &name, bool is_system) const = 0;
|
||||
|
||||
virtual std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const = 0;
|
||||
|
||||
virtual std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name, bool is_proxy,
|
||||
|
Loading…
x
Reference in New Issue
Block a user