4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
11 * Full author contact details are available in file CREDITS.
17 #include "support/docstring.h"
32 ENGINE_NATBIB_AUTHORYEAR,
33 ENGINE_NATBIB_NUMERICAL,
52 CitationStyle(CiteStyle s = CITE, bool f = false, bool force = false)
53 : style(s), full(f), forceUCase(force) {}
54 /// \param latex_str a LaTeX command, "cite", "Citep*", etc
55 CitationStyle(std::string const & latex_str);
57 std::string const asLatexStr() const;
66 /// Returns a vector of available Citation styles.
67 std::vector<CiteStyle> const getCiteStyles(CiteEngine const );
71 /// Class to represent information about a BibTeX or
72 /// bibliography entry.
73 /// The keys are BibTeX fields (e.g., author, title, etc),
74 /// and the values are the associated field values.
75 class BibTeXInfo : public std::map<docstring, docstring> {
79 ///Search for the given field and return the associated info.
80 ///The point of this is that BibTeXInfo::operator[] has no const
82 docstring const & getValueForField(docstring const & field) const;
84 docstring const & getValueForField(std::string const & field) const;
86 bool hasField(docstring const & field) const;
87 /// return the short form of an authorlist
88 docstring const getAbbreviatedAuthor() const;
90 docstring const getYear() const;
91 /// Returns formatted BibTeX data suitable for framing.
92 docstring const getInfo() const;
93 /// the BibTeX key for this entry
95 /// a single string containing all BibTeX data associated with this key
97 /// the BibTeX entry type (article, book, incollection, ...)
99 /// true if from BibTeX; false if from bibliography environment
104 /// Class to represent a collection of bibliographical data, whether
105 /// from BibTeX or from bibliography environments.
106 /// BiblioInfo.first is the bibliography key
107 /// BiblioInfo.second is the data for that key
108 class BiblioInfo : public std::map<docstring, BibTeXInfo> {
110 /// Returns a sorted vector of bibliography keys
111 std::vector<docstring> const getKeys() const;
112 /// Returns a sorted vector of present BibTeX fields
113 std::vector<docstring> const getFields() const;
114 /// Returns a sorted vector of BibTeX entry types in use
115 std::vector<docstring> const getEntries() const;
116 /// Fills keys with BibTeX information derived from the various insets
117 /// in a given buffer, in its master document.
118 void fillWithBibKeys(Buffer const * const buf);
119 /// return the short form of an authorlist
120 docstring const getAbbreviatedAuthor(docstring const & key) const;
121 /// return the year from the bibtex data record
122 docstring const getYear(docstring const & key) const;
123 /// Returns formatted BibTeX data associated with a given key.
124 /// Empty if no info exists.
125 docstring const getInfo(docstring const & key) const;
128 * "Translates the available Citation Styles into strings for a given key,
129 * either numerical or author-year depending upon the active engine. (See
130 * below for those methods.)
132 std::vector<docstring> const
133 getCiteStrings(docstring const & key, Buffer const & buf) const;
135 * "Translates" the available Citation Styles into strings for a given key.
136 * The returned string is displayed by the GUI.
137 * [XX] is used in place of the actual reference
138 * Eg, the vector will contain: [XX], Jones et al. [XX], ...
143 std::vector<docstring> const
144 getNumericalStrings(docstring const & key, Buffer const & buf) const;
146 * "Translates" the available Citation Styles into strings for a given key.
147 * The returned string is displayed by the GUI.
148 * Eg, the vector will contain:
149 * Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
154 std::vector<docstring> const
155 getAuthorYearStrings(docstring const & key, Buffer const & buf) const;
157 std::set<docstring> fieldNames;
158 std::set<docstring> entryTypes;