]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/biblio.h
Controller-view split of Graphics and Index popups.
[lyx.git] / src / frontends / controllers / biblio.h
1 /* This file is part of
2  * ====================================================== 
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 2001 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \file biblio.h
11  * \author Angus Leeming <a.leeming@ic.ac.uk>
12  */
13
14 #ifndef BIBLIOHELPERS_H
15 #define BIBLIOHELPERS_H
16
17 #include <map>
18
19 #ifdef __GNUG__
20 #pragma interface
21 #endif
22
23 /** Functions of use to citation and bibtex GUI controllers and views */
24 namespace biblio 
25 {
26         ///
27         enum Search {
28                 ///
29                 SIMPLE,
30                 ///
31                 REGEX
32         };
33         ///
34         enum Direction {
35                 ///
36                 FORWARD,
37                 ///
38                 BACKWARD
39         };
40
41         /// First entry is the bibliography key, second the data
42         typedef std::map<string, string> InfoMap;
43
44         /// Returns a vector of bibliography keys
45         std::vector<string> const getKeys(InfoMap const &);
46
47         /** Returns the BibTeX data associated with a given key.
48             Empty if no info exists. */
49         string const getInfo(InfoMap const &, string const &);
50
51         /** Search a BibTeX info field for the given key and return the
52             associated field. */
53         string const parseBibTeX(string data, string const & findkey);
54
55         /** Returns an iterator to the first key that meets the search
56             criterion, or end() if unsuccessful.
57
58             User supplies :
59             the InfoMap of bibkeys info,
60             the vector of keys to be searched,
61             the search criterion,
62             an iterator defining the starting point of the search,
63             an enum defining a Simple or Regex search,
64             an enum defining the search direction.
65         */
66
67         std::vector<string>::const_iterator
68             searchKeys(InfoMap const & map,
69                        std::vector<string> const & keys_to_search,
70                        string const & search_expression,
71                        std::vector<string>::const_iterator start,
72                        Search,
73                        Direction,
74                        bool caseSensitive=false);
75
76         /** Do the dirty work for the search.
77             Should use through the function above */
78         std::vector<string>::const_iterator
79             simpleSearch(InfoMap const & map,
80                          std::vector<string> const & keys_to_search,
81                          string const & search_expression,
82                          std::vector<string>::const_iterator start,
83                          Direction,
84                          bool caseSensitive=false);
85
86         /// Should use through the function above
87         std::vector<string>::const_iterator
88             regexSearch(InfoMap const & map,
89                         std::vector<string> const & keys_to_search,
90                         string const & search_expression,
91                         std::vector<string>::const_iterator start,
92                         Direction);
93
94 } // namespace biblio 
95
96 #endif // BIBLIOHELPERS_H