doxygenfile Directive Example

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:

kHammer = 0

What? It does the job.

kNutCrackers

Boring.

kNinjaThrowingStars

Stealthy.

Public Functions

Nutshell()

Nutshell constructor.

~Nutshell()

Nutshell destructor.

void crack(Tool tool)

Crack that shell with specified tool

Parameters
  • tool -

    - the tool with which to crack the nut

bool isCracked()

Return
Whether or not the nut is cracked

Private Members

bool m_isCracked

Our cracked state.

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

void protectedFunction()

A protected function.

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.

namespace ns

More examples in a nested namespace.

Typedefs

typedef int MyInt

Enums

enum Letters

Values:

A

A documented enumeration constant.

B
C
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:

Warning

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