Add some comments for the CmdLineParser class.
Also remove one unneeded forward declaration.
This commit is contained in:
parent
5d539c76fe
commit
a7ee5a0488
|
@ -22,28 +22,65 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class CppCheck;
|
|
||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
|
/// @addtogroup CLI
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The command line parser.
|
||||||
|
* The command line parser parses options and parameters user gives to
|
||||||
|
* cppcheck command line.
|
||||||
|
*
|
||||||
|
* The parser takes a pointer to Settings instance which it will update
|
||||||
|
* based on options user has given. Couple of options are handled as
|
||||||
|
* class internal options.
|
||||||
|
*/
|
||||||
class CmdLineParser
|
class CmdLineParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* The constructor.
|
||||||
|
* @param settings Settings instance that will be modified accoding to
|
||||||
|
* options user has given.
|
||||||
|
*/
|
||||||
CmdLineParser(Settings *settings);
|
CmdLineParser(Settings *settings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse given command line.
|
||||||
|
* @return true if command line was ok, false if there was an error.
|
||||||
|
*/
|
||||||
bool ParseFromArgs(int argc, const char* const argv[]);
|
bool ParseFromArgs(int argc, const char* const argv[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if user wanted to see program version.
|
||||||
|
*/
|
||||||
bool GetShowVersion() const
|
bool GetShowVersion() const
|
||||||
{
|
{
|
||||||
return _showVersion;
|
return _showVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if user wanted to see list of error messages.
|
||||||
|
*/
|
||||||
bool GetShowErrorMessages() const
|
bool GetShowErrorMessages() const
|
||||||
{
|
{
|
||||||
return _showErrorMessages;
|
return _showErrorMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the path names user gave to command line.
|
||||||
|
*/
|
||||||
std::vector<std::string> GetPathNames() const
|
std::vector<std::string> GetPathNames() const
|
||||||
{
|
{
|
||||||
return _pathnames;
|
return _pathnames;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print help text to the console.
|
||||||
|
*/
|
||||||
void PrintHelp();
|
void PrintHelp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -54,4 +91,6 @@ private:
|
||||||
std::vector<std::string> _pathnames;
|
std::vector<std::string> _pathnames;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
#endif // CMDLINE_PARSER_H
|
#endif // CMDLINE_PARSER_H
|
||||||
|
|
Loading…
Reference in New Issue