X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCiteEnginesList.cpp;h=58b686511b0eda996efd99dd093001ccc5f543bf;hb=8ab9b8e0b6743680faa7059ea1f3ff1d9822ba4a;hp=279063cafd37cf8d2c40f4db90fbfe605a17ce44;hpb=297eb4cd5caa33d0c2c67461eb83e963958d2253;p=lyx.git diff --git a/src/CiteEnginesList.cpp b/src/CiteEnginesList.cpp index 279063cafd..58b686511b 100644 --- a/src/CiteEnginesList.cpp +++ b/src/CiteEnginesList.cpp @@ -38,12 +38,11 @@ CiteEnginesList theCiteEnginesList; LyXCiteEngine::LyXCiteEngine(string const & n, string const & i, - vector const & cet, vector const & dbs, - string const & d, vector const & p, - vector const & r, vector const & e): - name_(n), id_(i), engine_types_(cet), default_biblios_(dbs), description_(d), - package_list_(p), required_engines_(r), excluded_engines_(e), - checked_(false), available_(false) + vector const & cet, string const & cfm, + vector const & dbs, + string const & d, vector const & p): + name_(n), id_(i), engine_types_(cet), cite_framework_(cfm), default_biblios_(dbs), + description_(d), package_list_(p), checked_(false), available_(false) { filename_ = id_ + ".citeengine"; } @@ -85,39 +84,6 @@ bool LyXCiteEngine::hasEngineType(CiteEngineType const & et) const } -bool LyXCiteEngine::isCompatible(string const & cename) const -{ - // do we exclude it? - if (find(excluded_engines_.begin(), excluded_engines_.end(), cename) != - excluded_engines_.end()) - return false; - - LyXCiteEngine const * const lm = theCiteEnginesList[cename]; - if (!lm) - return true; - - // does it exclude us? - vector const excengs = lm->getExcludedEngines(); - if (find(excengs.begin(), excengs.end(), id_) != excengs.end()) - return false; - - return true; -} - - -bool LyXCiteEngine::areCompatible(string const & eng1, string const & eng2) -{ - LyXCiteEngine const * const lm1 = theCiteEnginesList[eng1]; - if (lm1) - return lm1->isCompatible(eng2); - LyXCiteEngine const * const lm2 = theCiteEnginesList[eng2]; - if (lm2) - return lm2->isCompatible(eng1); - // Can't check it either way. - return true; -} - - string LyXCiteEngine::getDefaultBiblio(CiteEngineType const & cet) const { string res; @@ -144,6 +110,12 @@ bool LyXCiteEngine::isDefaultBiblio(string const & bf) const } +bool LyXCiteEngine::requires(const string p) const +{ + return find(package_list_.begin(), package_list_.end(), p) != package_list_.end(); +} + + // used when sorting the cite engine list. class EngineSorter { public: @@ -176,7 +148,7 @@ CiteEngineTypeTranslator const & citeenginetypetranslator() return translator; } -} // namespace anon +} // namespace string CiteEnginesList::getTypeAsString(CiteEngineType const & et) const @@ -243,6 +215,10 @@ bool CiteEnginesList::read() cet = split(cet, p, '|'); cets.push_back(p); } + if (!lex.next(true)) + break; + string const citeframework = lex.getString(); + LYXERR(Debug::TCLASS, "CiteFramework: " << citeframework); if (!lex.next(true)) break; string db = lex.getString(); @@ -268,29 +244,9 @@ bool CiteEnginesList::read() str = split(str, p, ','); pkgs.push_back(p); } - if (!lex.next()) - break; - str = lex.getString(); - LYXERR(Debug::TCLASS, "Required: " << str); - vector req; - while (!str.empty()) { - string p; - str = split(str, p, '|'); - req.push_back(p); - } - if (!lex.next()) - break; - str = lex.getString(); - LYXERR(Debug::TCLASS, "Excluded: " << str); - vector exc; - while (!str.empty()) { - string p; - str = split(str, p, '|'); - exc.push_back(p); - } // This code is run when we have - // cename, fname, desc, pkgs, req and exc - addCiteEngine(cename, fname, cets, dbs, desc, pkgs, req, exc); + // cename, fname, cets, citeframework, dbs, desc, pkgs + addCiteEngine(cename, fname, cets, citeframework, dbs, desc, pkgs); } // end switch } //end while @@ -304,11 +260,10 @@ bool CiteEnginesList::read() void CiteEnginesList::addCiteEngine(string const & cename, string const & filename, vector const & cets, - vector const & dbs, string const & description, - vector const & pkgs, vector const & req, - vector const & exc) + string const & citeframework, vector const & dbs, + string const & description, vector const & pkgs) { - LyXCiteEngine ce(cename, filename, cets, dbs, description, pkgs, req, exc); + LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs); englist_.push_back(ce); }