4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS
12 #ifndef BIBLIOHELPERS_H
13 #define BIBLIOHELPERS_H
23 /** Functions of use to citation and bibtex GUI controllers and views */
54 /// First entry is the bibliography key, second the data
55 typedef std::map<string, string> InfoMap;
57 /// Returns a vector of bibliography keys
58 std::vector<string> const getKeys(InfoMap const &);
60 /** Returns the BibTeX data associated with a given key.
61 Empty if no info exists. */
62 string const getInfo(InfoMap const &, string const &);
64 // rturn the year from the bibtex data record
65 string const getYear(InfoMap const & map, string const & key);
67 /// return the short form of an authorlist
68 string const getAbbreviatedAuthor(InfoMap const & map, string const & key);
70 // return only the family name
71 string const familyName(string const & name);
73 /** Search a BibTeX info field for the given key and return the
75 string const parseBibTeX(string data, string const & findkey);
77 /** Returns an iterator to the first key that meets the search
78 criterion, or end() if unsuccessful.
81 the InfoMap of bibkeys info,
82 the vector of keys to be searched,
84 an iterator defining the starting point of the search,
85 an enum defining a Simple or Regex search,
86 an enum defining the search direction.
89 std::vector<string>::const_iterator
90 searchKeys(InfoMap const & map,
91 std::vector<string> const & keys_to_search,
92 string const & search_expression,
93 std::vector<string>::const_iterator start,
96 bool caseSensitive=false);
98 /// Type returned by getCitationStyle, below
99 struct CitationStyle {
101 CitationStyle() : style(CITE), full(false), forceUCase(false) {}
110 /// Given the LaTeX command, return the appropriate CitationStyle
111 CitationStyle const getCitationStyle(string const & command);
113 /** Returns the LaTeX citation command
117 a flag forcing the full author list,
118 a flag forcing upper case, e.g. "della Casa" becomes "Della Case"
120 string const getCiteCommand(CiteStyle, bool full, bool forceUCase);
122 /// Returns a vector of available Citation styles.
123 std::vector<CiteStyle> const getCiteStyles(bool usingNatbib);
126 "Translates" the available Citation Styles into strings for this key.
127 The returned string is displayed by the GUI.
130 [XX] is used in place of the actual reference
131 Eg, the vector will contain: [XX], Jones et al. [XX], ...
135 the InfoMap of bibkeys info,
136 the available citation styles
138 std::vector<string> const
139 getNumericalStrings(string const & key,
141 std::vector<CiteStyle> const & styles);
144 "Translates" the available Citation Styles into strings for this key.
145 The returned string is displayed by the GUI.
147 Eg, the vector will contain:
148 Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
152 the InfoMap of bibkeys info,
153 the available citation styles
155 std::vector<string> const
156 getAuthorYearStrings(string const & key,
158 std::vector<CiteStyle> const & styles);
159 } // namespace biblio
161 #endif // BIBLIOHELPERS_H