* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Richard Heck
+ * \author Richard Kimberly Heck
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
#include "CiteEnginesList.h"
-#include "Citation.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
LyXCiteEngine::LyXCiteEngine(string const & n, string const & i,
vector<string> const & cet, string const & cfm,
vector<string> const & dbs,
- string const & d, vector<string> const & p,
- vector<string> const & r, vector<string> const & e):
+ string const & d, vector<string> const & p):
name_(n), id_(i), engine_types_(cet), cite_framework_(cfm), default_biblios_(dbs),
- description_(d), package_list_(p), required_engines_(r), excluded_engines_(e),
- checked_(false), available_(false)
+ description_(d), package_list_(p), checked_(false), available_(false)
{
filename_ = id_ + ".citeengine";
}
}
-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<string> 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;
bool LyXCiteEngine::isDefaultBiblio(string const & bf) const
{
string const bfs = ":" + bf;
- for (string const &s: default_biblios_)
+ for (string const & s: default_biblios_)
if (suffixIs(s, bfs) || bf == s)
return true;
}
+bool LyXCiteEngine::required(string const & p) const
+{
+ return find(package_list_.begin(), package_list_.end(), p) != package_list_.end();
+}
+
+
// used when sorting the cite engine list.
class EngineSorter {
public:
return translator;
}
-} // namespace anon
+} // namespace
string CiteEnginesList::getTypeAsString(CiteEngineType const & et) const
str = split(str, p, ',');
pkgs.push_back(p);
}
- if (!lex.next())
- break;
- str = lex.getString();
- LYXERR(Debug::TCLASS, "Required: " << str);
- vector<string> 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<string> 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, citeframework, dbs, desc, pkgs, req, exc);
+ // cename, fname, cets, citeframework, dbs, desc, pkgs
+ addCiteEngine(cename, fname, cets, citeframework, dbs, desc, pkgs);
} // end switch
} //end while
void CiteEnginesList::addCiteEngine(string const & cename,
string const & filename, vector<string> const & cets,
string const & citeframework, vector<string> const & dbs,
- string const & description, vector<string> const & pkgs,
- vector<string> const & req, vector<string> const & exc)
+ string const & description, vector<string> const & pkgs)
{
- LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs, req, exc);
+ LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs);
englist_.push_back(ce);
}
LyXCiteEngine const * CiteEnginesList::operator[](string const & str) const
{
- LyXCiteEnginesList::const_iterator it = englist_.begin();
- for (; it != englist_.end(); ++it)
- if (it->getID() == str) {
- LyXCiteEngine const & eng = *it;
+ for (auto const & eng : englist_)
+ if (eng.getID() == str) {
return ŋ
}
- return 0;
+ return nullptr;
}
LyXCiteEngine * CiteEnginesList::operator[](string const & str)
{
- LyXCiteEnginesList::iterator it = englist_.begin();
- for (; it != englist_.end(); ++it)
- if (it->getID() == str) {
- LyXCiteEngine & eng = *it;
+ for (auto & eng : englist_)
+ if (eng.getID() == str) {
return ŋ
}
- return 0;
+ return nullptr;
}
} // namespace lyx