1

I am completely new in using Doxygen and Sphinx. Going through some resources(this, this) I have managed to kick off my initial project. But now I am trying to draw an UML diagram for my CPP classes

sample.h

/// Documenting Base Class
class Base_A{

    /// Name of each student
    char Name[50];

    public:
        Base_A(char *name_1, char *id_1){
            strcpy(Name,name_1);
            strcpy(Id,id_1);
        }

        /// Prints student info
        void PrintStudentInfo();

        /// ID of each student
        char Id[20];
};


/// Documenting Child Class
class Child_A : public Base_A{

    /// Nationality of each student
    char Nationality[50];

    /// Fees of each student
    float fees;

    public:
        Child_A(char *name_1, char *id_1, char *nationality_1, float fees_1):Base_A(name_1, id_1){
            strcpy(Nationality,nationality_1);
            fees = fees_1;}

        /// Prints student register info
        void PrintRegInfo();
};

index.rst

.. CatCutifier documentation master file, created by
   sphinx-quickstart on Wed Apr 24 15:19:01 2019.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to CatCutifier's documentation!
=======================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:

:ref:`genindex`

Docs
====

.. doxygenclass:: Base_A
   :members:
   :private-members:

.. doxygenclass:: Child_A
   :members:
   :private-members:


A snippet of conf.py where I have added extensions

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.mathjax',
    'sphinx.ext.viewcode',
    'sphinx.ext.imgmath',
    'sphinx.ext.todo',
    'sphinx.ext.graphviz',
    'sphinx.ext.inheritance_diagram',
    'breathe',
]

My process is just build the project from /project/build by using cmake .. && make. Is there anything else I have to do or what directive I need to add in index.rst file to get the UML? I have followed this but it is for python class. Also gone through the Breathe docs but could not find any fruitful.

user10634362
  • 549
  • 5
  • 21
  • In doxygen's output formats doxygen will create UML inheritance / collaboration diagrams. In the xml output only a textual reference is given and the further processing is left to the user of the XML files. Furthermore there is a possibility to give it a bit a more and `UML_LOOK`, check the doxygen manual (but again the graphs are not drawn for XML but are drawn for e.g. HTML / LaTeX by doxygen). – albert Nov 09 '21 at 17:16
  • Unfortunately I haven't got your point. I assume while I build the project then if I render `index.html` I can see the UML diagram. And for this actually I am looking a setting ( maybe it will be some changes in `index.rst`). – user10634362 Nov 09 '21 at 18:11
  • Is this the doxygen index.html or something else? – albert Nov 09 '21 at 20:32
  • this `index.html` renders by sphinx if I am not wrong. Maybe you can take a look [here](https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/) – user10634362 Nov 09 '21 at 21:10

0 Answers0