[Doxygen-develop] doxmlparser won't iterate past "protocol" compound
Brought to you by:
dimitri
From: Isaac W. <isa...@gm...> - 2012-07-15 17:27:06
|
Hello everyone, I'm trying to figure out how to use the doxmlparser classes and I've run into a bit of trouble using the compounds() iterator. I have a bit of code like the following: ICompoundIterator *cli = dox->compounds(); > ICompound *comp; > > for(cli->toFirst(); comp = cli->current(); cli->toNext()) > { > std::cout << "Processing " << comp->name()->latin1() << > std::endl; > } > But cli->current() returns 0 when it hits a compound with the kind "prototype." I did a bit of digging and the offending code is in compoundhandler.cpp's CompoundHandler::toICompound() which returns 0 if the compound kind is not a class, struct, union, exception, interface, namespace, file, group, or page. Surely the iterator shouldn't be halted by an unknown type, should it? I think that the best behavior would be to simply skip over compounds which aren't one of these predefined types. My first thought was to change current() to something like this: CompoundEntry *ch = QListIterator<CompoundEntry>::current(); > > if(ch && !m_mainHandler->compoundById(ch->id.utf8())) > { > toNext(); > return current(); > } > else > return ch ? m_mainHandler->compoundById(ch->id.utf8()) : 0; > But that violates the const-ness of current() and doing away with the const would be a very dirty hack (and I'm not actually sure if it would be possible with the inheritance tree). First I would like to know if this is indeed broken behavior. If it is, what is the cleanest way to solve the problem? I am not particularly familiar with doxmlparser. I'll keep hacking away, but I would love to know if you have any simple solutions to the problem. Regards, Isaac |