Return enum, not untyped int, when classifying Doxygen commands

This makes the purpose of DoxygenParser::commandBelongs() more clear and also
allows the compiler to check that we handle all of its possible return values.
And it actually turns out that we didn't, so add the missing values now to
avoid changing the behaviour in any way in this commit, but they will be dealt
with later.
This commit is contained in:
Vadim Zeitlin 2017-02-01 01:43:11 +01:00
commit 71c4e55fd9
2 changed files with 10 additions and 2 deletions

View file

@ -128,7 +128,8 @@ void DoxygenParser::printTree(const DoxygenEntityList &rootList)
}
}
int DoxygenParser::commandBelongs(const std::string &theCommand)
DoxygenParser::DoxyCommandEnum
DoxygenParser::commandBelongs(const std::string &theCommand)
{
DoxyCommandsMapIt it = doxygenCommands.find(stringToLower(theCommand));
@ -1046,6 +1047,13 @@ int DoxygenParser::addCommand(const std::string &commandString,
return addCommandHtmlEntity(theCommand, tokList, doxyList);
case COMMAND_IGNORE:
return ignoreCommand(commandString, tokList, doxyList);
case NONE:
case END_LINE:
case PARAGRAPH_END:
case PLAINSTRING:
case COMMAND:
// TODO: Ensure that these values either are correctly ignored here or can't happen.
break;
}
return 0;
}

View file

@ -130,7 +130,7 @@ private:
* Determines how a command should be handled (what group it belongs to
* for parsing rules
*/
int commandBelongs(const std::string &theCommand);
DoxyCommandEnum commandBelongs(const std::string &theCommand);
/*
*prints the parse tree