On Tuesday 31 July 2001 19:07, Lars Gullik Bjønnes wrote:
> Angus Leeming <[EMAIL PROTECTED]> writes:
>
> | I'm in the process of writing a BibtexDBase class that will store the
Bibtex
> | .bib files used by any open buffer. I think that the best place to store
the
> | instance of this class is in LyX:
> | class LyX {
> | BibtexDBase & bibtex();
> | }
>
> or... create a singleton class
>
> class BibTeXDatabase {
> public:
> static BibTeXDataBase & get() {
> static BibTeXDatabase db;
> return db;
> }
> ...
> private:
> BibTeXDatabase();
> ~BibTeXDatabase();
> };
Feels much cleaner. Thanks.
(However, I thought that global data was EVIL? Guess this is an example of a
reasonable compromise.)
> Will it store the complete files? Or just the filenames?
It will store the files themselves as vector<Bibtex> files. InsetBibtex is
reduced to storing the filenames used by a particular buffer. Much cleaner, I
think.
Buffer will contain an instance of a new class Biblio that provides an
interface to the outside world to both this BibTeX database or to any
bibitems stored in the buffer.
Incidentally, I see from Buffer::getBibkeyList() that we can use either
BibTeX or LaTeX's thebibliography environment, but not both. So, if I have an
InsetBibtex, shouldn't the Bibliography environment be inaccessible? It
certainly screws things up otherwise!
> Regardless... use refcounting and have the buffer destructor
> unregister the .bib files upon dectruction.
You read my mind. Incidentally, is there a reference-counting class in boost
f.ex. that I can use, or should I roll my own?
Angus