Cppcheck
Public Member Functions | Protected Member Functions | Private Attributes
ProjectFile Class Reference

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

#include <projectfile.h>

List of all members.

Public Member Functions

 ProjectFile (QObject *parent=0)
 ProjectFile (const QString &filename, QObject *parent=0)
bool Read (const QString &filename=QString())
 Read the project file.
QString GetRootPath () const
 Get project root path.
QStringList GetIncludeDirs () const
 Get list of include directories.
QStringList GetDefines () const
 Get list of defines.
QStringList GetCheckPaths () const
 Get list of paths to check.
QStringList GetExcludedPaths () const
 Get list of paths to exclude from the check.
QString GetFilename () const
 Get filename for the project file.
void SetRootPath (const QString &rootpath)
 Set project root path.
void SetIncludes (const QStringList &includes)
 Set list of includes.
void SetDefines (const QStringList &defines)
 Set list of defines.
void SetCheckPaths (const QStringList &paths)
 Set list of paths to check.
void SetExcludedPaths (const QStringList &paths)
 Set list of paths to exclude from the check.
bool Write (const QString &filename=QString())
 Write project file (to disk).
void SetFilename (const QString &filename)
 Set filename for the project file.

Protected Member Functions

void ReadRootPath (QXmlStreamReader &reader)
 Read optional root path from XML.
void ReadIncludeDirs (QXmlStreamReader &reader)
 Read list of include directories from XML.
void ReadDefines (QXmlStreamReader &reader)
 Read list of defines from XML.
void ReadCheckPaths (QXmlStreamReader &reader)
 Read list paths to check.
void ReadExcludes (QXmlStreamReader &reader)
 Read lists of excluded paths.

Private Attributes

QString mFilename
 Filename (+path) of the project file.
QString mRootPath
 Root path (optional) for the project.
QStringList mIncludeDirs
 List of include directories used to search include files.
QStringList mDefines
 List of defines.
QStringList mPaths
 List of paths to check.
QStringList mExcludedPaths
 Paths excluded from the check.

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 36 of file projectfile.h.


Constructor & Destructor Documentation

ProjectFile::ProjectFile ( QObject *  parent = 0)

Definition at line 48 of file projectfile.cpp.

ProjectFile::ProjectFile ( const QString &  filename,
QObject *  parent = 0 
)

Definition at line 53 of file projectfile.cpp.


Member Function Documentation

QStringList ProjectFile::GetCheckPaths ( ) const

Get list of paths to check.

Returns:
list of paths.

Definition at line 145 of file projectfile.cpp.

References mPaths.

Referenced by MainWindow::CheckProject(), Project::Edit(), and StatsDialog::setProject().

QStringList ProjectFile::GetDefines ( ) const

Get list of defines.

Returns:
list of defines.

Definition at line 140 of file projectfile.cpp.

References mDefines.

Referenced by Project::Edit(), MainWindow::GetCppcheckSettings(), and StatsDialog::setProject().

QStringList ProjectFile::GetExcludedPaths ( ) const

Get list of paths to exclude from the check.

Returns:
list of paths.

Definition at line 154 of file projectfile.cpp.

References mExcludedPaths.

Referenced by MainWindow::DoCheckFiles(), and Project::Edit().

QString ProjectFile::GetFilename ( ) const [inline]

Get filename for the project file.

Returns:
file name.

Definition at line 85 of file projectfile.h.

References mFilename.

Referenced by MainWindow::DoCheckFiles(), and MainWindow::ReCheck().

QStringList ProjectFile::GetIncludeDirs ( ) const

Get list of include directories.

Returns:
list of directories.

Definition at line 131 of file projectfile.cpp.

References mIncludeDirs.

Referenced by Project::Edit(), MainWindow::GetCppcheckSettings(), and StatsDialog::setProject().

QString ProjectFile::GetRootPath ( ) const [inline]

Get project root path.

Returns:
project root path.

Definition at line 53 of file projectfile.h.

References mRootPath.

Referenced by MainWindow::CheckProject(), Project::Edit(), and StatsDialog::setProject().

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

Read the project file.

Parameters:
filenameFilename (can be also given to constructor).

Definition at line 59 of file projectfile.cpp.

References DefinesElementName, ExcludeElementName, IgnoreElementName, IncludeDirElementName, mFilename, PathsElementName, ProjectElementName, ReadCheckPaths(), ReadDefines(), ReadExcludes(), ReadIncludeDirs(), ReadRootPath(), and RootPathName.

Referenced by Project::Open().

void ProjectFile::ReadCheckPaths ( QXmlStreamReader &  reader) [protected]

Read list paths to check.

Parameters:
readerXML stream reader.

Definition at line 246 of file projectfile.cpp.

References mPaths, PathName, PathNameAttrib, and PathsElementName.

Referenced by Read().

void ProjectFile::ReadDefines ( QXmlStreamReader &  reader) [protected]

Read list of defines from XML.

Parameters:
readerXML stream reader.

Definition at line 209 of file projectfile.cpp.

References DefineName, DefineNameAttrib, DefinesElementName, and mDefines.

Referenced by Read().

void ProjectFile::ReadExcludes ( QXmlStreamReader &  reader) [protected]

Read lists of excluded paths.

Parameters:
readerXML stream reader.

Definition at line 284 of file projectfile.cpp.

References ExcludeElementName, ExcludePathName, ExcludePathNameAttrib, IgnoreElementName, IgnorePathName, IgnorePathNameAttrib, and mExcludedPaths.

Referenced by Read().

void ProjectFile::ReadIncludeDirs ( QXmlStreamReader &  reader) [protected]

Read list of include directories from XML.

Parameters:
readerXML stream reader.

Definition at line 171 of file projectfile.cpp.

References DirElementName, DirNameAttrib, IncludeDirElementName, and mIncludeDirs.

Referenced by Read().

void ProjectFile::ReadRootPath ( QXmlStreamReader &  reader) [protected]

Read optional root path from XML.

Parameters:
readerXML stream reader.

Definition at line 163 of file projectfile.cpp.

References mRootPath, and RootPathNameAttrib.

Referenced by Read().

void ProjectFile::SetCheckPaths ( const QStringList &  paths)

Set list of paths to check.

Parameters:
pathsList of paths.

Definition at line 340 of file projectfile.cpp.

References mPaths.

Referenced by Project::Edit().

void ProjectFile::SetDefines ( const QStringList &  defines)

Set list of defines.

Parameters:
definesList of defines.

Definition at line 335 of file projectfile.cpp.

References mDefines.

Referenced by Project::Edit().

void ProjectFile::SetExcludedPaths ( const QStringList &  paths)

Set list of paths to exclude from the check.

Parameters:
pathsList of paths.

Definition at line 345 of file projectfile.cpp.

References mExcludedPaths.

Referenced by Project::Edit().

void ProjectFile::SetFilename ( const QString &  filename) [inline]

Set filename for the project file.

Parameters:
filenameFilename to use.

Definition at line 131 of file projectfile.h.

References mFilename.

Referenced by Project::Open().

void ProjectFile::SetIncludes ( const QStringList &  includes)

Set list of includes.

Parameters:
includesList of defines.

Definition at line 330 of file projectfile.cpp.

References mIncludeDirs.

Referenced by Project::Edit().

void ProjectFile::SetRootPath ( const QString &  rootpath) [inline]

Set project root path.

Parameters:
rootpathnew project root path.

Definition at line 93 of file projectfile.h.

References mRootPath.

Referenced by Project::Edit().

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

Member Data Documentation

QStringList ProjectFile::mDefines [private]

List of defines.

Definition at line 190 of file projectfile.h.

Referenced by GetDefines(), ReadDefines(), SetDefines(), and Write().

QStringList ProjectFile::mExcludedPaths [private]

Paths excluded from the check.

Definition at line 200 of file projectfile.h.

Referenced by GetExcludedPaths(), ReadExcludes(), SetExcludedPaths(), and Write().

QString ProjectFile::mFilename [private]

Filename (+path) of the project file.

Definition at line 172 of file projectfile.h.

Referenced by GetFilename(), Read(), SetFilename(), and Write().

QStringList ProjectFile::mIncludeDirs [private]

List of include directories used to search include files.

Definition at line 185 of file projectfile.h.

Referenced by GetIncludeDirs(), ReadIncludeDirs(), SetIncludes(), and Write().

QStringList ProjectFile::mPaths [private]

List of paths to check.

Definition at line 195 of file projectfile.h.

Referenced by GetCheckPaths(), ReadCheckPaths(), SetCheckPaths(), and Write().

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 180 of file projectfile.h.

Referenced by GetRootPath(), ReadRootPath(), SetRootPath(), and Write().


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