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,
53 CitationStyle(CiteStyle s = CITE, bool f = false, bool force = false)
54 : style(s), full(f), forceUCase(force) {}
55 /// \param latex_str a LaTeX command, "cite", "Citep*", etc
56 CitationStyle(std::string const & latex_str);
58 std::string const asLatexStr() const;
67 /// Returns a vector of available Citation styles.
68 std::vector<CiteStyle> const getCiteStyles(CiteEngine const );
72 /// Class to represent information about a BibTeX or
73 /// bibliography entry.
74 /// The keys are BibTeX fields (e.g., author, title, etc),
75 /// and the values are the associated field values.
76 class BibTeXInfo : public std::map<docstring, docstring> {
80 ///Search for the given field and return the associated info.
81 ///The point of this is that BibTeXInfo::operator[] has no const
83 docstring const & getValueForField(docstring const & field) const;
85 docstring const & getValueForField(std::string const & field) const;
87 bool hasField(docstring const & field) const;
88 /// return the short form of an authorlist
89 docstring const getAbbreviatedAuthor() const;
91 docstring const getYear() const;
92 /// Returns formatted BibTeX data suitable for framing.
93 docstring const getInfo() const;
94 /// the BibTeX key for this entry
96 /// a single string containing all BibTeX data associated with this key
98 /// the BibTeX entry type (article, book, incollection, ...)
100 /// true if from BibTeX; false if from bibliography environment
105 /// Class to represent a collection of bibliographical data, whether
106 /// from BibTeX or from bibliography environments.
107 /// BiblioInfo.first is the bibliography key
108 /// BiblioInfo.second is the data for that key
109 class BiblioInfo : public std::map<docstring, BibTeXInfo> {
111 /// Returns a sorted vector of bibliography keys
112 std::vector<docstring> const getKeys() const;
113 /// Returns a sorted vector of present BibTeX fields
114 std::vector<docstring> const getFields() const;
115 /// Returns a sorted vector of BibTeX entry types in use
116 std::vector<docstring> const getEntries() const;
117 /// Fills keys with BibTeX information derived from the various insets
118 /// in a given buffer, in its master document.
119 void fillWithBibKeys(Buffer const * const buf);
120 /// return the short form of an authorlist
121 docstring const getAbbreviatedAuthor(docstring const & key) const;
122 /// return the year from the bibtex data record
123 docstring const getYear(docstring const & key) const;
124 /// Returns formatted BibTeX data associated with a given key.
125 /// Empty if no info exists.
126 docstring const getInfo(docstring const & key) const;
129 * "Translates the available Citation Styles into strings for a given key,
130 * either numerical or author-year depending upon the active engine. (See
131 * below for those methods.)
133 std::vector<docstring> const
134 getCiteStrings(docstring const & key, Buffer const & buf) const;
136 * "Translates" the available Citation Styles into strings for a given key.
137 * The returned string is displayed by the GUI.
138 * [XX] is used in place of the actual reference
139 * Eg, the vector will contain: [XX], Jones et al. [XX], ...
144 std::vector<docstring> const
145 getNumericalStrings(docstring const & key, Buffer const & buf) const;
147 * "Translates" the available Citation Styles into strings for a given key.
148 * The returned string is displayed by the GUI.
149 * Eg, the vector will contain:
150 * Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
155 std::vector<docstring> const
156 getAuthorYearStrings(docstring const & key, Buffer const & buf) const;
158 std::set<docstring> fieldNames;
159 std::set<docstring> entryTypes;