]> git.lyx.org Git - lyx.git/blob - src/FloatList.cpp
#5502 add binding for full screen toggle on mac
[lyx.git] / src / FloatList.cpp
1 /**
2  * \file FloatList.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "FloatList.h"
14 #include "Floating.h"
15
16 using namespace std;
17
18 namespace lyx {
19
20 FloatList::FloatList()
21 {}
22
23
24 FloatList::const_iterator FloatList::begin() const
25 {
26         return list.begin();
27 }
28
29
30 FloatList::const_iterator FloatList::end() const
31 {
32         return list.end();
33 }
34
35
36 void FloatList::newFloat(Floating const & fl)
37 {
38         list[fl.floattype()] = fl;
39 }
40
41
42 string const FloatList::defaultPlacement(string const & t) const
43 {
44         List::const_iterator cit = list.find(t);
45         if (cit != list.end())
46                 return cit->second.placement();
47         return string();
48 }
49
50
51 bool FloatList::typeExist(string const & t) const
52 {
53         List::const_iterator cit = list.find(t);
54         return cit != list.end();
55 }
56
57
58 Floating const & FloatList::getType(string const & t) const
59 {
60         // I wish we could use exceptions
61         List::const_iterator cit = list.find(t);
62         if (cit != list.end())
63                 return cit->second;
64 #ifdef HAVE_EXCEPTIONS
65         throw UnknownFloatType(t);
66 #else
67         static Floating const empty_float;
68         return empty_float;
69 #endif
70 }
71
72
73 void FloatList::erase(string const & t)
74 {
75         list.erase(t);
76 }
77
78
79 FloatList::const_iterator FloatList::operator[](string const & t) const
80 {
81         return list.find(t);
82 }
83
84
85 } // namespace lyx