Skip to content

Commit

Permalink
Disable hpp documentation for .NET.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 4969d3196aeae0c7398bc06d5285df443a79f379
  • Loading branch information
levlam committed Mar 16, 2018
1 parent a80b8e9 commit 070f6ff
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
3 changes: 3 additions & 0 deletions td/generate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 20 additions & 11 deletions td/generate/tl_writer_hpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 070f6ff

Please sign in to comment.