doxygenfile Directive

This directive generates the appropriate output for a single source file. It takes the standard project, path, outline and no-link options and additionally the sections options.

For the standard option refer to the documentation on the main directives page. The directive-specific options are documented below.

sections

Limit the sections to render for the given source file to the given list. Many of the names come from Doxygen and Breathe internals and may not make sense from an external point of view. Nevertheless it is hoped this table is useful.

Section types

Type

Description

briefdescription

Brief description

dcop-func

DCOP Function

define

Define

derivedcompoundref

Derived compound reference

detaileddescription

Detailed description

enum

Enumerator

event

Events

friend

Friend

func

Function

innerclass

Must be given to show sections inside a class

innernamespace

Must be given to show sections inside a namespace

package-attrib

Package attribute

package-func

Package function

package-static-attrib

Package static attribute

package-static-func

Package static function

package-type

Package type

private-attrib

Private attribute

private-func

Private function

private-slot

Private slot

private-static-attrib

Private static attribute

private-static-func

Private static function

private-type

Private type

property

Properties

protected-attrib

Protected attribute

protected-func

Protected function

protected-slot

Protected slot

protected-static-attrib

Protected static attribute

protected-static-func

Protected static function

protected-type

Protected type

prototype

Prototype

public-attrib

Public attribute

public-func

Public function

public-slot

Public slot

public-static-attrib

Public static attribute

public-static-func

Public static function

public-type

Public type

related

Related

signal

Signal

typedef

Type definition

user-defined

User defined

var

Variable

Example

This should work:

.. doxygenfile:: nutshell.h
   :project: nutshell

It produces this output:


An overly extended example of how to use breathe

class Nutshell
#include <nutshell.h>

With a little bit of a elaboration, should you feel it necessary.

Public Types

enum Tool

Our tool set.

The various tools we can opt to use to crack this particular nut

Values:

enumerator kHammer

What? It does the job.

enumerator kNutCrackers

Boring.

enumerator kNinjaThrowingStars

Stealthy.

Public Functions

Nutshell()

Nutshell constructor.

~Nutshell()

Nutshell destructor.

void crack(Tool tool)

Crack that shell with specified tool

参数

tool – the tool with which to crack the nut

bool isCracked()
返回

Whether or not the nut is cracked

Private Members

bool m_isCracked

Our cracked state.

Example with Selected and Ordered Sections

The following will only show the briefdescription and public-type sections, in that order:

.. doxygenfile:: nutshell.h
   :project: nutshell
   :sections: briefdescription innerclass public-type

It produces this output:


class Nutshell
#include <nutshell.h>

Public Types

enum Tool

Our tool set.

The various tools we can opt to use to crack this particular nut

Values:

enumerator kHammer

What? It does the job.

enumerator kNutCrackers

Boring.

enumerator kNinjaThrowingStars

Stealthy.

Example with Nested Namespaces

This should work:

.. doxygenfile:: namespacefile.h
   :project: namespace

It produces this output:


Functions

void outerFunction()

Function outside of the namespace.

class OuterBar
#include <namespacefile.h>

This is outside the namespace.

class InnerBar

This appears as a sub class.

namespace foo

Functions

int baz()

This also appears.

class Bar
#include <namespacefile.h>

This appears in the documentation.

Public Functions

virtual void publicFunction() const = 0

namespaced class function

virtual void undocumentedPublicFunction() const = 0

Protected Functions

inline void protectedFunction()

A protected function.

inline void undocumentedProtectedFunction()

Private Functions

virtual void privateFunction() const = 0

This is a private function.

virtual void undocumentedPrivateFunction() const = 0
class PrivateClass

A private class.

class ProtectedClass
#include <namespacefile.h>

A protected class.

class PublicClass
#include <namespacefile.h>

A protected class.

class UndocumentedPrivateClass
class UndocumentedProtectedClass
class UndocumentedPublicClass
namespace ns

More examples in a nested namespace.

Typedefs

typedef int MyInt

Enums

enum Letters

Values:

enumerator A

A documented enumeration constant.

enumerator B
enumerator C
class FooClass
class InnerFoo
struct FooStruct
#include <namespacefile.h>

Documentation here.

Example for Multiple Files

When there are multiple files with the same name in the project, you need to be more specific with the filename you provide. For example, in a project with the following two files:

/some/long/project/path/parser/Util.h
/some/long/project/path/finder/Util.h

You should specify:

.. doxygenfile:: parser/Util.h

.. doxygenfile:: finder/Util.h

To uniquely identify them.

Failing Example

This intentionally fails:

.. doxygenfile:: made_up_file.h
   :project: nutshell

It produces the following warning message:

警告

Cannot find file “made_up_file.h” in doxygen xml output for project “nutshell” from directory: ../../examples/specific/nutshell/xml/