#include "Buffer.h"
#include "BufferParams.h"
#include "DispatchResult.h"
-#include "support/debug.h"
#include "EmbeddedFiles.h"
#include "Encoding.h"
#include "FuncRequest.h"
-#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "frontends/alert.h"
+#include "support/debug.h"
#include "support/ExceptionMessage.h"
#include "support/docstream.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Path.h"
#include "support/textutils.h"
#include <boost/tokenizer.hpp>
+#include <limits>
using namespace std;
using namespace lyx::support;
embedStatus = split(embedStatus, emb, ',');
while (!tmp.empty()) {
EmbeddedFile file(changeExtension(tmp, "bib"), cur.buffer().filePath());
- if (!file.exists())
- continue;
if (!newBibfiles.empty())
newBibfiles += ",";
newBibfiles += tmp;
// use such filenames.)
// Otherwise, store the (maybe absolute) path to the original,
// unmangled database name.
- typedef boost::char_separator<char_type> Separator;
- typedef boost::tokenizer<Separator, docstring::const_iterator, docstring> Tokenizer;
-
- Separator const separator(from_ascii(",").c_str());
- // The tokenizer must not be called with temporary strings, since
- // it does not make a copy and uses iterators of the string further
- // down. getParam returns a reference, so this is OK.
- Tokenizer const tokens(getParam("bibfiles"), separator);
- Tokenizer::const_iterator const begin = tokens.begin();
- Tokenizer::const_iterator const end = tokens.end();
-
+ EmbeddedFileList const bibs = getFiles(buffer);
+ EmbeddedFileList::const_iterator it = bibs.begin();
+ EmbeddedFileList::const_iterator it_end = bibs.end();
odocstringstream dbs;
- for (Tokenizer::const_iterator it = begin; it != end; ++it) {
- docstring const input = trim(*it);
- // FIXME UNICODE
- string utf8input = to_utf8(input);
+ for (; it != it_end; ++it) {
+ string utf8input = removeExtension(it->availableFile().absFilename());
string database =
normalizeName(buffer, runparams, utf8input, ".bib");
FileName const try_in_file(makeAbsPath(database + ".bib", buffer.filePath()));
from_utf8(database));
}
- if (it != begin)
+ if (it != bibs.begin())
dbs << ',';
// FIXME UNICODE
dbs << from_utf8(latex_path(database));
docstring value;
docstring commaNewline;
docstring data;
- BibTeXInfo keyvalmap;
- keyvalmap.entryType = entryType;
+ BibTeXInfo keyvalmap(key, entryType);
bool readNext = removeWSAndComma(ifs);
keyvalmap[name] = value;
data += "\n\n" + value;
- keylist.fieldNames.insert(name);
+ keylist.addFieldName(name);
readNext = removeWSAndComma(ifs);
}
// add the new entry
- keylist.entryTypes.insert(entryType);
- keyvalmap.allData = data;
- keyvalmap.isBibTeX = true;
- keyvalmap.bibKey = key;
+ keylist.addEntryType(entryType);
+ keyvalmap.setAllData(data);
keylist[key] = keyvalmap;
}
} //< searching '@'