> > What is the key to this map? If it is biblio, not /path/to/biblio.bib, > > then you can make bibfiles_ a map, and the meta_ patch is no longer > > needed. > > > Yes. This is what I've been trying to say, more or less. But note that, > when we output latex, we iterate not over bibfiles_ but over params, and > we (quickly) look up the embedded file info in the map. We do it this > way because we should keep the order. This requires that bibfiles_ and > the params be in sync, but they have to be kept in sync anyway. We > resolved that issue a long time ago.
OK. We have agree upon at least a few things, 1. EmbeddedFileList (or map) has to be in sync with params, has to be valid, so it can not be separated from params. In this sense, who should be the core information (so that another one does not have to be updated) is a false problem. 2. EmbeddedFile needs this meta_, and your solution of map<meta_, EmbeddedFile> is acceptable to me. However, meta_ is a solution to a general problem, that may be needed anyway in, for example, InsetGraphics. I am not against the idea that you fix InsetBibtex now, and fix InsetGraphic later. There are then some minor problems left, such as 1. In functions such as addDatabase, should we update params first and update EmbeddedFileList/Map; or another way around? 2. When we are in need some information, from whom should we ask for it? I say they are minor problems because if params and EmbeddedFiles are in sync, it does not really matter, so let use just use the easier method. I tend to use EmbeddedFileList because it is structured so it is easier to handle. > > The current code will not change the order of embedded files, unless > > you use a map to return bib files without order from InsetBibtex. > > > > > Yes, it will. Not just from open/save---I didn't say that---but it will > change the order, say, if you change the order of the files in the > bibliography inset, or if you move one graphic in front of another. This > is because of how the files are registered. If it matters that the order > stay the same, then you need to sort the list in > EmbeddedFileList::writeFile(), or probably better in update(). But if > you do that, then it doesn't matter what the reported order is, and it > doesn't matter if we use a map. I think sorting the embedded files before writing is a great idea. At least it no longer matters if you use map<..., embeddedfile> in InsetBibtex::registerFile. Cheers, Bo