4 * See the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS
11 #ifndef BIBLIOHELPERS_H
12 #define BIBLIOHELPERS_H
21 /** Functions of use to citation and bibtex GUI controllers and views */
50 /// First entry is the bibliography key, second the data
51 typedef std::map<string, string> InfoMap;
53 /// Returns a vector of bibliography keys
54 std::vector<string> const getKeys(InfoMap const &);
56 /** Returns the BibTeX data associated with a given key.
57 Empty if no info exists. */
58 string const getInfo(InfoMap const &, string const &);
60 // rturn the year from the bibtex data record
61 string const getYear(InfoMap const & map, string const & key);
63 /// return the short form of an authorlist
64 string const getAbbreviatedAuthor(InfoMap const & map, string const & key);
66 // return only the family name
67 string const familyName(string const & name);
69 /** Search a BibTeX info field for the given key and return the
71 string const parseBibTeX(string data, string const & findkey);
73 /** Returns an iterator to the first key that meets the search
74 criterion, or end() if unsuccessful.
77 the InfoMap of bibkeys info,
78 the vector of keys to be searched,
80 an iterator defining the starting point of the search,
81 an enum defining a Simple or Regex search,
82 an enum defining the search direction.
85 std::vector<string>::const_iterator
86 searchKeys(InfoMap const & map,
87 std::vector<string> const & keys_to_search,
88 string const & search_expression,
89 std::vector<string>::const_iterator start,
92 bool caseSensitive=false);
94 /// Type returned by getCitationStyle, below
95 struct CitationStyle {
97 CitationStyle() : style(CITE), full(false), forceUCase(false) {}
105 /// Given the LaTeX command, return the appropriate CitationStyle
106 CitationStyle const getCitationStyle(string const & command);
108 /** Returns the LaTeX citation command
112 a flag forcing the full author list,
113 a flag forcing upper case, e.g. "della Casa" becomes "Della Case"
115 string const getCiteCommand(CiteStyle, bool full, bool forceUCase);
117 /// Returns a vector of available Citation styles.
118 std::vector<CiteStyle> const getCiteStyles(bool usingNatbib);
121 "Translates" the available Citation Styles into strings for this key.
122 The returned string is displayed by the GUI.
125 [XX] is used in place of the actual reference
126 Eg, the vector will contain: [XX], Jones et al. [XX], ...
130 the InfoMap of bibkeys info,
131 the available citation styles
133 std::vector<string> const
134 getNumericalStrings(string const & key,
136 std::vector<CiteStyle> const & styles);
139 "Translates" the available Citation Styles into strings for this key.
140 The returned string is displayed by the GUI.
142 Eg, the vector will contain:
143 Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
147 the InfoMap of bibkeys info,
148 the available citation styles
150 std::vector<string> const
151 getAuthorYearStrings(string const & key,
153 std::vector<CiteStyle> const & styles);
154 } // namespace biblio
156 #endif // BIBLIOHELPERS_H