3 * \file CiteEnginesList.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Richard Kimberly Heck
8 * \author Jürgen Spitzmüller
10 * Full author contact details are available in file CREDITS.
13 #ifndef CITEENGINESLIST_H
14 #define CITEENGINESLIST_H
24 * This class represents a particular LyX "cite engine", which defines the features
25 * of a particular citation backend such as natbib or biblatex.
27 * In general, a given cite engine can be used with any document class. That said,
28 * one cite engine may `require' another, or it may `exclude' some other cite engine.
29 * The requires and excludes are given in comments within the cite engine file,
30 * which must begin roughly so:
31 * # \DeclareLyXCiteEngine[natbib.sty]{Natbib}
33 * # Natbib supports a range of both author-year and numerical styles mainly
34 * # aimed at the Humanities. It features automatic sorting and merging of
35 * # numerical citations, annotations, capitalization of the `van' part of
36 * # author names, shortened and full author lists, and more.
38 * # Excludes: basic | jurabib
39 * The description will be used in the gui to give information to the user. The
40 * Requires and Excludes lines are read by the configuration script
41 * and written to a file citeengines.lst in the user configuration directory.
42 * That file is then read on startup to populate the CiteEnginesList, below.
44 * Engines can also be "provided" or "excluded" by document classes, using
45 * the ProvidesEngine and ExcludesEngine tags.
51 LyXCiteEngine(std::string const & name, std::string const & id,
52 std::vector<std::string> const & enginetypes,
53 std::string const & cfm,
54 std::vector<std::string> const & defaultbiblios,
55 std::string const & description,
56 std::vector<std::string> const & packagelist);
57 /// whether the required packages are available
58 bool isAvailable() const;
59 /// the missing prerequisites, if any
60 std::vector<std::string> prerequisites() const;
62 std::string const & getName() const { return name_; }
64 std::string const & getID() const { return id_; }
66 std::string const & getFilename() const { return filename_; }
68 std::string const & getCiteFramework() const { return cite_framework_; }
70 std::vector<std::string> const & getEngineType() const { return engine_types_; }
72 bool hasEngineType(CiteEngineType const &) const;
74 std::string getDefaultBiblio(CiteEngineType const &) const;
76 bool isDefaultBiblio(std::string const &) const;
78 std::string const & getDescription() const { return description_; }
80 std::vector<std::string> const & getPackageList() const
81 { return package_list_; }
83 bool required(std::string const & p) const;
85 /// what appears in the ui
87 /// the engine's unique identifier
88 /// at present, this is the filename, without the extension
91 std::string filename_;
92 /// the engine type(s)
93 std::vector<std::string> engine_types_;
94 /// cite framework (bibtex, biblatex)
95 std::string cite_framework_;
96 /// default bibliography styles
97 std::vector<std::string> default_biblios_;
98 /// a short description for use in the ui
99 std::string description_;
100 /// the LaTeX packages on which this depends, if any
101 std::vector<std::string> package_list_;
102 // these are mutable because they are used to cache the results
103 // of an otherwise const operation.
105 mutable bool checked_;
107 mutable bool available_;
109 mutable std::vector<std::string> prerequisites_;
112 typedef std::vector<LyXCiteEngine> LyXCiteEnginesList;
115 * The CiteEnginesList represents the various LyXCiteEngine's that are available at
118 class CiteEnginesList {
123 std::string getTypeAsString(CiteEngineType const &) const;
125 CiteEngineType getType(std::string const &) const;
126 /// reads the engines from a file generated by configure.py
129 LyXCiteEnginesList::const_iterator begin() const;
131 LyXCiteEnginesList::iterator begin();
133 LyXCiteEnginesList::const_iterator end() const;
135 LyXCiteEnginesList::iterator end();
137 bool empty() const { return englist_.empty(); }
138 /// Returns a pointer to the LyXCiteEngine with filename str.
139 /// Returns a null pointer if no such engine is found.
140 LyXCiteEngine const * operator[](std::string const & str) const;
142 LyXCiteEngine * operator[](std::string const & str);
145 CiteEnginesList(CiteEnginesList const &);
147 void operator=(CiteEnginesList const &);
148 /// add an engine to the list
149 void addCiteEngine(std::string const &, std::string const &,
150 std::vector<std::string> const &, std::string const &,
151 std::vector<std::string> const &, std::string const &,
152 std::vector<std::string> const &);
154 std::vector<LyXCiteEngine> englist_;
157 extern CiteEnginesList theCiteEnginesList;