Skip to content

Commit

Permalink
Merge branch 'master' of github.com:doxygen/doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
doxygen committed Apr 20, 2024
2 parents 0a7e798 + 2aa6c06 commit 9d9c29a
Show file tree
Hide file tree
Showing 36 changed files with 418 additions and 1,111 deletions.
21 changes: 21 additions & 0 deletions doc/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ def collectPureVirtualPrototypes(self):
status = 0
curlyCnt = 0 # counter for the level of curly braces

backStatus = 2
# Loop until the final state 777 is reached. The errors are processed
# immediately. In this implementation, it always quits the application.
while status != 777:
Expand All @@ -558,6 +559,7 @@ def collectPureVirtualPrototypes(self):

elif status == 1: # colon after the 'public'
if tokenId == 'colon':
backStatus = 2
status = 2
else:
self.__unexpectedToken(status, tokenId, tokenLineNo)
Expand All @@ -566,12 +568,16 @@ def collectPureVirtualPrototypes(self):
if tokenId == 'virtual':
prototype = tokenStr # but not to unified prototype
status = 3
elif tokenId == 'id' and tokenStr == 'QCString' and backStatus == 3:
status = 4
elif tokenId == 'comment':
pass
elif tokenId == 'rcurly':
status = 11 # expected end of class
elif tokenId == 'id' and tokenStr == 'ABSTRACT_BASE_CLASS':
status = 18
elif tokenId == 'protected':
status = 19
else:
self.__unexpectedToken(status, tokenId, tokenLineNo)

Expand Down Expand Up @@ -707,6 +713,8 @@ def collectPureVirtualPrototypes(self):
prototype += ', '
uniPrototype += ', '
status = 6
elif tokenId == 'assign':
status=20
elif tokenId == 'rpar':
prototype += tokenStr
uniPrototype += tokenStr
Expand All @@ -724,6 +732,19 @@ def collectPureVirtualPrototypes(self):
else:
self.__unexpectedToken(status, tokenId, tokenLineNo)

elif status == 19: # colon after the 'protected'
if tokenId == 'colon':
backStatus = 3
status = 3
else:
self.__unexpectedToken(status, tokenId, tokenLineNo)

elif status == 20:
if tokenId == 'string':
status = 17
else:
self.__unexpectedToken(status, tokenId, tokenLineNo)

# Eat the rest of the source to cause closing the file.
while tokenId != 'eof':
tokenId, tokenStr, tokenLineNo = next(tokenIterator)
Expand Down
42 changes: 35 additions & 7 deletions src/translator.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,7 @@ class Translator
*/
virtual QCString latexCommandName()
{
QCString latex_command = Config_getString(LATEX_CMD_NAME);
if (latex_command.isEmpty()) latex_command = "latex";
if (Config_getBool(USE_PDFLATEX))
{
if (latex_command == "latex") latex_command = "pdflatex";
}
return latex_command;
return p_latexCommandName("pdflatex");
}
virtual QCString trISOLang() = 0;

Expand Down Expand Up @@ -770,6 +764,40 @@ class Translator
// new since 1.11.0
//////////////////////////////////////////////////////////////////////////
virtual QCString trImportant() = 0;

protected:
QCString p_latexCommandName(const QCString &latexCmd)
{
QCString latex_command = Config_getString(LATEX_CMD_NAME);
if (latex_command.isEmpty()) latex_command = "latex";
if (Config_getBool(USE_PDFLATEX))
{
if (latex_command == "latex") latex_command = latexCmd;
}
return latex_command;
}
/*! For easy flexible-noun implementation.
* \internal
*/
QCString createNoun(bool first_capital, bool singular,
const QCString &base,
const QCString &plurSuffix, const QCString &singSuffix = "" )
{
QCString result;
if (first_capital)
{
std::string res = getUTF8CharAt(base.str(),0);
res = convertUTF8ToUpper(res);
result = res.c_str();
result += base.mid(res.length());
}
else
{
result = base;
}
result += (singular ? singSuffix : plurSuffix);
return result;
}
};

#endif
8 changes: 1 addition & 7 deletions src/translator_ar.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6

QCString latexCommandName() override
{
QCString latex_command = Config_getString(LATEX_CMD_NAME);
if (latex_command.isEmpty()) latex_command = "latex";
if (Config_getBool(USE_PDFLATEX))
{
if (latex_command == "latex") latex_command = "xelatex";
}
return latex_command;
return p_latexCommandName("xelatex");
}

QCString trISOLang() override
Expand Down
52 changes: 13 additions & 39 deletions src/translator_br.h
Original file line number Diff line number Diff line change
Expand Up @@ -1368,9 +1368,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trClass(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Classe" : "classe"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "classe", "s");
}

/*! This is used for translation of the word that will possibly
Expand All @@ -1379,9 +1377,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trFile(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Arquivo": "arquivo"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "arquivo", "s");
}

/*! This is used for translation of the word that will possibly
Expand All @@ -1390,9 +1386,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trNamespace(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Namespace" : "namespace"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "namespace", "s");
}

/*! This is used for translation of the word that will possibly
Expand All @@ -1401,9 +1395,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trGroup(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Grupo" : "grupo"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "grupo", "s");
}

/*! This is used for translation of the word that will possibly
Expand All @@ -1412,9 +1404,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trPage(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Página" : "página"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "página", "s");
}

/*! This is used for translation of the word that will possibly
Expand All @@ -1423,9 +1413,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trMember(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Membro" : "membro"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "membro", "s");
}

/*! This is used for translation of the word that will possibly
Expand All @@ -1434,9 +1422,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trGlobal(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Globa" : "globa"));
result+= singular? "l" : "ais";
return result;
return createNoun(first_capital, singular, "globa", "ais", "l");
}

//////////////////////////////////////////////////////////////////////////
Expand All @@ -1447,9 +1433,7 @@ class TranslatorBrazilian : public Translator
* for the author section in man pages. */
QCString trAuthor(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Autor" : "autor"));
if (!singular) result+="es";
return result;
return createNoun(first_capital, singular, "autor", "es");
}

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1675,9 +1659,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trDir(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Diretório" : "diretório"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "diretório", "s");
}

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1856,9 +1838,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trModule(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Módulo" : "módulo"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "módulo", "s");
}

/*! This is put at the bottom of a module documentation page and is
Expand Down Expand Up @@ -1896,9 +1876,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trType(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Tipo" : "tipo"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "tipo", "s");
}

/*! This is used for translation of the word that will possibly
Expand All @@ -1907,9 +1885,7 @@ class TranslatorBrazilian : public Translator
*/
QCString trSubprogram(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Subrotina" : "subrotina"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "subrotina", "s");
}

/*! C# Type Contraint list */
Expand Down Expand Up @@ -2477,9 +2453,7 @@ class TranslatorBrazilian : public Translator
/** C++20 concept */
QCString trConcept(bool first_capital, bool singular) override
{
QCString result((first_capital ? "Conceito" : "conceito"));
if (!singular) result+="s";
return result;
return createNoun(first_capital, singular, "conceito", "s");
}
/*! used as the title of the HTML page of a C++20 concept page */
QCString trConceptReference(const QCString &conceptName) override
Expand Down

0 comments on commit 9d9c29a

Please sign in to comment.