Skip to content
Snippets Groups Projects
Commit a43b9993 authored by Franck Dary's avatar Franck Dary
Browse files

Improved printForDebug

parent f1a2537f
Branches
No related tags found
No related merge requests found
......@@ -149,13 +149,13 @@ void Config::printForDebug(FILE * dest) const
toPrint.back().emplace_back(line == (int)wordIndex ? "=>" : "");
for (unsigned int i = 0; i < getNbColumns(); i++)
{
auto & colContent = getAsFeature(i, line);
std::string colContent = has(i,line,0) ? getAsFeature(i, line).get() : "?";
std::string toPrintCol = colContent;
try
{
if (getColName(i) == headColName && toPrintCol != "_" && !toPrintCol.empty())
if (toPrintCol != "0")
toPrintCol = getAsFeature(idColName, std::stoi(toPrintCol));
if (toPrintCol != "0" && toPrintCol != "?")
toPrintCol = has(0,std::stoi(toPrintCol),0) ? getAsFeature(idColName, std::stoi(toPrintCol)).get() : "?";
} catch(std::exception & e) {util::myThrow(fmt::format("toPrintCol='{}' {}", toPrintCol, e.what()));}
toPrint.back().emplace_back(util::shrink(toPrintCol, maxWordLength));
}
......@@ -219,7 +219,7 @@ void Config::printForDebug(FILE * dest) const
Config::String & Config::getLastNotEmpty(int colIndex, int lineIndex)
{
if (!has(colIndex, lineIndex, 0))
util::myThrow(fmt::format("asked for line {} but nbLines = {}", lineIndex, getNbLines()));
util::myThrow(fmt::format("asked for line {} but last line = {}", lineIndex, getNbLines()+getFirstLineIndex()-1));
int baseIndex = getIndexOfLine(lineIndex-getFirstLineIndex()) + getIndexOfCol(colIndex);
for (int i = nbHypothesesMax; i > 0; --i)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment