Re: Support for C++ Template Classes

Ethan Tira-Thompson <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
> We use a lot of template base classes that are specialized for  
> different types (similar to vector<int>). To simplify things we use  
> a lot of typedefs (like typdef vector<int> ivec). But given that  
> they're just typedefs they don't show up in the class list or the  
> inhertiance hierarchy, even though for all practical reasons  
> they're classes.

I just want to add my vote for this as well -- in our case, we have a  
templated class:
template<class T, const char* mcName=defName, const char*  
mcDesc=defDesc, bool completes=true> class MCNode;

And then for the "simple" cases we only need to pass template  
parameters:
typedef MCNode<TailWagMC,defTailWagNodeName,defTailWagNodeDesc,false>  
TailWagNode;
typedef  
MCNode<HeadPointerMC,defHeadPointerNodeName,defHeadPointerNodeDesc>  
HeadPointerNode;
...

And for "harder" issues we can uses subclasses instead:
class LedNode : public MCNode<LedMC> { /*...*/ }

So the trick is, LedNode shows up in the class listing as expected,  
but TailWagNode and HeadPointerNode don't.  Technically, this is  
accurate since they're really just typedefs, but from a user  
standpoint, there's no difference -- the user is going to look in the  
class listing to see what's available and not know the 'type' exists.

Perhaps there could be a keyword to treat a typedef as a subclass  
instead of "just" a typedef?

> Any ideas how to make them show up as classes in an easy way? Right  
> now the place to find them is in the namespace list, and that's not  
> very intuitive.

Our workaround is to modify the code to use a "real" subclass  
instead, but that's less than ideal, as it causes additional overhead  
and requires the subclass to replicate all of the constructors of the  
base class to forward them through (maintenance issue).

-ethan

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.