Re: Support for C++ Template Classes

Jens Miltner <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
Am 27.09.2006 um 22:14 schrieb Ethan Tira-Thompson:

>> 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).

You could, of course, make them subclasses for doxygen only, e.g.

//! nodes for the tail-wag thingy
#if __DOXYGEN__
	class TailWagNode : public  
MCNode<TailWagMC,defTailWagNodeName,defTailWagNodeDesc,false> {};
#else
	typedef  
MCNode<TailWagMC,defTailWagNodeName,defTailWagNodeDesc,false>  
TailWagNode;
#endif

This is still tedious (and some additional support in doxygen for  
this kind of problem would surely be great), but at least you don't  
have the additional overhead in your application and only minimally  
more maintenance issues.

</jum>

-------------------------------------------------------------------------
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.