4 #include "mathed/math_data.h"
5 #include "insets/insetbase.h"
8 #include <boost/assert.hpp>
12 void lyxbreaker(void const * data, const char * hint, int size);
19 Point(int x, int y) : x_(x), y_(y)
21 BOOST_ASSERT(x > -3000);
22 BOOST_ASSERT(x < 4000);
23 BOOST_ASSERT(y > -3000);
24 BOOST_ASSERT(y < 4000);
31 template <class T> class CoordCacheBase {
38 void add(T const * thing, int x, int y)
40 data_[thing] = Point(x, y);
43 int x(T const * thing) const
46 return data_.find(thing)->second.x_;
49 int y(T const * thing) const
52 return data_.find(thing)->second.y_;
55 Point xy(T const * thing) const
58 return data_.find(thing)->second;
61 bool has(T const * thing) const
63 return data_.find(thing) != data_.end();
67 friend class CoordCache;
69 void check(T const * thing, char const * hint) const
72 lyxbreaker(thing, hint, data_.size());
77 std::map<T const *, Point> data_;
85 CoordCacheBase<MathArray> arrays_;
86 CoordCacheBase<InsetBase> insets_;
89 extern CoordCache theCoords;