$type) {
- $full_constructor .= $colon.$this->getParameterTypeName($type).$this->getFieldName($name);
+ $full_constructor .= $colon.$this->getParameterTypeName($type).$this->getFieldName($name, $class_name);
$colon = ', ';
}
$full_constructor .= ');';
@@ -368,7 +368,7 @@ EOT
EOT;
foreach ($known_fields as $name => $type) {
- $full_doc .= ' * \\param[in] '.$this->getFieldName($name).' '.$info[$name]."\n";
+ $full_doc .= ' * \\param[in] '.$this->getFieldName($name, $class_name).' '.$info[$name].PHP_EOL;
}
$full_doc .= ' */';
$this->addDocumentation($full_constructor, $full_doc);
diff --git a/td/generate/JavadocTlDocumentationGenerator.php b/td/generate/JavadocTlDocumentationGenerator.php
index a0dd53f37..6cf170694 100644
--- a/td/generate/JavadocTlDocumentationGenerator.php
+++ b/td/generate/JavadocTlDocumentationGenerator.php
@@ -16,7 +16,7 @@ class JavadocTlDocumentationGenerator extends TlDocumentationGenerator
return $doc;
}
- protected function getFieldName($name)
+ protected function getFieldName($name, $class_name)
{
if (substr($name, 0, 6) === 'param_') {
$name = substr($name, 6);
@@ -26,7 +26,7 @@ class JavadocTlDocumentationGenerator extends TlDocumentationGenerator
protected function getClassName($type)
{
- return implode(array_map('ucfirst', explode('.', trim($type, "\n ;"))));
+ return implode(array_map('ucfirst', explode('.', trim($type, "\r\n ;"))));
}
protected function getTypeName($type)
@@ -117,7 +117,7 @@ class JavadocTlDocumentationGenerator extends TlDocumentationGenerator
protected function addGlobalDocumentation()
{
if ($this->nullable_type) {
- $nullable_type_import = "import $this->nullable_type;\n";
+ $nullable_type_import = "import $this->nullable_type;".PHP_EOL;
} else {
$nullable_type_import = '';
}
@@ -188,7 +188,7 @@ EOT
protected function addClassDocumentation($class_name, $base_class_name, $description, $return_type)
{
- $return_type_description = $return_type ? "\n *\n * Returns {@link $return_type $return_type}
" : '';
+ $return_type_description = $return_type ? PHP_EOL.' *'.PHP_EOL." * Returns {@link $return_type $return_type}
" : '';
$this->addDocumentation(" public static class $class_name extends $base_class_name {", <<nullable_annotation && ($this->java_version >= 8 || substr($type_name, -1) != ']')) {
- $this->addLineReplacement($full_line, " public $this->nullable_annotation $type_name $field_name;\n");
+ $this->addLineReplacement($full_line, " public $this->nullable_annotation $type_name $field_name;".PHP_EOL);
}
}
@@ -224,11 +224,10 @@ EOT
protected function addFullConstructorDocumentation($class_name, $known_fields, $info)
{
- $explicit = count($known_fields) == 1 ? 'explicit ' : '';
$full_constructor = " public $class_name(";
$colon = '';
foreach ($known_fields as $name => $type) {
- $full_constructor .= $colon.$this->getTypeName($type).' '.$this->getFieldName($name);
+ $full_constructor .= $colon.$this->getTypeName($type).' '.$this->getFieldName($name, $class_name);
$colon = ', ';
}
$full_constructor .= ') {';
@@ -240,7 +239,7 @@ EOT
EOT;
foreach ($known_fields as $name => $type) {
- $full_doc .= ' * @param '.$this->getFieldName($name).' '.$info[$name]."\n";
+ $full_doc .= ' * @param '.$this->getFieldName($name, $class_name).' '.$info[$name].PHP_EOL;
}
$full_doc .= ' */';
$this->addDocumentation($full_constructor, $full_doc);
diff --git a/td/generate/TlDocumentationGenerator.php b/td/generate/TlDocumentationGenerator.php
index 31db40d87..11a281ce3 100644
--- a/td/generate/TlDocumentationGenerator.php
+++ b/td/generate/TlDocumentationGenerator.php
@@ -17,6 +17,7 @@ abstract class TlDocumentationGenerator
}
$this->documentation[$code] = $doc;
+ // $this->printError($code);
}
final protected function addLineReplacement($line, $new_line) {
@@ -64,7 +65,7 @@ abstract class TlDocumentationGenerator
abstract protected function escapeDocumentation($doc);
- abstract protected function getFieldName($name);
+ abstract protected function getFieldName($name, $class_name);
abstract protected function getClassName($name);
@@ -187,7 +188,7 @@ abstract class TlDocumentationGenerator
if (!$is_function) {
$type_lower = strtolower($type);
$class_name_lower = strtolower($class_name);
- if (empty($current_class) == ($type_lower !== $class_name_lower)) {
+ if (empty($current_class) === ($type_lower !== $class_name_lower)) {
$this->printError('Wrong constructor name');
}
if (strpos($class_name_lower, $type_lower) !== 0) {
@@ -236,7 +237,7 @@ abstract class TlDocumentationGenerator
foreach ($known_fields as $name => $type) {
$may_be_null = stripos($info[$name], 'may be null') !== false;
- $this->addFieldDocumentation($class_name, $this->getFieldName($name), $this->getTypeName($type), $info[$name], $may_be_null);
+ $this->addFieldDocumentation($class_name, $this->getFieldName($name, $class_name), $this->getTypeName($type), $info[$name], $may_be_null);
}
$this->addDefaultConstructorDocumentation($class_name);
@@ -275,8 +276,10 @@ abstract class TlDocumentationGenerator
$doc = '';
if (isset($this->documentation[$fixed_line])) {
$doc = $this->documentation[$fixed_line];
+ // unset($this->documentation[$fixed_line]);
} elseif (isset($this->documentation[$current_class.$fixed_line])) {
$doc = $this->documentation[$current_class.$fixed_line];
+ // unset($this->documentation[$current_class.$fixed_line]);
} else {
$this->printError('Have no docs for "'.$fixed_line.'"');
}
@@ -295,5 +298,9 @@ abstract class TlDocumentationGenerator
if (file_get_contents($source_file) !== $result) {
file_put_contents($source_file, $result);
}
+
+ if (count($this->documentation)) {
+ // $this->printError('Have unused docs '.print_r(array_keys($this->documentation), true));
+ }
}
}
diff --git a/td/generate/tl_writer_dotnet.h b/td/generate/tl_writer_dotnet.h
index 976b93f4f..8228fa233 100644
--- a/td/generate/tl_writer_dotnet.h
+++ b/td/generate/tl_writer_dotnet.h
@@ -228,14 +228,14 @@ class TlWriterDotNet : public TL_writer {
auto fixed_type_name = "::Telegram::Td::Api::" + type_name;
std::stringstream ss;
ss << "private:\n";
- ss << " " << fixed_type_name << " " << fixed_field_name << "Private;\n";
+ ss << " " << fixed_type_name << " " << fixed_field_name << "PrivateField;\n";
ss << "public:\n";
ss << " property " << fixed_type_name << " " << fixed_field_name << " {\n";
ss << " " << fixed_type_name << " get() {\n";
- ss << " return " << fixed_field_name << "Private;\n";
+ ss << " return " << fixed_field_name << "PrivateField;\n";
ss << " }\n";
ss << " void set(" << fixed_type_name << " newValue) {\n";
- ss << " " << fixed_field_name << "Private = newValue;\n";
+ ss << " " << fixed_field_name << "PrivateField = newValue;\n";
ss << " }\n";
ss << " }\n";
return ss.str();
@@ -281,9 +281,7 @@ class TlWriterDotNet : public TL_writer {
std::stringstream ss;
ss << (field_num == 0 ? "" : ", ");
auto field_type = gen_field_type(a);
- if (field_type.substr(0, 5) == "Array") {
- ss << "CXCONST ";
- } else if (field_type.substr(0, 6) != "String" && to_upper(field_type[0]) == field_type[0]) {
+ if (field_type.substr(0, 5) != "Array" && field_type.substr(0, 6) != "String" && to_upper(field_type[0]) == field_type[0]) {
field_type = "::Telegram::Td::Api::" + field_type;
}
ss << field_type << " " << to_camelCase(a.name);
diff --git a/tdutils/td/utils/port/CxCli.h b/tdutils/td/utils/port/CxCli.h
index ea7c5282f..b7f01fa40 100644
--- a/tdutils/td/utils/port/CxCli.h
+++ b/tdutils/td/utils/port/CxCli.h
@@ -23,7 +23,6 @@
#define REF_NEW ref new
#define CLRCALL
-#define CXCONST
namespace CxCli {
@@ -93,7 +92,6 @@ inline String^ string_from_unmanaged(const std::string &from) {
#define REF_NEW gcnew
#define CLRCALL __clrcall
-#define CXCONST
namespace CxCli {