Cppcheck
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ProjectFile Class Reference

A class that reads and writes project files. More...

#include <projectfile.h>

Inheritance diagram for ProjectFile:

Classes

class  SafeChecks
 Do not only check how interface is used. More...
 

Public Types

enum class  CheckLevel { normal , exhaustive }
 

Public Member Functions

 ProjectFile (QObject *parent=nullptr)
 
 ProjectFile (QString filename, QObject *parent=nullptr)
 
 ~ProjectFile () override
 
void setActiveProject ()
 
bool read (const QString &filename=QString())
 Read the project file. More...
 
const QString & getRootPath () const
 Get project root path. More...
 
const QString & getBuildDir () const
 
const QString & getImportProject () const
 
bool getAnalyzeAllVsConfigs () const
 
bool getCheckHeaders () const
 
void setCheckHeaders (bool b)
 
bool getCheckUnusedTemplates () const
 
void setCheckUnusedTemplates (bool b)
 
QStringList getIncludeDirs () const
 Get list of include directories. More...
 
const QStringList & getDefines () const
 Get list of defines. More...
 
const QStringList & getUndefines () const
 Get list of undefines. More...
 
QStringList getCheckPaths () const
 Get list of paths to check. More...
 
QStringList getExcludedPaths () const
 Get list of paths to exclude from the check. More...
 
const QStringList & getVsConfigurations () const
 Get list of paths to exclude from the check. More...
 
const QStringList & getLibraries () const
 Get list libraries. More...
 
const QString & getPlatform () const
 Get platform. More...
 
const QString & getProjectName () const
 
void setProjectName (QString projectName)
 
const QList< SuppressionList::Suppression > & getSuppressions () const
 Get "raw" suppressions. More...
 
QList< SuppressionList::SuppressiongetCheckingSuppressions () const
 Get "checking" suppressions. More...
 
const QStringList & getAddons () const
 Get list addons. More...
 
QStringList getAddonsAndTools () const
 Get list of addons and tools. More...
 
bool getClangAnalyzer () const
 
void setClangAnalyzer (bool c)
 
bool getClangTidy () const
 
void setClangTidy (bool c)
 
const QStringList & getTags () const
 
int getMaxCtuDepth () const
 
void setMaxCtuDepth (int maxCtuDepth)
 
int getMaxTemplateRecursion () const
 
void setMaxTemplateRecursion (int maxTemplateRecursion)
 
const QString & getFilename () const
 Get filename for the project file. More...
 
void setRootPath (const QString &rootpath)
 Set project root path. More...
 
void setBuildDir (const QString &buildDir)
 
void setImportProject (const QString &importProject)
 
void setAnalyzeAllVsConfigs (bool b)
 
void setIncludes (const QStringList &includes)
 Set list of includes. More...
 
void setDefines (const QStringList &defines)
 Set list of defines. More...
 
void setUndefines (const QStringList &undefines)
 Set list of undefines. More...
 
void setCheckPaths (const QStringList &paths)
 Set list of paths to check. More...
 
void setExcludedPaths (const QStringList &paths)
 Set list of paths to exclude from the check. More...
 
void setLibraries (const QStringList &libraries)
 Set list of libraries. More...
 
void setPlatform (const QString &platform)
 Set platform. More...
 
void setSuppressions (const QList< SuppressionList::Suppression > &suppressions)
 Set list of suppressions. More...
 
void addSuppression (const SuppressionList::Suppression &suppression)
 Add suppression. More...
 
void setAddons (const QStringList &addons)
 Set list of addons. More...
 
void setVSConfigurations (const QStringList &vsConfigs)
 Set list of Visual Studio configurations to be checked. More...
 
void setCheckLevel (CheckLevel checkLevel)
 CheckLevel: normal/exhaustive. More...
 
bool isCheckLevelExhaustive () const
 
void setTags (const QStringList &tags)
 Set tags. More...
 
void setWarningTags (std::size_t hash, const QString &tags)
 Set tags for a warning. More...
 
QString getWarningTags (std::size_t hash) const
 Get tags for a warning. More...
 
void setBughunting (bool bughunting)
 Bughunting (Cppcheck Premium) More...
 
bool getBughunting () const
 
const QStringList & getCodingStandards () const
 Get list of coding standards (checked by Cppcheck Premium). More...
 
void setCodingStandards (QStringList codingStandards)
 Set list of coding standards (checked by Cppcheck Premium). More...
 
void setCertIntPrecision (int p)
 Cert C: int precision. More...
 
int getCertIntPrecision () const
 
bool write (const QString &filename=QString())
 Write project file (to disk). More...
 
void setFilename (const QString &filename)
 Set filename for the project file. More...
 
const QStringList & getCheckUnknownFunctionReturn () const
 Check unknown function return values. More...
 

Static Public Member Functions

static ProjectFilegetActiveProject ()
 
static QString getAddonFilePath (QString filesDir, const QString &addon)
 Get path to addon python script. More...
 

Public Attributes

SafeChecks safeChecks
 
bool clangParser
 Use Clang parser. More...
 

Protected Member Functions

void readRootPath (const QXmlStreamReader &reader)
 Read optional root path from XML. More...
 
void readBuildDir (QXmlStreamReader &reader)
 
void readImportProject (QXmlStreamReader &reader)
 Read importproject from XML. More...
 
void readIncludeDirs (QXmlStreamReader &reader)
 Read list of include directories from XML. More...
 
void readDefines (QXmlStreamReader &reader)
 Read list of defines from XML. More...
 
void readCheckPaths (QXmlStreamReader &reader)
 Read list paths to check. More...
 
void readExcludes (QXmlStreamReader &reader)
 Read lists of excluded paths. More...
 
void readVsConfigurations (QXmlStreamReader &reader)
 Read lists of Visual Studio configurations. More...
 
void readPlatform (QXmlStreamReader &reader)
 Read platform text. More...
 
void readSuppressions (QXmlStreamReader &reader)
 Read suppressions. More...
 
void readTagWarnings (QXmlStreamReader &reader, const QString &tag)
 Read tag warnings, what warnings are tagged with a specific tag. More...
 

Static Protected Member Functions

static bool readBool (QXmlStreamReader &reader)
 
static int readInt (QXmlStreamReader &reader, int defaultValue)
 
static QString readString (QXmlStreamReader &reader)
 
static void readStringList (QStringList &stringlist, QXmlStreamReader &reader, const char elementname[])
 Read string list. More...
 
static void writeStringList (QXmlStreamWriter &xmlWriter, const QStringList &stringlist, const char startelementname[], const char stringelementname[])
 Write string list. More...
 

Private Member Functions

void clear ()
 

Static Private Member Functions

static QStringList fromNativeSeparators (const QStringList &paths)
 Convert paths. More...
 

Private Attributes

QString mFilename
 Filename (+path) of the project file. More...
 
QString mRootPath
 Root path (optional) for the project. More...
 
QString mBuildDir
 Cppcheck build dir. More...
 
QString mImportProject
 Visual studio project/solution , compile database. More...
 
bool mAnalyzeAllVsConfigs
 Should all visual studio configurations be analyzed? If this is false then only the Debug configuration for the set platform is analyzed. More...
 
QStringList mVsConfigurations
 Check only a selected VS configuration. More...
 
bool mCheckHeaders
 Check code in headers. More...
 
bool mCheckUnusedTemplates
 Check code in unused templates. More...
 
QStringList mIncludeDirs
 List of include directories used to search include files. More...
 
QStringList mDefines
 List of defines. More...
 
QStringList mUndefines
 List of undefines. More...
 
QStringList mPaths
 List of paths to check. More...
 
QStringList mExcludedPaths
 Paths excluded from the check. More...
 
QStringList mLibraries
 List of libraries. More...
 
QString mPlatform
 Platform. More...
 
QList< SuppressionList::SuppressionmSuppressions
 List of suppressions. More...
 
QStringList mAddons
 List of addons. More...
 
bool mBughunting = false
 
CheckLevel mCheckLevel = CheckLevel::normal
 Should Cppcheck run normal or exhaustive analysis? More...
 
QStringList mCodingStandards
 List of coding standards, checked by Cppcheck Premium. More...
 
QString mProjectName
 Project name, used when generating compliance report. More...
 
int mCertIntPrecision
 Cppcheck Premium: This value is passed to the Cert C checker if that is enabled. More...
 
bool mClangAnalyzer
 Execute clang analyzer? More...
 
bool mClangTidy
 Execute clang-tidy? More...
 
QStringList mTags
 Tags. More...
 
std::map< std::size_t, QString > mWarningTags
 Warning tags. More...
 
int mMaxCtuDepth
 Max CTU depth. More...
 
int mMaxTemplateRecursion
 Max template instantiation recursion. More...
 
QStringList mCheckUnknownFunctionReturn
 

Static Private Attributes

static ProjectFilemActiveProject
 

Detailed Description

A class that reads and writes project files.

The project files contain project-specific settings for checking. For example a list of include paths.

Definition at line 46 of file projectfile.h.

Member Enumeration Documentation

◆ CheckLevel

Enumerator
normal 
exhaustive 

Definition at line 56 of file projectfile.h.

Constructor & Destructor Documentation

◆ ProjectFile() [1/2]

ProjectFile::ProjectFile ( QObject *  parent = nullptr)
explicit

Definition at line 44 of file projectfile.cpp.

References clear().

◆ ProjectFile() [2/2]

ProjectFile::ProjectFile ( QString  filename,
QObject *  parent = nullptr 
)
explicit

Definition at line 50 of file projectfile.cpp.

References clear(), and read().

◆ ~ProjectFile()

ProjectFile::~ProjectFile ( )
inlineoverride

Definition at line 52 of file projectfile.h.

References mActiveProject.

Member Function Documentation

◆ addSuppression()

void ProjectFile::addSuppression ( const SuppressionList::Suppression suppression)

Add suppression.

Definition at line 780 of file projectfile.cpp.

References mSuppressions.

Referenced by ResultsTree::suppressHash().

◆ clear()

void ProjectFile::clear ( )
private

◆ fromNativeSeparators()

QStringList ProjectFile::fromNativeSeparators ( const QStringList &  paths)
staticprivate

Convert paths.

Definition at line 1050 of file projectfile.cpp.

Referenced by getCheckPaths(), getExcludedPaths(), and getIncludeDirs().

◆ getActiveProject()

static ProjectFile* ProjectFile::getActiveProject ( )
inlinestatic

◆ getAddonFilePath()

QString ProjectFile::getAddonFilePath ( QString  filesDir,
const QString &  addon 
)
static

Get path to addon python script.

Parameters
filesDirData files folder set by –data-dir
addonaddon i.e. "misra" to lookup

Definition at line 1132 of file projectfile.cpp.

Referenced by MainWindow::loadAddon(), and updateAddonCheckBox().

◆ getAddons()

const QStringList& ProjectFile::getAddons ( ) const
inline

◆ getAddonsAndTools()

QStringList ProjectFile::getAddonsAndTools ( ) const

Get list of addons and tools.

Returns
list of addons and tools.

Definition at line 1058 of file projectfile.cpp.

References CLANG_ANALYZER, CLANG_TIDY, mAddons, mClangAnalyzer, and mClangTidy.

Referenced by MainWindow::analyzeProject(), MainWindow::doAnalyzeFiles(), and MainWindow::doAnalyzeProject().

◆ getAnalyzeAllVsConfigs()

bool ProjectFile::getAnalyzeAllVsConfigs ( ) const
inline

◆ getBughunting()

bool ProjectFile::getBughunting ( ) const
inline

◆ getBuildDir()

const QString& ProjectFile::getBuildDir ( ) const
inline

◆ getCertIntPrecision()

int ProjectFile::getCertIntPrecision ( ) const
inline

◆ getCheckHeaders()

bool ProjectFile::getCheckHeaders ( ) const
inline

◆ getCheckingSuppressions()

QList< SuppressionList::Suppression > ProjectFile::getCheckingSuppressions ( ) const

Get "checking" suppressions.

Relative paths are converted to absolute paths.

Returns
list of suppressions.

Definition at line 760 of file projectfile.cpp.

References mFilename, and mSuppressions.

Referenced by MainWindow::doAnalyzeFiles(), and MainWindow::getCppcheckSettings().

◆ getCheckPaths()

QStringList ProjectFile::getCheckPaths ( ) const
inline

Get list of paths to check.

Returns
list of paths.

Definition at line 138 of file projectfile.h.

References fromNativeSeparators(), and mPaths.

Referenced by MainWindow::analyzeProject(), ProjectFileDialog::loadFromProjectFile(), ComplianceReportDialog::save(), and StatsDialog::setProject().

◆ getCheckUnknownFunctionReturn()

const QStringList& ProjectFile::getCheckUnknownFunctionReturn ( ) const
inline

Check unknown function return values.

Definition at line 417 of file projectfile.h.

References mCheckUnknownFunctionReturn.

Referenced by MainWindow::getCppcheckSettings().

◆ getCheckUnusedTemplates()

bool ProjectFile::getCheckUnusedTemplates ( ) const
inline

◆ getClangAnalyzer()

bool ProjectFile::getClangAnalyzer ( ) const
inline

◆ getClangTidy()

bool ProjectFile::getClangTidy ( ) const
inline

Definition at line 225 of file projectfile.h.

References mClangTidy.

Referenced by ProjectFileDialog::loadFromProjectFile(), and StatsDialog::setProject().

◆ getCodingStandards()

const QStringList& ProjectFile::getCodingStandards ( ) const
inline

Get list of coding standards (checked by Cppcheck Premium).

Definition at line 370 of file projectfile.h.

References mCodingStandards.

Referenced by ComplianceReportDialog::ComplianceReportDialog(), MainWindow::enableCheckButtons(), MainWindow::getCppcheckSettings(), and ProjectFileDialog::loadFromProjectFile().

◆ getDefines()

const QStringList& ProjectFile::getDefines ( ) const
inline

Get list of defines.

Returns
list of defines.

Definition at line 122 of file projectfile.h.

References mDefines.

Referenced by MainWindow::getCppcheckSettings(), ProjectFileDialog::loadFromProjectFile(), and StatsDialog::setProject().

◆ getExcludedPaths()

QStringList ProjectFile::getExcludedPaths ( ) const
inline

Get list of paths to exclude from the check.

Returns
list of paths.

Definition at line 146 of file projectfile.h.

References fromNativeSeparators(), and mExcludedPaths.

Referenced by MainWindow::doAnalyzeFiles(), MainWindow::doAnalyzeProject(), ProjectFileDialog::loadFromProjectFile(), MainWindow::reAnalyzeSelected(), and ComplianceReportDialog::save().

◆ getFilename()

const QString& ProjectFile::getFilename ( ) const
inline

◆ getImportProject()

const QString& ProjectFile::getImportProject ( ) const
inline

◆ getIncludeDirs()

QStringList ProjectFile::getIncludeDirs ( ) const
inline

Get list of include directories.

Returns
list of directories.

Definition at line 114 of file projectfile.h.

References fromNativeSeparators(), and mIncludeDirs.

Referenced by MainWindow::getCppcheckSettings(), ProjectFileDialog::loadFromProjectFile(), and StatsDialog::setProject().

◆ getLibraries()

const QStringList& ProjectFile::getLibraries ( ) const
inline

Get list libraries.

Returns
list of libraries.

Definition at line 162 of file projectfile.h.

References mLibraries.

Referenced by MainWindow::getCppcheckSettings(), and ProjectFileDialog::loadFromProjectFile().

◆ getMaxCtuDepth()

int ProjectFile::getMaxCtuDepth ( ) const
inline

◆ getMaxTemplateRecursion()

int ProjectFile::getMaxTemplateRecursion ( ) const
inline

◆ getPlatform()

const QString& ProjectFile::getPlatform ( ) const
inline

Get platform.

Returns
Current platform. If it ends with .xml then it is a file. Otherwise it must match one of the return values from
See also
cppcheck::Platform::toString() ("win32A", "unix32", ..)

Definition at line 170 of file projectfile.h.

References mPlatform.

Referenced by MainWindow::getCppcheckSettings(), and ProjectFileDialog::loadFromProjectFile().

◆ getProjectName()

const QString& ProjectFile::getProjectName ( ) const
inline

◆ getRootPath()

const QString& ProjectFile::getRootPath ( ) const
inline

Get project root path.

Returns
project root path.

Definition at line 78 of file projectfile.h.

References mRootPath.

Referenced by MainWindow::analyzeProject(), ProjectFileDialog::loadFromProjectFile(), and StatsDialog::setProject().

◆ getSuppressions()

const QList<SuppressionList::Suppression>& ProjectFile::getSuppressions ( ) const
inline

Get "raw" suppressions.

Returns
list of suppressions.

Definition at line 186 of file projectfile.h.

References mSuppressions.

Referenced by MainWindow::doAnalyzeProject(), ProjectFileDialog::loadFromProjectFile(), ComplianceReportDialog::save(), and MainWindow::suppressIds().

◆ getTags()

const QStringList& ProjectFile::getTags ( ) const
inline

Definition at line 233 of file projectfile.h.

References mTags.

Referenced by ResultsTree::contextMenuEvent(), and ProjectFileDialog::loadFromProjectFile().

◆ getUndefines()

const QStringList& ProjectFile::getUndefines ( ) const
inline

Get list of undefines.

Returns
list of undefines.

Definition at line 130 of file projectfile.h.

References mUndefines.

Referenced by MainWindow::getCppcheckSettings(), ProjectFileDialog::loadFromProjectFile(), and StatsDialog::setProject().

◆ getVsConfigurations()

const QStringList& ProjectFile::getVsConfigurations ( ) const
inline

Get list of paths to exclude from the check.

Returns
list of paths.

Definition at line 154 of file projectfile.h.

References mVsConfigurations.

Referenced by MainWindow::doAnalyzeProject(), and ProjectFileDialog::loadFromProjectFile().

◆ getWarningTags()

QString ProjectFile::getWarningTags ( std::size_t  hash) const

Get tags for a warning.

Definition at line 813 of file projectfile.cpp.

References mWarningTags.

◆ isCheckLevelExhaustive()

bool ProjectFile::isCheckLevelExhaustive ( ) const

◆ read()

bool ProjectFile::read ( const QString &  filename = QString())

Read the project file.

Parameters
filenameFilename (can be also given to constructor).

Definition at line 94 of file projectfile.cpp.

References CppcheckXml::AddonElementName, CppcheckXml::AddonsElementName, CppcheckXml::AnalyzeAllVsConfigsElementName, CppcheckXml::BughuntingElementName, CppcheckXml::BuildDirElementName, CppcheckXml::CertIntPrecisionElementName, CppcheckXml::CheckHeadersElementName, CppcheckXml::CheckLevelExhaustiveElementName, CppcheckXml::CheckUnknownFunctionReturn, CppcheckXml::CheckUnusedTemplatesElementName, CLANG_ANALYZER, CLANG_TIDY, clangParser, clear(), CppcheckXml::CodingStandardElementName, CppcheckXml::CodingStandardsElementName, CppcheckXml::DefinesElementName, CppcheckXml::ExcludeElementName, exhaustive, CppcheckXml::IgnoreElementName, CppcheckXml::ImportProjectElementName, CppcheckXml::IncludeDirElementName, CppcheckXml::LibrariesElementName, CppcheckXml::LibraryElementName, ProjectFile::SafeChecks::loadFromXml(), mAddons, mAnalyzeAllVsConfigs, CppcheckXml::MaxCtuDepthElementName, CppcheckXml::MaxTemplateRecursionElementName, mBughunting, mCertIntPrecision, mCheckHeaders, mCheckLevel, mCheckUnknownFunctionReturn, mCheckUnusedTemplates, mClangAnalyzer, mClangTidy, mCodingStandards, mFilename, mLibraries, mMaxCtuDepth, mMaxTemplateRecursion, mProjectName, mTags, mUndefines, CppcheckXml::Name, CppcheckXml::Parser, CppcheckXml::PathsElementName, CppcheckXml::PlatformElementName, CppcheckXml::ProjectElementName, CppcheckXml::ProjectNameElementName, readBool(), readBuildDir(), readCheckPaths(), readDefines(), readExcludes(), readImportProject(), readIncludeDirs(), readInt(), readPlatform(), readRootPath(), readString(), readStringList(), readSuppressions(), readTagWarnings(), readVsConfigurations(), CppcheckXml::RootPathName, safeChecks, CppcheckXml::SuppressionsElementName, CppcheckXml::TagAttributeName, CppcheckXml::TagElementName, CppcheckXml::TagsElementName, CppcheckXml::TagWarningsElementName, CppcheckXml::ToolElementName, CppcheckXml::ToolsElementName, toString(), CppcheckXml::UndefineName, CppcheckXml::UndefinesElementName, CppcheckXml::VSConfigurationElementName, and Settings::SafeChecks::XmlRootName.

Referenced by MainWindow::loadSettings(), and ProjectFile().

◆ readBool()

bool ProjectFile::readBool ( QXmlStreamReader &  reader)
staticprotected

Definition at line 312 of file projectfile.cpp.

References FALLTHROUGH.

Referenced by read().

◆ readBuildDir()

void ProjectFile::readBuildDir ( QXmlStreamReader &  reader)
protected

Definition at line 260 of file projectfile.cpp.

References FALLTHROUGH, and mBuildDir.

Referenced by read().

◆ readCheckPaths()

void ProjectFile::readCheckPaths ( QXmlStreamReader &  reader)
protected

Read list paths to check.

Parameters
readerXML stream reader.

Definition at line 463 of file projectfile.cpp.

References mPaths, CppcheckXml::PathName, CppcheckXml::PathNameAttrib, and CppcheckXml::PathsElementName.

Referenced by read().

◆ readDefines()

void ProjectFile::readDefines ( QXmlStreamReader &  reader)
protected

Read list of defines from XML.

Parameters
readerXML stream reader.

Definition at line 427 of file projectfile.cpp.

References CppcheckXml::DefineName, CppcheckXml::DefineNameAttrib, CppcheckXml::DefinesElementName, and mDefines.

Referenced by read().

◆ readExcludes()

void ProjectFile::readExcludes ( QXmlStreamReader &  reader)
protected

◆ readImportProject()

void ProjectFile::readImportProject ( QXmlStreamReader &  reader)
protected

Read importproject from XML.

Parameters
readerXML stream reader.

Definition at line 286 of file projectfile.cpp.

References FALLTHROUGH, and mImportProject.

Referenced by read().

◆ readIncludeDirs()

void ProjectFile::readIncludeDirs ( QXmlStreamReader &  reader)
protected

Read list of include directories from XML.

Parameters
readerXML stream reader.

Definition at line 390 of file projectfile.cpp.

References CppcheckXml::DirElementName, CppcheckXml::DirNameAttrib, CppcheckXml::IncludeDirElementName, and mIncludeDirs.

Referenced by read().

◆ readInt()

int ProjectFile::readInt ( QXmlStreamReader &  reader,
int  defaultValue 
)
staticprotected

Definition at line 338 of file projectfile.cpp.

References FALLTHROUGH.

Referenced by read().

◆ readPlatform()

void ProjectFile::readPlatform ( QXmlStreamReader &  reader)
protected

Read platform text.

Parameters
readerXML stream reader.

Definition at line 582 of file projectfile.cpp.

References FALLTHROUGH, and mPlatform.

Referenced by read().

◆ readRootPath()

void ProjectFile::readRootPath ( const QXmlStreamReader &  reader)
protected

Read optional root path from XML.

Parameters
readerXML stream reader.

Definition at line 252 of file projectfile.cpp.

References mRootPath, and CppcheckXml::RootPathNameAttrib.

Referenced by read().

◆ readString()

QString ProjectFile::readString ( QXmlStreamReader &  reader)
staticprotected

Definition at line 364 of file projectfile.cpp.

References FALLTHROUGH.

Referenced by read().

◆ readStringList()

void ProjectFile::readStringList ( QStringList &  stringlist,
QXmlStreamReader &  reader,
const char  elementname[] 
)
staticprotected

Read string list.

Parameters
stringlistdestination string list
readerXML stream reader
elementnameelementname for each string

Definition at line 688 of file projectfile.cpp.

Referenced by read().

◆ readSuppressions()

void ProjectFile::readSuppressions ( QXmlStreamReader &  reader)
protected

◆ readTagWarnings()

void ProjectFile::readTagWarnings ( QXmlStreamReader &  reader,
const QString &  tag 
)
protected

Read tag warnings, what warnings are tagged with a specific tag.

Parameters
readerXML stream reader.

Definition at line 654 of file projectfile.cpp.

References CppcheckXml::HashAttributeName, mWarningTags, and CppcheckXml::WarningElementName.

Referenced by read().

◆ readVsConfigurations()

void ProjectFile::readVsConfigurations ( QXmlStreamReader &  reader)
protected

Read lists of Visual Studio configurations.

Parameters
readerXML stream reader.

Definition at line 545 of file projectfile.cpp.

References mVsConfigurations, and CppcheckXml::VSConfigurationName.

Referenced by read().

◆ setActiveProject()

void ProjectFile::setActiveProject ( )
inline

◆ setAddons()

void ProjectFile::setAddons ( const QStringList &  addons)

Set list of addons.

Parameters
addonsList of addons.

Definition at line 785 of file projectfile.cpp.

References mAddons.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setAnalyzeAllVsConfigs()

void ProjectFile::setAnalyzeAllVsConfigs ( bool  b)
inline

Definition at line 277 of file projectfile.h.

References mAnalyzeAllVsConfigs.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setBughunting()

void ProjectFile::setBughunting ( bool  bughunting)
inline

Bughunting (Cppcheck Premium)

Definition at line 362 of file projectfile.h.

References mBughunting.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setBuildDir()

void ProjectFile::setBuildDir ( const QString &  buildDir)
inline

Definition at line 269 of file projectfile.h.

References mBuildDir.

Referenced by MainWindow::newProjectFile(), and ProjectFileDialog::saveToProjectFile().

◆ setCertIntPrecision()

void ProjectFile::setCertIntPrecision ( int  p)
inline

Cert C: int precision.

Definition at line 383 of file projectfile.h.

References mCertIntPrecision.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setCheckHeaders()

void ProjectFile::setCheckHeaders ( bool  b)
inline

Definition at line 98 of file projectfile.h.

References mCheckHeaders.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setCheckLevel()

void ProjectFile::setCheckLevel ( ProjectFile::CheckLevel  checkLevel)

CheckLevel: normal/exhaustive.

Definition at line 795 of file projectfile.cpp.

References mCheckLevel.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setCheckPaths()

void ProjectFile::setCheckPaths ( const QStringList &  paths)

Set list of paths to check.

Parameters
pathsList of paths.

Definition at line 740 of file projectfile.cpp.

References mPaths.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setCheckUnusedTemplates()

void ProjectFile::setCheckUnusedTemplates ( bool  b)
inline

Definition at line 106 of file projectfile.h.

References mCheckUnusedTemplates.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setClangAnalyzer()

void ProjectFile::setClangAnalyzer ( bool  c)
inline

Definition at line 221 of file projectfile.h.

References mClangAnalyzer.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setClangTidy()

void ProjectFile::setClangTidy ( bool  c)
inline

Definition at line 229 of file projectfile.h.

References mClangTidy.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setCodingStandards()

void ProjectFile::setCodingStandards ( QStringList  codingStandards)
inline

Set list of coding standards (checked by Cppcheck Premium).

Parameters
codingStandardsList of coding standards.

Definition at line 378 of file projectfile.h.

References mCodingStandards.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setDefines()

void ProjectFile::setDefines ( const QStringList &  defines)

Set list of defines.

Parameters
definesList of defines.

Definition at line 730 of file projectfile.cpp.

References mDefines.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setExcludedPaths()

void ProjectFile::setExcludedPaths ( const QStringList &  paths)

Set list of paths to exclude from the check.

Parameters
pathsList of paths.

Definition at line 745 of file projectfile.cpp.

References mExcludedPaths.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setFilename()

void ProjectFile::setFilename ( const QString &  filename)
inline

Set filename for the project file.

Parameters
filenameFilename to use.

Definition at line 401 of file projectfile.h.

References mFilename.

Referenced by MainWindow::newProjectFile().

◆ setImportProject()

void ProjectFile::setImportProject ( const QString &  importProject)
inline

Definition at line 273 of file projectfile.h.

References mImportProject.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setIncludes()

void ProjectFile::setIncludes ( const QStringList &  includes)

Set list of includes.

Parameters
includesList of defines.

Definition at line 725 of file projectfile.cpp.

References mIncludeDirs.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setLibraries()

void ProjectFile::setLibraries ( const QStringList &  libraries)

Set list of libraries.

Parameters
librariesList of libraries.

Definition at line 750 of file projectfile.cpp.

References mLibraries.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setMaxCtuDepth()

void ProjectFile::setMaxCtuDepth ( int  maxCtuDepth)
inline

Definition at line 241 of file projectfile.h.

References CTU::maxCtuDepth, and mMaxCtuDepth.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setMaxTemplateRecursion()

void ProjectFile::setMaxTemplateRecursion ( int  maxTemplateRecursion)
inline

Definition at line 249 of file projectfile.h.

References mMaxTemplateRecursion.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setPlatform()

void ProjectFile::setPlatform ( const QString &  platform)

Set platform.

Parameters
platformplatform.

Definition at line 755 of file projectfile.cpp.

References mPlatform.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setProjectName()

void ProjectFile::setProjectName ( QString  projectName)
inline

Definition at line 178 of file projectfile.h.

References mProjectName.

Referenced by MainWindow::newProjectFile(), and ComplianceReportDialog::save().

◆ setRootPath()

void ProjectFile::setRootPath ( const QString &  rootpath)
inline

Set project root path.

Parameters
rootpathnew project root path.

Definition at line 265 of file projectfile.h.

References mRootPath.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setSuppressions()

void ProjectFile::setSuppressions ( const QList< SuppressionList::Suppression > &  suppressions)

Set list of suppressions.

Parameters
suppressionsList of suppressions.

Definition at line 775 of file projectfile.cpp.

References mSuppressions.

Referenced by ProjectFileDialog::saveToProjectFile(), and MainWindow::suppressIds().

◆ setTags()

void ProjectFile::setTags ( const QStringList &  tags)
inline

Set tags.

Parameters
tagstag list

Definition at line 351 of file projectfile.h.

References mTags.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setUndefines()

void ProjectFile::setUndefines ( const QStringList &  undefines)

Set list of undefines.

Parameters
undefinesList of undefines.

Definition at line 735 of file projectfile.cpp.

References mUndefines.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setVSConfigurations()

void ProjectFile::setVSConfigurations ( const QStringList &  vsConfigs)

Set list of Visual Studio configurations to be checked.

Parameters
vsConfigsList of configurations

Definition at line 790 of file projectfile.cpp.

References mVsConfigurations.

Referenced by ProjectFileDialog::saveToProjectFile().

◆ setWarningTags()

void ProjectFile::setWarningTags ( std::size_t  hash,
const QString &  tags 
)

Set tags for a warning.

Definition at line 805 of file projectfile.cpp.

References mWarningTags.

Referenced by ResultsTree::tagSelectedItems().

◆ write()

bool ProjectFile::write ( const QString &  filename = QString())

Write project file (to disk).

Parameters
filenameFilename to use.

Definition at line 819 of file projectfile.cpp.

References CppcheckXml::AddonElementName, CppcheckXml::AddonsElementName, CppcheckXml::AnalyzeAllVsConfigsElementName, bool_to_string(), CppcheckXml::BughuntingElementName, CppcheckXml::BuildDirElementName, CppcheckXml::CertIntPrecisionElementName, CppcheckXml::CheckHeadersElementName, CppcheckXml::CheckLevelExhaustiveElementName, CppcheckXml::CheckUnknownFunctionReturn, CppcheckXml::CheckUnusedTemplatesElementName, CLANG_ANALYZER, CLANG_TIDY, clangParser, CppcheckXml::CodingStandardElementName, CppcheckXml::CodingStandardsElementName, CppcheckXml::DefineName, CppcheckXml::DefineNameAttrib, CppcheckXml::DefinesElementName, CppcheckXml::DirElementName, CppcheckXml::DirNameAttrib, CppcheckXml::ExcludeElementName, CppcheckXml::ExcludePathName, CppcheckXml::ExcludePathNameAttrib, exhaustive, CppcheckXml::HashAttributeName, CppcheckXml::ImportProjectElementName, CppcheckXml::IncludeDirElementName, CppcheckXml::LibrariesElementName, CppcheckXml::LibraryElementName, mAddons, mAnalyzeAllVsConfigs, CppcheckXml::MaxCtuDepthElementName, CppcheckXml::MaxTemplateRecursionElementName, mBughunting, mBuildDir, mCertIntPrecision, mCheckHeaders, mCheckLevel, mCheckUnknownFunctionReturn, mCheckUnusedTemplates, mClangAnalyzer, mClangTidy, mCodingStandards, mDefines, mExcludedPaths, mFilename, mImportProject, mIncludeDirs, mLibraries, mMaxCtuDepth, mMaxTemplateRecursion, mPaths, mPlatform, mProjectName, mRootPath, mSuppressions, mTags, mUndefines, mVsConfigurations, mWarningTags, CppcheckXml::Name, CppcheckXml::Parser, CppcheckXml::PathName, CppcheckXml::PathNameAttrib, CppcheckXml::PathsElementName, CppcheckXml::PlatformElementName, CppcheckXml::ProjectElementName, CppcheckXml::ProjectFileVersion, CppcheckXml::ProjectNameElementName, CppcheckXml::ProjectVersionAttrib, CppcheckXml::RootPathName, CppcheckXml::RootPathNameAttrib, safeChecks, ProjectFile::SafeChecks::saveToXml(), CppcheckXml::SuppressionElementName, CppcheckXml::SuppressionsElementName, CppcheckXml::TagAttributeName, CppcheckXml::TagElementName, CppcheckXml::TagsElementName, CppcheckXml::TagWarningsElementName, CppcheckXml::ToolElementName, CppcheckXml::ToolsElementName, CppcheckXml::UndefineName, CppcheckXml::UndefinesElementName, CppcheckXml::VSConfigurationElementName, CppcheckXml::VSConfigurationName, CppcheckXml::WarningElementName, and writeStringList().

Referenced by MainWindow::editProjectFile(), ProjectFileDialog::ok(), ComplianceReportDialog::save(), ResultsTree::suppressHash(), MainWindow::suppressIds(), and ResultsTree::tagSelectedItems().

◆ writeStringList()

void ProjectFile::writeStringList ( QXmlStreamWriter &  xmlWriter,
const QStringList &  stringlist,
const char  startelementname[],
const char  stringelementname[] 
)
staticprotected

Write string list.

Parameters
xmlWriterxml writer
stringliststring list to write
startelementnamename of start element
stringelementnamename of each string element

Definition at line 1036 of file projectfile.cpp.

Referenced by write().

Member Data Documentation

◆ clangParser

bool ProjectFile::clangParser

◆ mActiveProject

ProjectFile * ProjectFile::mActiveProject
staticprivate

Definition at line 645 of file projectfile.h.

Referenced by getActiveProject(), setActiveProject(), and ~ProjectFile().

◆ mAddons

QStringList ProjectFile::mAddons
private

List of addons.

Definition at line 603 of file projectfile.h.

Referenced by clear(), getAddons(), getAddonsAndTools(), read(), setAddons(), and write().

◆ mAnalyzeAllVsConfigs

bool ProjectFile::mAnalyzeAllVsConfigs
private

Should all visual studio configurations be analyzed? If this is false then only the Debug configuration for the set platform is analyzed.

Definition at line 549 of file projectfile.h.

Referenced by clear(), getAnalyzeAllVsConfigs(), read(), setAnalyzeAllVsConfigs(), and write().

◆ mBughunting

bool ProjectFile::mBughunting = false
private

Definition at line 605 of file projectfile.h.

Referenced by clear(), getBughunting(), read(), setBughunting(), and write().

◆ mBuildDir

QString ProjectFile::mBuildDir
private

Cppcheck build dir.

Definition at line 539 of file projectfile.h.

Referenced by clear(), getBuildDir(), readBuildDir(), setBuildDir(), and write().

◆ mCertIntPrecision

int ProjectFile::mCertIntPrecision
private

Cppcheck Premium: This value is passed to the Cert C checker if that is enabled.

Definition at line 619 of file projectfile.h.

Referenced by clear(), getCertIntPrecision(), read(), setCertIntPrecision(), and write().

◆ mCheckHeaders

bool ProjectFile::mCheckHeaders
private

Check code in headers.

Definition at line 555 of file projectfile.h.

Referenced by clear(), getCheckHeaders(), read(), setCheckHeaders(), and write().

◆ mCheckLevel

CheckLevel ProjectFile::mCheckLevel = CheckLevel::normal
private

Should Cppcheck run normal or exhaustive analysis?

Definition at line 608 of file projectfile.h.

Referenced by clear(), isCheckLevelExhaustive(), read(), setCheckLevel(), and write().

◆ mCheckUnknownFunctionReturn

QStringList ProjectFile::mCheckUnknownFunctionReturn
private

Definition at line 643 of file projectfile.h.

Referenced by clear(), getCheckUnknownFunctionReturn(), read(), and write().

◆ mCheckUnusedTemplates

bool ProjectFile::mCheckUnusedTemplates
private

Check code in unused templates.

Definition at line 558 of file projectfile.h.

Referenced by clear(), getCheckUnusedTemplates(), read(), setCheckUnusedTemplates(), and write().

◆ mClangAnalyzer

bool ProjectFile::mClangAnalyzer
private

Execute clang analyzer?

Definition at line 622 of file projectfile.h.

Referenced by clear(), getAddonsAndTools(), read(), setClangAnalyzer(), and write().

◆ mClangTidy

bool ProjectFile::mClangTidy
private

Execute clang-tidy?

Definition at line 625 of file projectfile.h.

Referenced by clear(), getAddonsAndTools(), getClangTidy(), read(), setClangTidy(), and write().

◆ mCodingStandards

QStringList ProjectFile::mCodingStandards
private

List of coding standards, checked by Cppcheck Premium.

Definition at line 613 of file projectfile.h.

Referenced by clear(), getCodingStandards(), read(), setCodingStandards(), and write().

◆ mDefines

QStringList ProjectFile::mDefines
private

List of defines.

Definition at line 568 of file projectfile.h.

Referenced by clear(), getDefines(), readDefines(), setDefines(), and write().

◆ mExcludedPaths

QStringList ProjectFile::mExcludedPaths
private

Paths excluded from the check.

Definition at line 583 of file projectfile.h.

Referenced by clear(), getExcludedPaths(), readExcludes(), setExcludedPaths(), and write().

◆ mFilename

QString ProjectFile::mFilename
private

Filename (+path) of the project file.

Definition at line 528 of file projectfile.h.

Referenced by getCheckingSuppressions(), getFilename(), read(), setFilename(), and write().

◆ mImportProject

QString ProjectFile::mImportProject
private

Visual studio project/solution , compile database.

Definition at line 542 of file projectfile.h.

Referenced by clear(), getImportProject(), readImportProject(), setImportProject(), and write().

◆ mIncludeDirs

QStringList ProjectFile::mIncludeDirs
private

List of include directories used to search include files.

Definition at line 563 of file projectfile.h.

Referenced by clear(), getIncludeDirs(), readIncludeDirs(), setIncludes(), and write().

◆ mLibraries

QStringList ProjectFile::mLibraries
private

List of libraries.

Definition at line 588 of file projectfile.h.

Referenced by clear(), getLibraries(), read(), setLibraries(), and write().

◆ mMaxCtuDepth

int ProjectFile::mMaxCtuDepth
private

Max CTU depth.

Definition at line 638 of file projectfile.h.

Referenced by clear(), getMaxCtuDepth(), read(), setMaxCtuDepth(), and write().

◆ mMaxTemplateRecursion

int ProjectFile::mMaxTemplateRecursion
private

Max template instantiation recursion.

Definition at line 641 of file projectfile.h.

Referenced by clear(), getMaxTemplateRecursion(), read(), setMaxTemplateRecursion(), and write().

◆ mPaths

QStringList ProjectFile::mPaths
private

List of paths to check.

Definition at line 578 of file projectfile.h.

Referenced by clear(), getCheckPaths(), readCheckPaths(), setCheckPaths(), and write().

◆ mPlatform

QString ProjectFile::mPlatform
private

Platform.

Definition at line 593 of file projectfile.h.

Referenced by clear(), getPlatform(), readPlatform(), setPlatform(), and write().

◆ mProjectName

QString ProjectFile::mProjectName
private

Project name, used when generating compliance report.

Definition at line 616 of file projectfile.h.

Referenced by clear(), getProjectName(), read(), setProjectName(), and write().

◆ mRootPath

QString ProjectFile::mRootPath
private

Root path (optional) for the project.

This is the project root path. If it is present then all relative paths in the project file are relative to this path. Otherwise paths are relative to project file's path.

Definition at line 536 of file projectfile.h.

Referenced by clear(), getRootPath(), readRootPath(), setRootPath(), and write().

◆ mSuppressions

QList<SuppressionList::Suppression> ProjectFile::mSuppressions
private

List of suppressions.

Definition at line 598 of file projectfile.h.

Referenced by addSuppression(), clear(), getCheckingSuppressions(), getSuppressions(), readSuppressions(), setSuppressions(), and write().

◆ mTags

QStringList ProjectFile::mTags
private

Tags.

Definition at line 630 of file projectfile.h.

Referenced by clear(), getTags(), read(), setTags(), and write().

◆ mUndefines

QStringList ProjectFile::mUndefines
private

List of undefines.

Definition at line 573 of file projectfile.h.

Referenced by clear(), getUndefines(), read(), setUndefines(), and write().

◆ mVsConfigurations

QStringList ProjectFile::mVsConfigurations
private

Check only a selected VS configuration.

Definition at line 552 of file projectfile.h.

Referenced by clear(), getVsConfigurations(), readVsConfigurations(), setVSConfigurations(), and write().

◆ mWarningTags

std::map<std::size_t, QString> ProjectFile::mWarningTags
private

Warning tags.

Definition at line 635 of file projectfile.h.

Referenced by clear(), getWarningTags(), readTagWarnings(), setWarningTags(), and write().

◆ safeChecks

SafeChecks ProjectFile::safeChecks

The documentation for this class was generated from the following files: