On 05/22/2010 03:56 PM, Rob Oakes wrote:
Dear LyX Developers,

Does anyone know what the toc.push_back method does?  I've seen it
referenced in several of the Inset::addToToc implementations
(InsetNote.cpp, InsetText, ...).

> From context, it appears to register the TocItem with the TocModel,
however, I can't for the life of me find where it is implemented.  I've
looked at the TocBackend classes and the TocModel classes.

If anyone could walk me through this method, I'd be extremely
appreciative.

In InsetNote, toc is a Toc:
    Toc & toc = buffer().tocBackend().toc("note");
So toc.push_back calls Toc::push_back. Toc is declared in TocBackend.cpp, thus:
    class Toc : public std::vector<TocItem>
So a Toc is really a vector, and so Toc::push_back is just vector::push_back, since it isn't overridden. Indeed, Toc is a pretty trival subclass of vector<TocItem>. The only thing it really gives you is the item() method, for looking up an item.

Richard


Reply via email to