19 #ifndef CMDLINE_PARSER_H
20 #define CMDLINE_PARSER_H
87 const std::list<FileWithDetails>&
getFiles()
const {
121 bool parseNumberArg(
const char*
const arg, std::size_t offset, T& num,
bool mustBePositive =
false)
125 if (!
strToInt(arg + offset, tmp, &err)) {
126 mLogger.
printError(
"argument to '" + std::string(arg, offset) +
"' is not valid - " + err +
".");
129 if (mustBePositive && tmp < 0) {
130 mLogger.
printError(
"argument to '" + std::string(arg, offset) +
"' needs to be a positive integer.");
virtual void printError(const std::string &message)=0
print an error message
bool parseNumberArg(const char *const arg, std::size_t offset, T &num, bool mustBePositive=false)
CmdLineParser(CmdLineLogger &logger, Settings &settings, Suppressions &suppressions)
The constructor.
const std::vector< std::string > & getPathNames() const
Return the path names user gave to command line.
bool tryLoadLibrary(Library &destination, const std::string &basepath, const char *filename)
Tries to load a library and prints warning/error messages.
std::vector< std::string > mPathNames
const std::list< FileWithDetails > & getFiles() const
Return the files user gave to command line.
void printHelp() const
Print help text to the console.
bool loadLibraries(Settings &settings)
Load libraries.
std::string getVersion() const
Get Cppcheck version.
std::list< FileSettings > mFileSettings
bool fillSettingsFromArgs(int argc, const char *const argv[])
Parse command line args and fill settings and file lists from there.
Suppressions & mSuppressions
std::list< FileWithDetails > mFiles
std::vector< std::string > mIgnoredPaths
bool isCppcheckPremium() const
Result parseFromArgs(int argc, const char *const argv[])
Parse given command line.
bool loadAddons(Settings &settings)
Load addons.
const std::vector< std::string > & getIgnoredPaths() const
Return a list of paths user wants to ignore.
const std::list< FileSettings > & getFileSettings() const
Return the file settings read from command line.
Library definitions handling.
This is just a container for general settings so that we don't need to pass individual values to func...
bool strToInt(const std::string &str, T &num, std::string *err=nullptr)