Add to_string method for vector of TL objects.
This commit is contained in:
parent
3b6c0143b6
commit
a640fb2fe0
@ -127,6 +127,7 @@ class DoxygenTlDocumentationGenerator extends TlDocumentationGenerator
|
||||
return empty($tline) || $tline[0] === '}' || $tline === 'public:' || strpos($line, '#pragma ') === 0 ||
|
||||
strpos($line, '#include <') === 0 || strpos($tline, 'return ') === 0 || strpos($tline, 'namespace') === 0 ||
|
||||
preg_match('/class [A-Za-z0-9_]*;/', $line) || $tline === 'if (value == nullptr) {' ||
|
||||
strpos($tline, 'result += ') === 0 || strpos($tline, 'result = ') || strpos($tline, ' : values') ||
|
||||
strpos($line, 'JNIEnv') || strpos($line, 'jfieldID') || $tline === 'virtual ~Object() {' ||
|
||||
$tline === 'virtual void store(TlStorerToString &s, const char *field_name) const = 0;';
|
||||
}
|
||||
@ -294,7 +295,7 @@ EOT
|
||||
|
||||
$this->addDocumentation('std::string to_string(const BaseObject &value);', <<<EOT
|
||||
/**
|
||||
* Returns a string representation of the TDLib API object.
|
||||
* Returns a string representation of a TDLib API object.
|
||||
* \\param[in] value The object.
|
||||
* \\return Object string representation.
|
||||
*/
|
||||
@ -303,12 +304,22 @@ EOT
|
||||
|
||||
$this->addDocumentation('std::string to_string(const object_ptr<T> &value) {', <<<EOT
|
||||
/**
|
||||
* Returns a string representation of the TDLib API object.
|
||||
* Returns a string representation of a TDLib API object.
|
||||
* \\tparam T Object type, auto-deduced.
|
||||
* \\param[in] value The object.
|
||||
* \\return Object string representation.
|
||||
*/
|
||||
EOT
|
||||
);
|
||||
|
||||
$this->addDocumentation('std::string to_string(const std::vector<object_ptr<T>> &values) {', <<<EOT
|
||||
/**
|
||||
* Returns a string representation of a list of TDLib API objects.
|
||||
* \\tparam T Object type, auto-deduced.
|
||||
* \\param[in] values The objects.
|
||||
* \\return Objects string representation.
|
||||
*/
|
||||
EOT
|
||||
);
|
||||
|
||||
$this->addDocumentation(' void store(TlStorerToString &s, const char *field_name) const final;', <<<EOT
|
||||
|
@ -94,6 +94,20 @@ std::string TD_TL_writer_h::gen_output_begin() const {
|
||||
" }\n"
|
||||
"\n"
|
||||
" return to_string(*value);\n"
|
||||
"}\n\n"
|
||||
|
||||
"template <class T>\n"
|
||||
"std::string to_string(const std::vector<object_ptr<T>> &values) {\n"
|
||||
" std::string result = \"{\\n\";\n"
|
||||
" for (const auto &value : values) {\n"
|
||||
" if (value == nullptr) {\n"
|
||||
" result += \"null\\n\";\n"
|
||||
" } else {\n"
|
||||
" result += to_string(*value);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" result += \"}\\n\";\n"
|
||||
" return result;\n"
|
||||
"}\n\n";
|
||||
}
|
||||
|
||||
|
@ -927,7 +927,7 @@ void GroupCallManager::on_update_group_call_participants(
|
||||
group_call->participant_count += diff;
|
||||
if (group_call->participant_count < 0) {
|
||||
LOG(ERROR) << "Participant count became negative in " << input_group_call_id << " from "
|
||||
<< group_call->dialog_id;
|
||||
<< group_call->dialog_id << " after applying " << to_string(participants);
|
||||
group_call->participant_count = 0;
|
||||
}
|
||||
update_group_call_dialog(group_call, "on_update_group_call_participants");
|
||||
|
Loading…
Reference in New Issue
Block a user