Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -17,8 +17,8 @@ using namespace std;
using namespace strings;
// CategoriesInfo ----------------------------------------------------------------------------------
CategoriesInfo::CategoriesInfo(feature::TypesHolder const & holder, TokenSlice const & tokens,
Locales const & locales, CategoriesHolder const & categories)
CategoriesInfo::CategoriesInfo(feature::TypesHolder const & holder, TokenSlice const & tokens, Locales const & locales,
CategoriesHolder const & categories)
{
struct TokenInfo
{
@@ -40,10 +40,8 @@ CategoriesInfo::CategoriesInfo(feature::TypesHolder const & holder, TokenSlice c
});
for (size_t i = 0; i < slice.Size(); ++i)
{
if (infos[i].m_inFeatureTypes)
m_matchedLength += slice.Get(i).size();
}
// Note that m_inFeatureTypes implies m_isCategoryToken.
@@ -53,10 +51,8 @@ CategoriesInfo::CategoriesInfo(feature::TypesHolder const & holder, TokenSlice c
return info.m_inFeatureTypes;
});
m_falseCategories = all_of(infos.begin(), infos.end(), [](TokenInfo const & info)
{
return !info.m_inFeatureTypes && info.m_isCategoryToken;
});
m_falseCategories = all_of(infos.begin(), infos.end(),
[](TokenInfo const & info) { return !info.m_inFeatureTypes && info.m_isCategoryToken; });
}
// ErrorsMade --------------------------------------------------------------------------------------
@@ -70,8 +66,7 @@ string DebugPrint(ErrorsMade const & errorsMade)
namespace impl
{
ErrorsMade GetErrorsMade(QueryParams::Token const & token,
strings::UniString const & text, LevenshteinDFA const & dfa)
ErrorsMade GetErrorsMade(QueryParams::Token const & token, strings::UniString const & text, LevenshteinDFA const & dfa)
{
if (token.AnyOfSynonyms([&text](strings::UniString const & s) { return text == s; }))
return ErrorsMade(0);
@@ -84,8 +79,8 @@ ErrorsMade GetErrorsMade(QueryParams::Token const & token,
return {};
}
ErrorsMade GetPrefixErrorsMade(QueryParams::Token const & token,
strings::UniString const & text, LevenshteinDFA const & dfa)
ErrorsMade GetPrefixErrorsMade(QueryParams::Token const & token, strings::UniString const & text,
LevenshteinDFA const & dfa)
{
if (token.AnyOfSynonyms([&text](strings::UniString const & s) { return StartsWith(text, s); }))
return ErrorsMade(0);
@@ -106,16 +101,17 @@ bool IsStopWord(UniString const & s)
class StopWordsChecker
{
set<UniString> m_set;
public:
StopWordsChecker()
{
// Don't want to put _full_ stopwords list, not to break current ranking.
// Only 2-letters and the most common.
char const * arr[] = {
"a", "s", "the", // English
"am", "im", "an", // German
"d", "da", "de", "di", "du", "la", "le", // French, Spanish, Italian
"и", "я" // Cyrillic
"a", "s", "the", // English
"am", "im", "an", // German
"d", "da", "de", "di", "du", "la", "le", // French, Spanish, Italian
"и", "я" // Cyrillic
};
for (char const * s : arr)
m_set.insert(MakeUniString(s));
@@ -157,10 +153,8 @@ string DebugPrint(NameScores const & scores)
{
ostringstream os;
os << boolalpha << "NameScores "
<< "{ m_nameScore: " << DebugPrint(scores.m_nameScore)
<< ", m_matchedLength: " << scores.m_matchedLength
<< ", m_errorsMade: " << DebugPrint(scores.m_errorsMade)
<< ", m_isAltOrOldName: "
<< "{ m_nameScore: " << DebugPrint(scores.m_nameScore) << ", m_matchedLength: " << scores.m_matchedLength
<< ", m_errorsMade: " << DebugPrint(scores.m_errorsMade) << ", m_isAltOrOldName: "
<< " }";
return os.str();
}