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