summaryrefslogtreecommitdiffstats
path: root/doc/commands.doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/commands.doc')
-rw-r--r--doc/commands.doc55
1 files changed, 55 insertions, 0 deletions
diff --git a/doc/commands.doc b/doc/commands.doc
index 7bd90e2..d74452a 100644
--- a/doc/commands.doc
+++ b/doc/commands.doc
@@ -161,6 +161,7 @@ documentation:
\refitem cmdsince \\since
\refitem cmdskip \\skip
\refitem cmdskipline \\skipline
+\refitem cmdsnippet \\snippet
\refitem cmdstruct \\struct
\refitem cmdsubpage \\subpage
\refitem cmdsubsection \\subsection
@@ -1862,6 +1863,10 @@ Commands for displaying examples
for the corresponding HTML documentation that is generated by doxygen.
\endhtmlonly
+ Alternatively, the \ref cmdsnippet "\\snippet" command can be used to
+ include only a fragment of a source file. For this to work the
+ fragment has to be marked.
+
\sa sections \ref cmdline "\\line", \ref cmdskip "\\skip",
\ref cmdskipline "\\skipline", \ref cmduntil "\\until", and
\ref cmdinclude "\\include".
@@ -1894,6 +1899,10 @@ Commands for displaying examples
\ref cmdskipline "\\skipline",
and \\until commands.
+ Alternatively, the \ref cmdsnippet "\\snippet" command can be used to
+ include only a fragment of a source file. For this to work the
+ fragment has to be marked.
+
\note Doxygen's special commands do not work inside blocks of code.
It is allowed to nest C-style comments inside a code block though.
@@ -1962,6 +1971,52 @@ Commands for displaying examples
See section \ref cmddontinclude "\\dontinclude" for an example.
<hr>
+\section cmdsnippet \\snippet <file-name> ( block_id )
+
+ \addindex \\snippet
+ Where the \ref cmdinclude "\\include" command can be used to include
+ a complete file as source code, this command can be used to quote only
+ a fragment of a source file.
+
+ For example, the putting the following command in the documentation,
+ references a snippet in file \c example.cpp residing in a subdirectory
+ which should be pointed to by \ref cfg_example_path "EXAMPLE_PATH".
+
+\verbatim
+ \snippet snippets/example.cpp Adding a resource
+\endverbatim
+
+ The text following the file name is the unique identifier for the snippet.
+ This is used to delimit the quoted code in the relevant snippet file as
+ shown in the following example that corresponds to the above \\snippet
+ command:
+
+\code
+ QImage image(64, 64, QImage::Format_RGB32);
+ image.fill(qRgb(255, 160, 128));
+
+//! [Adding a resource]
+ document->addResource(QTextDocument::ImageResource,
+ QUrl("mydata://image.png"), QVariant(image));
+//! [Adding a resource]
+ ...
+\endcode
+
+ Note that the lines containing the block markers will not be included,
+ so the output will be:
+
+\code
+ document->addResource(QTextDocument::ImageResource,
+ QUrl("mydata://image.png"), QVariant(image));
+\endcode
+
+ Note also that the [block_id] markers should appear exactly twice in the
+ source file.
+
+ see section \ref cmddontinclude "\\dontinclude" for an alternative way
+ to include fragments of a source file that does not require markers.
+
+<hr>
\section cmduntil \\until ( pattern )
\addindex \\until