Disable hpp documentation for .NET.

GitOrigin-RevId: 4969d3196aeae0c7398bc06d5285df443a79f379
This commit is contained in:
levlam 2018-03-16 18:41:09 +03:00
parent a80b8e951a
commit 070f6ff184
2 changed files with 23 additions and 11 deletions

View File

@ -103,6 +103,9 @@ if (NOT CMAKE_CROSSCOMPILING)
if (TD_ENABLE_JNI)
target_compile_definitions(generate_common PRIVATE TD_ENABLE_JNI=1)
endif()
if (TD_ENABLE_DOTNET)
target_compile_definitions(generate_common PRIVATE DISABLE_HPP_DOCUMENTATION=1)
endif()
add_executable(generate_c ${TL_GENERATE_C_SOURCE})
target_link_libraries(generate_c PRIVATE tdtl)

View File

@ -11,7 +11,11 @@
namespace td {
bool TD_TL_writer_hpp::is_documentation_generated() const {
#ifdef DISABLE_HPP_DOCUMENTATION
return false;
#else
return true;
#endif
}
int TD_TL_writer_hpp::get_additional_function_type(const std::string &additional_function_name) const {
@ -37,11 +41,13 @@ std::string TD_TL_writer_hpp::gen_base_tl_class_name() const {
std::string TD_TL_writer_hpp::gen_output_begin() const {
return "#pragma once\n"
"\n"
#ifndef DISABLE_HPP_DOCUMENTATION
"/**\n"
" * \\file\n"
" * Contains downcast_call methods for calling a function object on downcasted to\n"
" * the most derived class TDLib API object.\n"
" */\n"
#endif
"#include \"" +
tl_name +
".h\"\n"
@ -195,17 +201,20 @@ std::string TD_TL_writer_hpp::gen_additional_proxy_function_begin(const std::str
const std::string &class_name, int arity,
bool is_function) const {
assert(function_name == "downcast_call");
return "/**\n"
" * Calls the specified function object with the given object downcasted to its most derived type.\n"
" * \\param[in] obj Object to pass as an argument to the function object.\n"
" * \\param[in] func Function object to which the object will be passed.\n"
" * \\returns Whether function object call has happened. Should always return true for correct parameters.\n"
" */\n"
"template <class T>\n"
"bool downcast_call(" +
class_name +
" &obj, const T &func) {\n"
" switch (obj.get_id()) {\n";
return
#ifndef DISABLE_HPP_DOCUMENTATION
"/**\n"
" * Calls the specified function object with the given object downcasted to its most derived type.\n"
" * \\param[in] obj Object to pass as an argument to the function object.\n"
" * \\param[in] func Function object to which the object will be passed.\n"
" * \\returns Whether function object call has happened. Should always return true for correct parameters.\n"
" */\n"
#endif
"template <class T>\n"
"bool downcast_call(" +
class_name +
" &obj, const T &func) {\n"
" switch (obj.get_id()) {\n";
}
std::string TD_TL_writer_hpp::gen_additional_proxy_function_case(const std::string &function_name,