19 #ifndef PROJECT_FILE_H
20 #define PROJECT_FILE_H
32 #include <QStringList>
34 class QXmlStreamReader;
35 class QXmlStreamWriter;
51 explicit ProjectFile(QString filename, QObject *parent =
nullptr);
72 bool read(
const QString &filename = QString());
327 void setSuppressions(
const QList<SuppressionList::Suppression> &suppressions);
336 void setAddons(
const QStringList &addons);
395 bool write(
const QString &filename = QString());
411 void saveToXml(QXmlStreamWriter &xmlWriter)
const;
445 static bool readBool(QXmlStreamReader &reader);
447 static int readInt(QXmlStreamReader &reader,
int defaultValue);
449 static QString
readString(QXmlStreamReader &reader);
505 static void readStringList(QStringList &stringlist, QXmlStreamReader &reader,
const char elementname[]);
514 static void writeStringList(QXmlStreamWriter &xmlWriter,
const QStringList &stringlist,
const char startelementname[],
const char stringelementname[]);
Do not only check how interface is used.
void loadFromXml(QXmlStreamReader &xmlReader)
void saveToXml(QXmlStreamWriter &xmlWriter) const
A class that reads and writes project files.
void setMaxCtuDepth(int maxCtuDepth)
std::map< std::size_t, QString > mWarningTags
Warning tags.
const QStringList & getCodingStandards() const
Get list of coding standards (checked by Cppcheck Premium).
QStringList getAddonsAndTools() const
Get list of addons and tools.
bool mClangTidy
Execute clang-tidy?
bool clangParser
Use Clang parser.
void setAnalyzeAllVsConfigs(bool b)
static ProjectFile * mActiveProject
int getMaxCtuDepth() const
QList< SuppressionList::Suppression > getCheckingSuppressions() const
Get "checking" suppressions.
const QStringList & getAddons() const
Get list addons.
const QString & getPlatform() const
Get platform.
void setCheckPaths(const QStringList &paths)
Set list of paths to check.
void setCheckLevel(CheckLevel checkLevel)
CheckLevel: normal/exhaustive.
void readDefines(QXmlStreamReader &reader)
Read list of defines from XML.
bool isCheckLevelExhaustive() const
ProjectFile(QObject *parent=nullptr)
const QString & getFilename() const
Get filename for the project file.
const QString & getRootPath() const
Get project root path.
void setCodingStandards(QStringList codingStandards)
Set list of coding standards (checked by Cppcheck Premium).
bool getBughunting() const
bool getClangAnalyzer() const
QString mFilename
Filename (+path) of the project file.
QList< SuppressionList::Suppression > mSuppressions
List of suppressions.
void setBuildDir(const QString &buildDir)
void setCheckHeaders(bool b)
void readBuildDir(QXmlStreamReader &reader)
QStringList mExcludedPaths
Paths excluded from the check.
QStringList mVsConfigurations
Check only a selected VS configuration.
void readSuppressions(QXmlStreamReader &reader)
Read suppressions.
const QList< SuppressionList::Suppression > & getSuppressions() const
Get "raw" suppressions.
void readExcludes(QXmlStreamReader &reader)
Read lists of excluded paths.
static ProjectFile * getActiveProject()
static int readInt(QXmlStreamReader &reader, int defaultValue)
bool mCheckUnusedTemplates
Check code in unused templates.
QStringList mCheckUnknownFunctionReturn
const QStringList & getCheckUnknownFunctionReturn() const
Check unknown function return values.
void setTags(const QStringList &tags)
Set tags.
void setExcludedPaths(const QStringList &paths)
Set list of paths to exclude from the check.
const QStringList & getDefines() const
Get list of defines.
int mCertIntPrecision
Cppcheck Premium: This value is passed to the Cert C checker if that is enabled.
void setClangTidy(bool c)
void setVSConfigurations(const QStringList &vsConfigs)
Set list of Visual Studio configurations to be checked.
const QString & getProjectName() const
QStringList mDefines
List of defines.
QString mImportProject
Visual studio project/solution , compile database.
QString mRootPath
Root path (optional) for the project.
QStringList mCodingStandards
List of coding standards, checked by Cppcheck Premium.
QStringList getCheckPaths() const
Get list of paths to check.
void setDefines(const QStringList &defines)
Set list of defines.
void readTagWarnings(QXmlStreamReader &reader, const QString &tag)
Read tag warnings, what warnings are tagged with a specific tag.
static bool readBool(QXmlStreamReader &reader)
QString mPlatform
Platform.
QString getWarningTags(std::size_t hash) const
Get tags for a warning.
void setCertIntPrecision(int p)
Cert C: int precision.
static QStringList fromNativeSeparators(const QStringList &paths)
Convert paths.
void readCheckPaths(QXmlStreamReader &reader)
Read list paths to check.
static void writeStringList(QXmlStreamWriter &xmlWriter, const QStringList &stringlist, const char startelementname[], const char stringelementname[])
Write string list.
void setUndefines(const QStringList &undefines)
Set list of undefines.
bool mAnalyzeAllVsConfigs
Should all visual studio configurations be analyzed? If this is false then only the Debug configurati...
void setIncludes(const QStringList &includes)
Set list of includes.
static void readStringList(QStringList &stringlist, QXmlStreamReader &reader, const char elementname[])
Read string list.
bool getClangTidy() const
bool getAnalyzeAllVsConfigs() const
void readVsConfigurations(QXmlStreamReader &reader)
Read lists of Visual Studio configurations.
int getCertIntPrecision() const
int getMaxTemplateRecursion() const
QStringList mAddons
List of addons.
const QStringList & getUndefines() const
Get list of undefines.
QStringList mUndefines
List of undefines.
void setImportProject(const QString &importProject)
void setWarningTags(std::size_t hash, const QString &tags)
Set tags for a warning.
void setLibraries(const QStringList &libraries)
Set list of libraries.
const QStringList & getVsConfigurations() const
Get list of paths to exclude from the check.
static QString getAddonFilePath(QString filesDir, const QString &addon)
Get path to addon python script.
bool read(const QString &filename=QString())
Read the project file.
void readIncludeDirs(QXmlStreamReader &reader)
Read list of include directories from XML.
QStringList mPaths
List of paths to check.
const QStringList & getTags() const
void setProjectName(QString projectName)
void setMaxTemplateRecursion(int maxTemplateRecursion)
int mMaxTemplateRecursion
Max template instantiation recursion.
void setFilename(const QString &filename)
Set filename for the project file.
void setAddons(const QStringList &addons)
Set list of addons.
bool getCheckUnusedTemplates() const
void setPlatform(const QString &platform)
Set platform.
QStringList getExcludedPaths() const
Get list of paths to exclude from the check.
void addSuppression(const SuppressionList::Suppression &suppression)
Add suppression.
void readRootPath(const QXmlStreamReader &reader)
Read optional root path from XML.
QString mBuildDir
Cppcheck build dir.
QStringList mIncludeDirs
List of include directories used to search include files.
void setBughunting(bool bughunting)
Bughunting (Cppcheck Premium)
void readPlatform(QXmlStreamReader &reader)
Read platform text.
int mMaxCtuDepth
Max CTU depth.
void setRootPath(const QString &rootpath)
Set project root path.
QStringList getIncludeDirs() const
Get list of include directories.
QStringList mLibraries
List of libraries.
bool getCheckHeaders() const
void setCheckUnusedTemplates(bool b)
const QStringList & getLibraries() const
Get list libraries.
const QString & getBuildDir() const
bool mClangAnalyzer
Execute clang analyzer?
void setClangAnalyzer(bool c)
bool write(const QString &filename=QString())
Write project file (to disk).
static QString readString(QXmlStreamReader &reader)
void readImportProject(QXmlStreamReader &reader)
Read importproject from XML.
void setSuppressions(const QList< SuppressionList::Suppression > &suppressions)
Set list of suppressions.
bool mCheckHeaders
Check code in headers.
QString mProjectName
Project name, used when generating compliance report.
const QString & getImportProject() const
CheckLevel mCheckLevel
Should Cppcheck run normal or exhaustive analysis?
This is just a container for general settings so that we don't need to pass individual values to func...
Do not only check how interface is used.