]> git.lyx.org Git - lyx.git/blob - src/boost.cpp
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / boost.cpp
1 /**
2  * \file boost.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 "LyX.h"
14
15 #include "support/debug.h"
16
17 #include "support/lassert.h"
18
19 #include <exception>
20 #include <iomanip>
21 #include <ostream>
22
23 using namespace std;
24 using lyx::lyxerr;
25
26 namespace boost {
27
28 #ifndef BOOST_NO_EXCEPTIONS
29 void throw_exception(exception const & e)
30 {
31         lyxerr << "Exception caught:\n" << e.what() << endl;
32         LASSERT(false, /**/);
33 }
34 #endif
35
36
37 void assertion_failed(char const * expr, char const * function,
38                 char const * file, long line)
39 {
40         lyxerr << "Assertion triggered in " << function
41                << " by failing check \"" << expr << "\""
42                << " in file " << file << ":" << line << endl;
43
44         // FIXME: by default we exit here but we could also inform the user
45         // about the assertion and do the emergency cleanup without exiting.
46         // FIXME: do we have a list of exit codes defined somewhere?
47         lyx::lyx_exit(1);
48 }
49
50 void assertion_failed_msg(char const * expr, char const * msg,
51                 char const * function, char const * file, long line)
52 {
53         lyxerr << "Assertion triggered in " << function
54                << " by failing check \"" << expr << "\""
55                << " with message \"" << msg << "\""
56                << " in file " << file << ":" << line << endl;
57
58         // FIXME: by default we exit here but we could also inform the user
59         // about the assertion and do the emergency cleanup without exiting.
60         // FIXME: do we have a list of exit codes defined somewhere?
61         lyx::lyx_exit(1);
62 }
63
64 } // namespace boost