2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2001 The LyX Team.
9 * ======================================================
12 * \author Angus Leeming <a.leeming@ic.ac.uk>
15 #ifndef BIBLIOHELPERS_H
16 #define BIBLIOHELPERS_H
24 /** Functions of use to citation and bibtex GUI controllers and views */
53 /// First entry is the bibliography key, second the data
54 typedef std::map<string, string> InfoMap;
56 /// Returns a vector of bibliography keys
57 std::vector<string> const getKeys(InfoMap const &);
59 /** Returns the BibTeX data associated with a given key.
60 Empty if no info exists. */
61 string const getInfo(InfoMap const &, string const &);
63 /** Search a BibTeX info field for the given key and return the
65 string const parseBibTeX(string data, string const & findkey);
67 /** Returns an iterator to the first key that meets the search
68 criterion, or end() if unsuccessful.
71 the InfoMap of bibkeys info,
72 the vector of keys to be searched,
74 an iterator defining the starting point of the search,
75 an enum defining a Simple or Regex search,
76 an enum defining the search direction.
79 std::vector<string>::const_iterator
80 searchKeys(InfoMap const & map,
81 std::vector<string> const & keys_to_search,
82 string const & search_expression,
83 std::vector<string>::const_iterator start,
86 bool caseSensitive=false);
88 /// Type returned by getCitationStyle, below
89 struct CitationStyle {
91 CitationStyle() : style(CITE), full(false), forceUCase(false) {}
99 /// Given the LaTeX command, return the appropriate CitationStyle
100 CitationStyle const getCitationStyle(string const & command);
102 /** Returns the LaTeX citation command
106 a flag forcing the full author list,
107 a flag forcing upper case, e.g. "della Casa" becomes "Della Case"
109 string const getCiteCommand(CiteStyle, bool full, bool forceUCase);
111 /// Returns a vector of available Citation styles.
112 std::vector<CiteStyle> const getCiteStyles(bool usingNatbib);
115 "Translates" the available Citation Styles into strings for this key.
116 The returned string is displayed by the GUI.
119 [XX] is used in place of the actual reference
120 Eg, the vector will contain: [XX], Jones et al. [XX], ...
124 the InfoMap of bibkeys info,
125 the available citation styles
127 std::vector<string> const
128 getNumericalStrings(string const & key,
130 std::vector<CiteStyle> const & styles);
133 "Translates" the available Citation Styles into strings for this key.
134 The returned string is displayed by the GUI.
136 Eg, the vector will contain:
137 Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
141 the InfoMap of bibkeys info,
142 the available citation styles
144 std::vector<string> const
145 getAuthorYearStrings(string const & key,
147 std::vector<CiteStyle> const & styles);
148 } // namespace biblio
150 #endif // BIBLIOHELPERS_H