GUI: Updated online-help. This is still under work.

This commit is contained in:
Daniel Marjamäki 2010-08-20 21:25:43 +02:00
parent 7b2b844b8e
commit 06b9cdb679
30 changed files with 351 additions and 20 deletions

View File

@ -1,7 +1,7 @@
TEMPLATE = app
TARGET = gui
QT += xml
CONFIG += warn_on
CONFIG += warn_on help
DEPENDPATH += . \
../lib
INCLUDEPATH += . \
@ -29,7 +29,8 @@ FORMS = main.ui \
file.ui \
projectfile.ui \
about.ui \
logview.ui
logview.ui \
helpwindow.ui
TRANSLATIONS = cppcheck_fi.ts \
cppcheck_nl.ts \
@ -65,7 +66,8 @@ HEADERS += mainwindow.h \
translationhandler.h \
csvreport.h \
logview.h \
filelist.h
filelist.h \
helpwindow.h
SOURCES += main.cpp \
mainwindow.cpp\
@ -89,7 +91,8 @@ SOURCES += main.cpp \
translationhandler.cpp \
csvreport.cpp \
logview.cpp \
filelist.cpp
filelist.cpp \
helpwindow.cpp
win32 {
DEFINES += _CRT_SECURE_NO_WARNINGS

View File

@ -14,8 +14,6 @@
<file>images/view-refresh.png</file>
<file>images/showerrors.png</file>
<file>images/showstylewarnings.png</file>
<file>help/online-help.qhc</file>
<file alias="COPYING">../COPYING</file>
<file alias="AUTHORS">../AUTHORS</file>

13
gui/help/ch01.html Normal file
View File

@ -0,0 +1,13 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 1. Introduction</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="index.html" title="Cppcheck 1.44"><link rel="next" href="ch02.html" title="Chapter 2. Getting started"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Introduction</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 1. Introduction"><div class="titlepage"><div><div><h2 class="title"><a name="id2602221"></a>Chapter 1. Introduction</h2></div></div></div><p>Cppcheck is an analysis tool for C/C++ code. Unlike C/C++ compilers
and many other analysis tools, it doesn't detect syntax errors. Cppcheck
only detects the types of bugs that the compilers normally fail to detect.
The goal is no false positives.</p><p>Supported code and platforms:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>You can check non-standard code that includes various compiler
extensions, inline assembly code, etc.</p></li><li class="listitem"><p>Cppcheck should be compilable by any C++ compiler that handles
the latest C++ standard.</p></li><li class="listitem"><p>Cppcheck should work on any platform that has sufficient cpu and
memory.</p></li></ul></div><p>Accuracy</p><p>Please understand that there are limits of Cppcheck. Cppcheck is
rarely wrong about reported errors. But there are many bugs that it
doesn't detect.</p><p>You will find more bugs in your software by testing your software
carefully, than by using Cppcheck. You will find more bugs in your
software by instrumenting your software, than by using Cppcheck. But
Cppcheck can still detect some of the bugs that you miss when testing and
instrumenting your software.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Cppcheck 1.44 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 2. Getting started</td></tr></table></div></body></html>

8
gui/help/ch02.html Normal file
View File

@ -0,0 +1,8 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 2. Getting started</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch01.html" title="Chapter 1. Introduction"><link rel="next" href="ch02s02.html" title="Checking all files in a folder"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. Getting started</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch01.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch02s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 2. Getting started"><div class="titlepage"><div><div><h2 class="title"><a name="id2607467"></a>Chapter 2. Getting started</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch02.html#id2623157">First test</a></span></dt><dt><span class="section"><a href="ch02s02.html">Checking all files in a folder</a></span></dt><dt><span class="section"><a href="ch02s03.html">Excluding a file or folder from checking</a></span></dt><dt><span class="section"><a href="ch02s04.html">Stylistic issues</a></span></dt><dt><span class="section"><a href="ch02s05.html">Saving results in file</a></span></dt><dt><span class="section"><a href="ch02s06.html">Unused functions</a></span></dt><dt><span class="section"><a href="ch02s07.html">Enable all checks</a></span></dt><dt><span class="section"><a href="ch02s08.html">Multithreaded checking</a></span></dt></dl></div><div class="section" title="First test"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2623157"></a>First test</h2></div></div></div><p>Here is a simple code</p><pre class="programlisting">int main()
{
char a[10];
a[10] = 0;
return 0;
}</pre><p>If you save that into <code class="filename">file1.c</code> and
execute:</p><pre class="programlisting">cppcheck file1.c</pre><p>The output from cppcheck will then be:</p><pre class="programlisting">Checking file1.c...
[file1.c:4]: (error) Array 'a[10]' index 10 out of bounds</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch02s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 1. Introduction </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Checking all files in a folder</td></tr></table></div></body></html>

6
gui/help/ch02s02.html Normal file
View File

@ -0,0 +1,6 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Checking all files in a folder</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02.html" title="Chapter 2. Getting started"><link rel="next" href="ch02s03.html" title="Excluding a file or folder from checking"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Checking all files in a folder</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr></table><hr></div><div class="section" title="Checking all files in a folder"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2622001"></a>Checking all files in a folder</h2></div></div></div><p>Normally a program has many sourcefiles. And you want to check
them all. Cppcheck can check all sourcefiles in a directory:</p><pre class="programlisting">cppcheck path</pre><p>If "path" is a folder then cppcheck will check all sourcefiles in
this folder.</p><pre class="programlisting">Checking path/file1.cpp...
1/2 files checked 50% done
Checking path/file2.cpp...
2/2 files checked 100% done</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Getting started </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Excluding a file or folder from checking</td></tr></table></div></body></html>

5
gui/help/ch02s03.html Normal file
View File

@ -0,0 +1,5 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Excluding a file or folder from checking</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02s02.html" title="Checking all files in a folder"><link rel="next" href="ch02s04.html" title="Stylistic issues"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Excluding a file or folder from checking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr></table><hr></div><div class="section" title="Excluding a file or folder from checking"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2634899"></a>Excluding a file or folder from checking</h2></div></div></div><p>There is no command to exclude a file or folder from checking. But
you can exclude a file or folder by being more careful when including
files and folders in the checking.</p><p>Imagine for example that the folder "src" contain the folders "a",
"b" and "c". To exclude "c" this command can be used:</p><pre class="programlisting">cppcheck src/a src/b</pre><p>All files under "src/a" and "src/b" are then checked.</p><p>The flag <code class="literal">--file-list</code> might also be
useful.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Checking all files in a folder </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Stylistic issues</td></tr></table></div></body></html>

9
gui/help/ch02s04.html Normal file
View File

@ -0,0 +1,9 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Stylistic issues</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02s03.html" title="Excluding a file or folder from checking"><link rel="next" href="ch02s05.html" title="Saving results in file"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Stylistic issues</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch02s05.html">Next</a></td></tr></table><hr></div><div class="section" title="Stylistic issues"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2634936"></a>Stylistic issues</h2></div></div></div><p>By default Cppcheck will only check for bugs. There are also a few
checks for stylistic issues.</p><p>Here is a simple code example:</p><pre class="programlisting">void f(int x)
{
int i;
if (x == 0)
{
i = 0;
}
}</pre><p>To enable stylistic checks, use the --style flag:</p><pre class="programlisting">cppcheck --enable=style file1.c</pre><p>The reported error is:</p><pre class="programlisting">[file3.c:3]: (style) The scope of the variable i can be limited</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Excluding a file or folder from checking </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Saving results in file</td></tr></table></div></body></html>

3
gui/help/ch02s05.html Normal file
View File

@ -0,0 +1,3 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Saving results in file</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02s04.html" title="Stylistic issues"><link rel="next" href="ch02s06.html" title="Unused functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Saving results in file</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s04.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch02s06.html">Next</a></td></tr></table><hr></div><div class="section" title="Saving results in file"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2588297"></a>Saving results in file</h2></div></div></div><p>Many times you will want to save the results in a file. You can
use the normal shell redirection for piping error output to a
file.</p><pre class="programlisting">cppcheck file1.c 2&gt; err.txt</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Stylistic issues </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Unused functions</td></tr></table></div></body></html>

3
gui/help/ch02s06.html Normal file
View File

@ -0,0 +1,3 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Unused functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02s05.html" title="Saving results in file"><link rel="next" href="ch02s07.html" title="Enable all checks"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Unused functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s05.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch02s07.html">Next</a></td></tr></table><hr></div><div class="section" title="Unused functions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2588316"></a>Unused functions</h2></div></div></div><p>This check will try to find unused functions. It is best to use
this when the whole program is checked, so that all usages is seen by
cppcheck.</p><pre class="programlisting">cppcheck --enable=unusedFunctions path</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Saving results in file </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Enable all checks</td></tr></table></div></body></html>

2
gui/help/ch02s07.html Normal file
View File

@ -0,0 +1,2 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Enable all checks</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02s06.html" title="Unused functions"><link rel="next" href="ch02s08.html" title="Multithreaded checking"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Enable all checks</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s06.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch02s08.html">Next</a></td></tr></table><hr></div><div class="section" title="Enable all checks"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2588334"></a>Enable all checks</h2></div></div></div><p>To enable all checks your can use the
<code class="literal">--enable=all</code> flag:</p><pre class="programlisting">cppcheck --enable=all path</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Unused functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Multithreaded checking</td></tr></table></div></body></html>

1
gui/help/ch02s08.html Normal file
View File

@ -0,0 +1 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Multithreaded checking</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch02.html" title="Chapter 2. Getting started"><link rel="prev" href="ch02s07.html" title="Enable all checks"><link rel="next" href="ch03.html" title="Chapter 3. Preprocessor configurations"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Multithreaded checking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting started</th><td width="20%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr></table><hr></div><div class="section" title="Multithreaded checking"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2588357"></a>Multithreaded checking</h2></div></div></div><p>To use 4 threads to check the files in a folder:</p><pre class="programlisting">cppcheck -j 4 path</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Enable all checks </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 3. Preprocessor configurations</td></tr></table></div></body></html>

16
gui/help/ch03.html Normal file
View File

@ -0,0 +1,16 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 3. Preprocessor configurations</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch02s08.html" title="Multithreaded checking"><link rel="next" href="ch04.html" title="Chapter 4. XML output"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Preprocessor configurations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 3. Preprocessor configurations"><div class="titlepage"><div><div><h2 class="title"><a name="id2588374"></a>Chapter 3. Preprocessor configurations</h2></div></div></div><p>By default Cppcheck will check all preprocessor configurations
(except those that has #error in them). This is the recommended
behaviour.</p><p>But if you want to manually limit the checking you can do so with
<code class="literal">-D</code>.</p><p>Beware that only the macros, which are given here and the macros
defined in source files and known header files are considered. That
excludes all the macros defined in some system header files, which are by
default not examined by cppcheck.</p><p>The usage: if you, for example, want to limit the checking so the
only configuration to check should be "DEBUG=1;__cplusplus" then something
like this can be used:</p><pre class="programlisting">cppcheck -DDEBUG=1 -D__cplusplus path</pre><p>An alternative for -D is to use #error.</p><pre class="programlisting">#if LIB_VERSION &lt;= 3
#error "lib version must be greater than 3"
#endif</pre><p>Using #error instead of -D have some advantages:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>the compiler will not be able to compile the code when invalid
defines are given. So #error makes your source code
safer/better.</p></li><li class="listitem"><p>Cppcheck will check all valid configurations instead of a single
configuration.</p></li><li class="listitem"><p>This information is added to the source code which means you
don't need to provide this information to Cppcheck (makes it simpler
to use Cppcheck)</p></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Multithreaded checking </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. XML output</td></tr></table></div></body></html>

5
gui/help/ch04.html Normal file
View File

@ -0,0 +1,5 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 4. XML output</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch03.html" title="Chapter 3. Preprocessor configurations"><link rel="next" href="ch05.html" title="Chapter 5. Reformatting the output"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. XML output</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch05.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 4. XML output"><div class="titlepage"><div><div><h2 class="title"><a name="id2588463"></a>Chapter 4. XML output</h2></div></div></div><p>Cppcheck can generate the output in XML format.</p><p>Use the --xml flag when you execute cppcheck:</p><pre class="programlisting">cppcheck --xml file1.cpp</pre><p>The xml format is:</p><pre class="programlisting">&lt;?xml version="1.0"?&gt;
&lt;results&gt;
&lt;error file="file1.cpp" line="123" id="someError"
severity="error" msg="some error text"/&gt;
&lt;/results&gt;</pre><p>Attributes:</p><div class="variablelist"><dl><dt><span class="term">file</span></dt><dd><p>filename. Both relative and absolute paths are possible</p></dd><dt><span class="term">line</span></dt><dd><p>a number</p></dd><dt><span class="term">id</span></dt><dd><p>id of error. These are always valid symbolnames.</p></dd><dt><span class="term">severity</span></dt><dd><p>either error or style</p></dd><dt><span class="term">msg</span></dt><dd><p>the error message</p></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Preprocessor configurations </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. Reformatting the output</td></tr></table></div></body></html>

10
gui/help/ch05.html Normal file
View File

@ -0,0 +1,10 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 5. Reformatting the output</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch04.html" title="Chapter 4. XML output"><link rel="next" href="ch06.html" title="Chapter 6. Suppressions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Reformatting the output</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 5. Reformatting the output"><div class="titlepage"><div><div><h2 class="title"><a name="id2588572"></a>Chapter 5. Reformatting the output</h2></div></div></div><p>If you want to reformat the output so it looks different you can use
templates.</p><p>To get Visual Studio compatible output you can use "--template
vs":</p><pre class="programlisting">cppcheck --template vs gui/test.cpp</pre><p>This output will look like this:</p><pre class="programlisting">Checking gui/test.cpp...
gui/test.cpp(31): error: Memory leak: b
gui/test.cpp(16): error: Mismatching allocation and deallocation: k</pre><p>To get gcc compatible output you can use "--template gcc":</p><pre class="programlisting">cppcheck --template gcc gui/test.cpp</pre><p>The output will look like this:</p><pre class="programlisting">Checking gui/test.cpp...
gui/test.cpp:31: error: Memory leak: b
gui/test.cpp:16: error: Mismatching allocation and deallocation: k</pre><p>You can write your own pattern (for example a comma-separated
format):</p><pre class="programlisting">cppcheck --template "{file},{line},{severity},{id},{message}" gui/test.cpp</pre><p>The output will look like this:</p><pre class="programlisting">Checking gui/test.cpp...
gui/test.cpp,31,error,memleak,Memory leak: b
gui/test.cpp,16,error,mismatchAllocDealloc,Mismatching allocation and deallocation: k</pre><p></p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. XML output </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Suppressions</td></tr></table></div></body></html>

9
gui/help/ch06.html Normal file
View File

@ -0,0 +1,9 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 6. Suppressions</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch05.html" title="Chapter 5. Reformatting the output"><link rel="next" href="ch07.html" title="Chapter 7. Leaks"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. Suppressions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 6. Suppressions"><div class="titlepage"><div><div><h2 class="title"><a name="id2588651"></a>Chapter 6. Suppressions</h2></div></div></div><p>If you want to filter out certain errors you can suppress these.
First you need to create a suppressions file. The format is:</p><pre class="programlisting">[error id]:[filename]:[line]
[error id]:[filename2]
[error id]</pre><p>The <code class="literal">error id</code> is the id that you want to suppress.
The easiest way to get it is to use the <code class="literal">--xml</code> command
line flag. Copy and paste the <code class="literal">id</code> string from the xml
output.</p><p>Here is an example:</p><pre class="programlisting">memleak:file1.cpp
exceptNew:file1.cpp
uninitvar</pre><p>You can then use the suppressions file:</p><pre class="programlisting">cppcheck --suppressions suppressions.txt src/</pre><p></p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Reformatting the output </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Leaks</td></tr></table></div></body></html>

22
gui/help/ch07.html Normal file
View File

@ -0,0 +1,22 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 7. Leaks</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch06.html" title="Chapter 6. Suppressions"><link rel="next" href="ch08.html" title="Chapter 8. Exception safety"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. Leaks</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 7. Leaks"><div class="titlepage"><div><div><h2 class="title"><a name="id2587421"></a>Chapter 7. Leaks</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch07.html#id2587433">Userdefined allocation/deallocation functions</a></span></dt></dl></div><p>Looking for memory leaks and resource leaks is a key feature of
Cppcheck. Cppcheck can detect many common mistakes by default. But through
some tweaking you can improve the checking.</p><div class="section" title="Userdefined allocation/deallocation functions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2587433"></a>Userdefined allocation/deallocation functions</h2></div></div></div><p><code class="literal">Cppcheck</code> understands many common allocation and
deallocation functions. But not all.</p><p>Here is example code that might leak memory or resources:</p><pre class="programlisting">void foo(int x)
{
void *f = CreateFred();
if (x == 1)
return;
DestroyFred(f);
}</pre><p>If you analyse that with Cppcheck it won't find any leaks:</p><pre class="programlisting">cppcheck --enable=possibleError fred1.cpp</pre><p>You can add some custom leaks checking by providing simple
implementations for the allocation and deallocation functions. Write
this in a separate file:</p><pre class="programlisting">void *CreateFred()
{
return malloc(100);
}
void DestroyFred(void *p)
{
free(p);
}</pre><p>When Cppcheck see this it understands that CreateFred will return
allocated memory and that DestroyFred will deallocate memory.</p><p>Now, execute <code class="literal">Cppcheck</code> this way:</p><pre class="programlisting">cppcheck --append=fred.cpp fred1.cpp</pre><p>The output from cppcheck is:</p><pre class="programlisting">Checking fred1.cpp...
[fred1.cpp:5]: (error) Memory leak: f</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 6. Suppressions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 8. Exception safety</td></tr></table></div></body></html>

16
gui/help/ch08.html Normal file
View File

@ -0,0 +1,16 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 8. Exception safety</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch07.html" title="Chapter 7. Leaks"><link rel="next" href="ch09.html" title="Chapter 9. html report"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. Exception safety</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch09.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 8. Exception safety"><div class="titlepage"><div><div><h2 class="title"><a name="id2587519"></a>Chapter 8. Exception safety</h2></div></div></div><p>Cppcheck has a few checks that ensure that you don't break the basic
guarantee of exception safety. It doesn't have any checks for the strong
guarantee yet.</p><p>Example:</p><pre class="programlisting">Fred::Fred() : a(new int[20]), b(new int[20])
{
}</pre><p>By default cppcheck will not detect any problems in that
code.</p><p>To enable the exception safety checking you can use
<code class="literal">--enable</code>:</p><pre class="programlisting">cppcheck --enable=exceptNew --enable=exceptRealloc fred.cpp</pre><p>The output will be:</p><pre class="programlisting">[fred.cpp:3]: (style) Upon exception there is memory leak: a</pre><p>If an exception occurs when <code class="literal">b</code> is allocated,
<code class="literal">a</code> will leak.</p><p>Here is another example:</p><pre class="programlisting">int *p;
int a(int sz)
{
delete [] p;
if (sz &lt;= 0)
throw std::runtime_error("size &lt;= 0");
p = new int[sz];
}</pre><p>Check that with Cppcheck:</p><pre class="programlisting">cppcheck --enable=exceptNew --enable=exceptRealloc except2.cpp</pre><p>The output from Cppcheck is:</p><pre class="programlisting">[except2.cpp:7]: (error) Throwing exception in invalid state, p points at deallocated memory</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. Leaks </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 9. html report</td></tr></table></div></body></html>

15
gui/help/ch09.html Normal file
View File

@ -0,0 +1,15 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 9. html report</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch08.html" title="Chapter 8. Exception safety"><link rel="next" href="ch10.html" title="Chapter 10. Graphical user interface"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. html report</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 9. html report"><div class="titlepage"><div><div><h2 class="title"><a name="id2587623"></a>Chapter 9. html report</h2></div></div></div><p>You can convert the xml output from cppcheck into a html report.
You'll need python and the pygments module
(<code class="uri">http://pygments.org/</code>) for this to work. In the Cppcheck source
tree there is a folder "htmlreport" that contains a script that transforms
a Cppcheck xml file into html output.</p><p>This command generates the help screen:</p><pre class="programlisting">htmlreport/cppcheck-htmlreport -h</pre><p>The output screen says:</p><pre class="programlisting">Usage: cppcheck-htmlreport [options]
Options:
-h, --help show this help message and exit
--file=FILE The cppcheck xml output file to read defects from.
Default is reading from stdin.
--report-dir=REPORT_DIR
The directory where the html report content is written.
--source-dir=SOURCE_DIR
Base directory where source code files can be found.</pre><p>An example usage:</p><pre class="programlisting">./cppcheck gui/test.cpp --xml 2&gt; err.xml
htmlreport/cppcheck-htmlreport --file=err.xml --report-dir=test1 --source-dir=.</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Exception safety </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Graphical user interface</td></tr></table></div></body></html>

2
gui/help/ch10.html Normal file
View File

@ -0,0 +1,2 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 10. Graphical user interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="index.html" title="Cppcheck 1.44"><link rel="prev" href="ch09.html" title="Chapter 9. html report"><link rel="next" href="ch10s02.html" title="Check source code"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. Graphical user interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch10s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 10. Graphical user interface"><div class="titlepage"><div><div><h2 class="title"><a name="id2587683"></a>Chapter 10. Graphical user interface</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch10.html#id2587688">Introduction</a></span></dt><dt><span class="section"><a href="ch10s02.html">Check source code</a></span></dt><dt><span class="section"><a href="ch10s03.html">Inspecting results</a></span></dt><dt><span class="section"><a href="ch10s04.html">Settings</a></span></dt><dt><span class="section"><a href="ch10s05.html">Project files</a></span></dt></dl></div><div class="section" title="Introduction"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2587688"></a>Introduction</h2></div></div></div><p>A Cppcheck GUI is available.</p><p>The main screen is shown immediately when the GUI is
started.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch10s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 9. html report </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Check source code</td></tr></table></div></body></html>

1
gui/help/ch10s02.html Normal file
View File

@ -0,0 +1 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Check source code</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch10.html" title="Chapter 10. Graphical user interface"><link rel="prev" href="ch10.html" title="Chapter 10. Graphical user interface"><link rel="next" href="ch10s03.html" title="Inspecting results"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Check source code</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Graphical user interface</th><td width="20%" align="right"> <a accesskey="n" href="ch10s03.html">Next</a></td></tr></table><hr></div><div class="section" title="Check source code"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2587703"></a>Check source code</h2></div></div></div><p>Use the <code class="literal">Check</code> menu.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch10s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 10. Graphical user interface </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Inspecting results</td></tr></table></div></body></html>

4
gui/help/ch10s03.html Normal file
View File

@ -0,0 +1,4 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Inspecting results</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch10.html" title="Chapter 10. Graphical user interface"><link rel="prev" href="ch10s02.html" title="Check source code"><link rel="next" href="ch10s04.html" title="Settings"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Inspecting results</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s02.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Graphical user interface</th><td width="20%" align="right"> <a accesskey="n" href="ch10s04.html">Next</a></td></tr></table><hr></div><div class="section" title="Inspecting results"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2587719"></a>Inspecting results</h2></div></div></div><p>The results are shown in a list.</p><p>You can show/hide certain types of messages through the
<code class="literal">View</code> menu.</p><p>Results can be saved to an xml file that can later be opened. See
<code class="literal">Save results to file</code> and <code class="literal">Open
XML</code>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch10s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Check source code </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Settings</td></tr></table></div></body></html>

3
gui/help/ch10s04.html Normal file
View File

@ -0,0 +1,3 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Settings</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch10.html" title="Chapter 10. Graphical user interface"><link rel="prev" href="ch10s03.html" title="Inspecting results"><link rel="next" href="ch10s05.html" title="Project files"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Settings</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s03.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Graphical user interface</th><td width="20%" align="right"> <a accesskey="n" href="ch10s05.html">Next</a></td></tr></table><hr></div><div class="section" title="Settings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2587755"></a>Settings</h2></div></div></div><p>The language can be changed at any time by using the
<code class="literal">Language</code> menu.</p><p>More settings are available in
<code class="literal">Edit</code>&gt;<code class="literal">Preferences</code>.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch10s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Inspecting results </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Project files</td></tr></table></div></body></html>

7
gui/help/ch10s05.html Normal file
View File

@ -0,0 +1,7 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Project files</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="up" href="ch10.html" title="Chapter 10. Graphical user interface"><link rel="prev" href="ch10s04.html" title="Settings"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Project files</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s04.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Graphical user interface</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="section" title="Project files"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2587788"></a>Project files</h2></div></div></div><p>The project files are used to store project specific settings.
These settings are:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>include folders</p></li><li class="listitem"><p>preprocessor defines</p></li></ul></div><p>It isn't recommended to provide the paths to the standard C/C++
headers - Cppcheck has internal knowledge about ANSI C/C++ and it isn't
recommended that this known functionality is redefined. But feel free to
try it.</p><p>As you can read in chapter 3 in this manual the default is that
Cppcheck checks all configurations. So only provide preprocessor defines
if you want to limit the checking.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">Settings </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>

View File

@ -1,5 +1 @@
<html>
<body>
help
</body>
</html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Cppcheck 1.44</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Cppcheck 1.44"><link rel="next" href="ch01.html" title="Chapter 1. Introduction"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Cppcheck 1.44</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr></table><hr></div><div class="book" title="Cppcheck 1.44"><div class="titlepage"><div><div><h1 class="title"><a name="id2518209"></a>Cppcheck 1.44</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="ch01.html">1. Introduction</a></span></dt><dt><span class="chapter"><a href="ch02.html">2. Getting started</a></span></dt><dd><dl><dt><span class="section"><a href="ch02.html#id2623157">First test</a></span></dt><dt><span class="section"><a href="ch02s02.html">Checking all files in a folder</a></span></dt><dt><span class="section"><a href="ch02s03.html">Excluding a file or folder from checking</a></span></dt><dt><span class="section"><a href="ch02s04.html">Stylistic issues</a></span></dt><dt><span class="section"><a href="ch02s05.html">Saving results in file</a></span></dt><dt><span class="section"><a href="ch02s06.html">Unused functions</a></span></dt><dt><span class="section"><a href="ch02s07.html">Enable all checks</a></span></dt><dt><span class="section"><a href="ch02s08.html">Multithreaded checking</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch03.html">3. Preprocessor configurations</a></span></dt><dt><span class="chapter"><a href="ch04.html">4. XML output</a></span></dt><dt><span class="chapter"><a href="ch05.html">5. Reformatting the output</a></span></dt><dt><span class="chapter"><a href="ch06.html">6. Suppressions</a></span></dt><dt><span class="chapter"><a href="ch07.html">7. Leaks</a></span></dt><dd><dl><dt><span class="section"><a href="ch07.html#id2587433">Userdefined allocation/deallocation functions</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch08.html">8. Exception safety</a></span></dt><dt><span class="chapter"><a href="ch09.html">9. html report</a></span></dt><dt><span class="chapter"><a href="ch10.html">10. Graphical user interface</a></span></dt><dd><dl><dt><span class="section"><a href="ch10.html#id2587688">Introduction</a></span></dt><dt><span class="section"><a href="ch10s02.html">Check source code</a></span></dt><dt><span class="section"><a href="ch10s03.html">Inspecting results</a></span></dt><dt><span class="section"><a href="ch10s04.html">Settings</a></span></dt><dt><span class="section"><a href="ch10s05.html">Project files</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Introduction</td></tr></table></div></body></html>

Binary file not shown.

View File

@ -4,11 +4,35 @@
<virtualFolder>doc</virtualFolder>
<filterSection>
<toc>
<section title="cppcheck" ref="index.html"/>
<section title="Manual" ref="index.html">
<section title="Introduction" ref="ch01.html"/>
<section title="Getting started" ref="ch02.html">
<section title="Checking all files in a folder" ref="ch02s02.html"/>
<section title="Excluding a file or a folder from checking" ref="ch02s03.html"/>
<section title="Stylistic issues" ref="ch02s04.html"/>
<section title="Saving results in a file" ref="ch02s05.html"/>
<section title="Unused functions" ref="ch02s06.html"/>
<section title="Enable all checks" ref="ch02s07.html"/>
<section title="Multithreaded checking" ref="ch02s08.html"/>
</section>
<section title="Preprocessor configurations" ref="ch03.html"/>
<section title="XML output" ref="ch04.html"/>
<section title="Reformatting the output" ref="ch05.html"/>
<section title="Suppressions" ref="ch06.html"/>
<section title="Leaks" ref="ch07.html"/>
<section title="Exception safety" ref="ch08.html"/>
<section title="Html report" ref="ch09.html"/>
<section title="Graphical user interface" ref="ch10.html">
<section title="Check source code" ref="ch10s02.html"/>
<section title="Inspecting results" ref="ch10s03.html"/>
<section title="Settings" ref="ch10s04.html"/>
<section title="Project files" ref="ch10s05.html"/>
</section>
</section>
</toc>
<keywords/>
<files>
<file>index.html</file>
</files>
</filterSection>
</QtHelpProject>
</QtHelpProject>

80
gui/helpwindow.cpp Normal file
View File

@ -0,0 +1,80 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "helpwindow.h"
#include "ui_helpwindow.h"
#include <QtHelp>
#include <QtHelp/QHelpEngine>
#include <QTextBrowser>
#include <QSplitter>
/** @brief Help browser */
class HelpBrowser : public QTextBrowser
{
public:
HelpBrowser(QHelpEngine *helpEngine, QWidget *parent = 0)
: QTextBrowser(parent), helpEngine(helpEngine)
{
}
QVariant loadResource(int type, const QUrl &url)
{
if (url.scheme() == "qthelp")
return QVariant(helpEngine->fileData(url));
else
return QTextBrowser::loadResource(type, url);
}
private:
QHelpEngine *helpEngine;
};
HelpWindow::HelpWindow(QWidget *parent) :
QWidget(parent),
m_ui(new Ui::HelpWindow)
{
m_ui->setupUi(this);
setVisible(true);
helpEngine = new QHelpEngine("help/online-help.qhc", this);
if (helpEngine->setupData())
{
QSplitter *helpPanel = new QSplitter(Qt::Horizontal);
HelpBrowser *helpBrowser = new HelpBrowser(helpEngine, this);
helpPanel->insertWidget(0, helpEngine->contentWidget());
helpPanel->insertWidget(1, helpBrowser);
helpPanel->setStretchFactor(1, 1);
m_ui->horizontalLayout->addWidget(helpPanel);
connect(helpEngine->contentWidget(), SIGNAL(linkActivated(const QUrl &)),
helpBrowser, SLOT(setSource(const QUrl &)));
}
}
HelpWindow::~HelpWindow()
{
delete helpEngine;
delete m_ui;
}

50
gui/helpwindow.h Normal file
View File

@ -0,0 +1,50 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HELPWINDOW_H
#define HELPWINDOW_H
#include <QtGui/QWidget>
namespace Ui
{
class HelpWindow;
}
class QHelpEngine;
/// @addtogroup GUI
/// @{
/**
* @brief Help Window
*/
class HelpWindow : public QWidget
{
Q_OBJECT
public:
HelpWindow(QWidget *parent = 0);
~HelpWindow();
private:
Ui::HelpWindow *m_ui;
QHelpEngine *helpEngine;
};
#endif // HELPWINDOW_H

24
gui/helpwindow.ui Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HelpWindow</class>
<widget class="QWidget" name="HelpWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Cppcheck Help</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="widget" native="true"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -35,6 +35,7 @@
#include "report.h"
#include "logview.h"
#include "filelist.h"
#include "helpwindow.h"
MainWindow::MainWindow() :
mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
@ -651,13 +652,8 @@ void MainWindow::OpenHelpContents()
void MainWindow::OpenHtmlHelpContents()
{
/*
QString file("/cppcheck.chm");
QString exeFolder = QDir::currentPath();
exeFolder += file;
exeFolder = QDir::toNativeSeparators(exeFolder);
HtmlHelp(NULL, exeFolder.utf16(), HH_DISPLAY_TOPIC, NULL);
*/
HelpWindow *helpWindow = new HelpWindow;
helpWindow->setVisible(true);
}
void MainWindow::OpenProjectFile()