]> git.lyx.org Git - lyx.git/blob - src/CoordCache.cpp
Fulfill promise to Andre: TextClass_ptr --> TextClassPtr.
[lyx.git] / src / CoordCache.cpp
1 /* \file CoordCache.cpp
2  * This file is part of LyX, the document processor.
3  * Licence details can be found in the file COPYING.
4  *
5  * \author André Pönitz
6  *
7  * Full author contact details are available in file CREDITS.
8  */
9
10 #include <config.h>
11
12 #include "CoordCache.h"
13 #include "debug.h"
14
15 #include "Text.h"
16
17 #include "insets/Inset.h"
18
19 #include <boost/assert.hpp>
20
21
22 namespace lyx {
23
24 Point::Point(int x, int y)
25         : x_(x), y_(y)
26 {
27         BOOST_ASSERT(x > -1000000);
28         BOOST_ASSERT(x <  1000000);
29         BOOST_ASSERT(y > -1000000);
30         BOOST_ASSERT(y <  1000000);
31 }
32
33 // just a helper to be able to set a breakpoint
34 void lyxbreaker(void const * data, const char * hint, int size)
35 {
36         lyxerr << "break on pointer: " << data << " hint: " << hint
37                 << " size: " << size << std::endl;
38         BOOST_ASSERT(false);
39 }
40
41
42 void CoordCache::clear()
43 {
44         arrays_.clear();
45         insets_.clear();
46         slices0_.clear();
47         slices1_.clear();
48 }
49
50
51 void CoordCache::dump() const
52 {
53         lyxerr << "InsetCache contains:" << std::endl;
54         for (CoordCacheBase<Inset>::cache_type::const_iterator it = getInsets().getData().begin(); it != getInsets().getData().end(); ++it) {
55                 Inset const * inset = it->first;
56                 Point const p = it->second;
57                 lyxerr << "Inset " << inset << "(" << to_utf8(inset->name())
58                         << ") has point " << p.x_ << "," << p.y_ << std::endl;
59         }
60 }
61
62 } // namespace lyx