From fa82d1cca1544c401bc06c341ce265a346a498b9 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sat, 25 May 2024 13:14:46 +0200 Subject: Switch from fmtlib to std::format. (#2031) * Switch from fmtlib to std::format. * Remove libffi from dependencies in Github action. --- src/categories.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src/categories.cpp') diff --git a/src/categories.cpp b/src/categories.cpp index c1aa756f..48ee4bc8 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -74,7 +74,7 @@ void CategoryFactory::loadCategories() bool ok = false; int temp = iter->toInt(&ok); if (!ok) { - log::error(tr("invalid category id {}").toStdString(), iter->constData()); + log::error(tr("invalid category id {0}"), iter->constData()); } nexusCats.push_back(NexusCategory("Unknown", temp)); } @@ -84,8 +84,7 @@ void CategoryFactory::loadCategories() int id = cells[0].toInt(&cell0Ok); int parentID = cells[3].trimmed().toInt(&cell3Ok); if (!cell0Ok || !cell3Ok) { - log::error(tr("invalid category line {}: {}").toStdString(), lineNum, - line.constData()); + log::error(tr("invalid category line {0}: {1}"), lineNum, line.constData()); } addCategory(id, QString::fromUtf8(cells[1].constData()), nexusCats, parentID); } else if (cells.count() == 3) { @@ -94,14 +93,13 @@ void CategoryFactory::loadCategories() int id = cells[0].toInt(&cell0Ok); int parentID = cells[2].trimmed().toInt(&cell3Ok); if (!cell0Ok || !cell3Ok) { - log::error(tr("invalid category line {}: {}").toStdString(), lineNum, - line.constData()); + log::error(tr("invalid category line {0}: {1}"), lineNum, line.constData()); } addCategory(id, QString::fromUtf8(cells[1].constData()), std::vector(), parentID); } else { - log::error(tr("invalid category line {}: {} ({} cells)").toStdString(), lineNum, + log::error(tr("invalid category line {0}: {1} ({2} cells)"), lineNum, line.constData(), cells.count()); } } @@ -122,19 +120,17 @@ void CategoryFactory::loadCategories() bool ok = false; int nexID = nexCells[2].toInt(&ok); if (!ok) { - log::error(tr("invalid nexus ID {}").toStdString(), - nexCells[2].constData()); + log::error(tr("invalid nexus ID {}"), nexCells[2].constData()); } int catID = nexCells[0].toInt(&ok); if (!ok) { - log::error(tr("invalid category id {}").toStdString(), - nexCells[0].constData()); + log::error(tr("invalid category id {}"), nexCells[0].constData()); } m_NexusMap.insert_or_assign(nexID, NexusCategory(nexName, nexID)); m_NexusMap.at(nexID).setCategoryID(catID); } else { - log::error(tr("invalid nexus category line {}: {} ({} cells)").toStdString(), - lineNum, nexLine.constData(), nexCells.count()); + log::error(tr("invalid nexus category line {0}: {1} ({2} cells)"), lineNum, + nexLine.constData(), nexCells.count()); } } } @@ -394,7 +390,7 @@ bool CategoryFactory::isDescendantOfImpl(int id, int parentID, return isDescendantOfImpl(m_Categories[index].parentID(), parentID, seen); } } else { - log::warn(tr("{} is no valid category id").toStdString(), id); + log::warn(tr("{} is no valid category id"), id); return false; } } @@ -513,11 +509,11 @@ unsigned int CategoryFactory::resolveNexusID(int nexusID) const auto result = m_NexusMap.find(nexusID); if (result != m_NexusMap.end()) { if (m_IDMap.count(result->second.categoryID())) { - log::debug(tr("nexus category id {} maps to internal {}").toStdString(), nexusID, + log::debug(tr("nexus category id {0} maps to internal {1}"), nexusID, m_IDMap.at(result->second.categoryID())); return m_IDMap.at(result->second.categoryID()); } } - log::debug(tr("nexus category id {} not mapped").toStdString(), nexusID); + log::debug(tr("nexus category id {} not mapped"), nexusID); return 0U; } -- cgit v1.3.1