- if (!fil.empty()) {
- // This is a _very_ simple parser for Bibtex database
- // files. All it does is to look for lines starting
- // in @ and not being @preamble and @string entries.
- // It does NOT do any syntax checking!
- ifstream ifs(fil.c_str());
- string linebuf0;
- while (getline(ifs, linebuf0)) {
- string linebuf = frontStrip(strip(linebuf0));
- if (linebuf.empty() ) continue;
- if (prefixIs(linebuf, "@")) {
- linebuf = subst(linebuf, '{', '(');
- linebuf = split(linebuf, tmp, '(');
- tmp = lowercase(tmp);
- if (!prefixIs(tmp, "@string")
- && !prefixIs(tmp, "@preamble")) {
- linebuf = split(linebuf, tmp, ',');
- tmp = frontStrip(tmp);
- if (!tmp.empty()) {
- keys.push_back(pair<string,string>(tmp,string()));
- }
+ if (!file.empty())
+ vec.push_back(file);
+
+ // Get next file name
+ bibfiles = split(bibfiles, tmp, ',');
+ }
+
+ return vec;
+}
+
+// This method returns a comma separated list of Bibtex entries
+vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer) const
+{
+ vector<pair<string,string> > keys;
+
+ lyx::Assert(buffer);
+ vector<string> const files = getFiles(*buffer);
+ for (vector<string>::const_iterator it = files.begin();
+ it != files.end(); ++ it) {
+ // This is a _very_ simple parser for Bibtex database
+ // files. All it does is to look for lines starting
+ // in @ and not being @preamble and @string entries.
+ // It does NOT do any syntax checking!
+ ifstream ifs(it->c_str());
+ string linebuf0;
+ while (getline(ifs, linebuf0)) {
+ string linebuf = frontStrip(strip(linebuf0));
+ if (linebuf.empty()) continue;
+ if (prefixIs(linebuf, "@")) {
+ linebuf = subst(linebuf, '{', '(');
+ string tmp;
+ linebuf = split(linebuf, tmp, '(');
+ tmp = lowercase(tmp);
+ if (!prefixIs(tmp, "@string")
+ && !prefixIs(tmp, "@preamble")) {
+ linebuf = split(linebuf, tmp, ',');
+ tmp = frontStrip(tmp);
+ if (!tmp.empty()) {
+ keys.push_back(pair<string,string>(tmp,string()));