Reputation: 1199
I'm working on documenting a legacy c++/fortran mixed code using doxygen (version 1.8.0 on a xubuntu 12.04 machine). My dot_graphs, call graphs, and caller graphs are working properly except when the stl std::vector class is being used.
I have some class foo which needs to contain a vector of another class bar.
class foo
{
//What i'd like to do (1)
std::vector<bar> d_bars
//What works (2)
bar* d_bars
};
class bar
{
SOME_FUNCTION();
}
The bar class contains a variety of functions such as "SOME_FUNCTION()". When a function within the foo class calls SOME_FUNCTION:d_bars[i].SOME_FUNCTION();
the caller graph is generated only when d_bars is declared in the second way. This doesn't work with the current code and need to work while being declared in the first method using the stl vector class.
I already have BUILTIN_STL_SUPPORT = YES
. I know my code isn't perfect above. I hope you can catch the drift. My code is quite huge, so I tried to simplify it.
Upvotes: 5
Views: 1259
Reputation: 129
I don't know if what this will help but anyway, who knows.
I've been having exactly the same problem as you have: I have two classes and one of them has a vector of the other class. Even worse, I was generating shared_pointers and later creating vectors of that.
The only solution I had to this, was using sed.. yes, really... For example:
class A
{
public:
A() {};
~A() {};
DoSomeThingA(){
AA_ = 0;
};
private:
int AA_;
};
class B
{
public:
B() {};
~B(){};
DoSomeThingB(){
for (size_t i = 0; i < VecA_.size(); i++)
{
VecA_[i]->DoSomeThingA();
}
};
private:
std::vector<std::shared_ptr<A>> VecA_;
};
I changed it using sed (sed -e 's/VecA_\[i\]-^>/VecA_\./; s/std::vector^<std::shared_ptr^<A^>^>/A/'
) (I use "^" because I am on windows and that is the escape character that worked for ">"), obtaining:
class A
{
public:
A() {};
~A() {};
DoSomeThingA(){
AA_ = 0;
};
private:
int AA_;
};
class B
{
public:
B() {};
~B(){};
DoSomeThingB(){
for (size_t i = 0; i < VecA_.size(); i++)
{
VecA_.DoSomeThingA();
}
};
private:
A VecA_;
};
Finally, I configured doxygen with:
INPUT_FILTER = sed -e 's/VecA_\[i\]-^>/VecA_\./; s/std::vector^<std::shared_ptr^<A^>^>/A/'
FILTER_SOURCE_FILES = yes
SOURCE_BROWSER = yes
VERBATIM_HEADERS = no
Tedious? yes, of course... But it works for me and this is the only way that I could make this work!
Hope it helps
Upvotes: 1