From 3fd0f8e7fd3bf000a45dcf136a9cf0e38a6f3260 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sat, 29 Mar 2008 14:38:38 +0000 Subject: [PATCH] Mostly cosmetic changes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24034 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetBibtex.cpp | 49 +++++++++++++++++++------------------- src/insets/InsetBibtex.h | 13 +++++----- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index e5c0567619..02fcde2875 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -54,6 +54,7 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p) void InsetBibtex::setBuffer(Buffer & buffer) { + // FIXME We ought to have a buffer. if (buffer_) { EmbeddedFileList::iterator it = bibfiles_.begin(); EmbeddedFileList::iterator it_end = bibfiles_.end(); @@ -67,7 +68,7 @@ void InsetBibtex::setBuffer(Buffer & buffer) } } } - Inset::setBuffer(buffer); + InsetCommand::setBuffer(buffer); } @@ -305,7 +306,7 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const } -EmbeddedFileList InsetBibtex::embeddedFiles() const +EmbeddedFileList const & InsetBibtex::getBibFiles() const { return bibfiles_; } @@ -552,28 +553,28 @@ namespace { void InsetBibtex::fillWithBibKeys(BiblioInfo & keylist, InsetIterator const & /*di*/) const { - EmbeddedFileList const files = embeddedFiles(); - for (vector::const_iterator it = files.begin(); - it != files.end(); ++ it) { - // This bibtex parser is a first step to parse bibtex files - // more precisely. - // - // - it reads the whole bibtex entry and does a syntax check - // (matching delimiters, missing commas,... - // - it recovers from errors starting with the next @-character - // - it reads @string definitions and replaces them in the - // field values. - // - it accepts more characters in keys or value names than - // bibtex does. - // - // Officially bibtex does only support ASCII, but in practice - // you can use the encoding of the main document as long as - // some elements like keys and names are pure ASCII. Therefore - // we convert the file from the buffer encoding. - // We don't restrict keys to ASCII in LyX, since our own - // InsetBibitem can generate non-ASCII keys, and nonstandard - // 8bit clean bibtex forks exist. - + // This bibtex parser is a first step to parse bibtex files + // more precisely. + // + // - it reads the whole bibtex entry and does a syntax check + // (matching delimiters, missing commas,... + // - it recovers from errors starting with the next @-character + // - it reads @string definitions and replaces them in the + // field values. + // - it accepts more characters in keys or value names than + // bibtex does. + // + // Officially bibtex does only support ASCII, but in practice + // you can use the encoding of the main document as long as + // some elements like keys and names are pure ASCII. Therefore + // we convert the file from the buffer encoding. + // We don't restrict keys to ASCII in LyX, since our own + // InsetBibitem can generate non-ASCII keys, and nonstandard + // 8bit clean bibtex forks exist. + EmbeddedFileList const & files = getBibFiles(); + EmbeddedFileList::const_iterator it = files.begin(); + EmbeddedFileList::const_iterator en = files.end(); + for (; it != en; ++ it) { idocfstream ifs(it->availableFile().toFilesystemEncoding().c_str(), ios_base::in, buffer().params().encoding().iconvName()); diff --git a/src/insets/InsetBibtex.h b/src/insets/InsetBibtex.h index efee21ef44..3d841e9f5f 100644 --- a/src/insets/InsetBibtex.h +++ b/src/insets/InsetBibtex.h @@ -12,10 +12,11 @@ #ifndef INSET_BIBTEX_H #define INSET_BIBTEX_H -#include -#include "InsetCommand.h" #include "BiblioInfo.h" #include "EmbeddedFiles.h" +#include "InsetCommand.h" + +#include namespace lyx { @@ -27,7 +28,7 @@ public: /// InsetBibtex(InsetCommandParams const &); /// - void setBuffer(Buffer & buffer); + virtual void setBuffer(Buffer & buffer); /// docstring screenLabel() const; /// @@ -41,7 +42,7 @@ public: /// void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const; /// - EmbeddedFileList embeddedFiles() const; + EmbeddedFileList const & getBibFiles() const; /// bool addDatabase(std::string const &); /// @@ -68,12 +69,12 @@ private: void registerEmbeddedFiles(EmbeddedFileList &) const; /// void updateEmbeddedFile(EmbeddedFile const & file); - /// embedded bib files - mutable EmbeddedFileList bibfiles_; /// void doDispatch(Cursor & cur, FuncRequest & cmd); /// Inset * clone() const { return new InsetBibtex(*this); } + /// embedded bib files + mutable EmbeddedFileList bibfiles_; };