//! [0] C++ - what is it?

That's a comment of course. Still it has a special meaning for doxygen:

\snippet ( block_id )

Where the \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 example.cpp residing in a subdirectory which should be pointed to by EXAMPLE_PATH.

\snippet snippets/example.cpp Adding a resource

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:

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]
...

Note that the lines containing the block markers will not be included, so the output will be:

document->addResource(QTextDocument::ImageResource,
QUrl("mydata://image.png"), QVariant(image));

Note also that the [block_id] markers should appear exactly twice in the source file.

Here 0 is the block id.


It is a single-line comment...

Tags:

C++

Directive