Main MRPT website
>
C++ reference for MRPT 1.9.9
error_box.cpp
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| Mobile Robot Programming Toolkit (MRPT) |
3
| http://www.mrpt.org/ |
4
| |
5
| Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6
| See: http://www.mrpt.org/Authors - All rights reserved. |
7
| Released under BSD License. See details in http://www.mrpt.org/License |
8
+---------------------------------------------------------------------------+
9
*/
10
11
#include "
gui-precomp.h
"
// Precompiled headers
12
13
#include <
mrpt/gui/error_box.h
>
14
#if MRPT_HAS_Qt5
15
#include <QErrorMessage>
16
#include <QString>
17
#else
18
#include <iostream>
19
#endif // MRPT_HAS_Qt5
20
#if MRPT_HAS_WXWIDGETS
21
#include <
mrpt/gui/WxUtils.h
>
22
#endif
23
24
void
mrpt::gui::tryCatch
(
25
const
std::function<
void
()>& tryPart,
const
std::string
& catchMessage)
26
{
27
try
28
{
29
tryPart();
30
}
31
catch
(std::exception& e)
32
{
33
showErrorMessage
(catchMessage + e.what());
34
}
35
catch
(...)
36
{
37
showErrorMessage
(
"Untyped exception!"
);
38
}
39
}
40
41
void
mrpt::gui::showErrorMessage
(
const
std::string
& str)
42
{
43
#if MRPT_HAS_Qt5
44
QErrorMessage msg;
45
msg.showMessage(QString::fromStdString(str));
46
msg.exec();
47
#elif MRPT_HAS_WXWIDGETS
48
wxMessageBox(
_U
(str.c_str()), _(
"Exception"
));
49
#else
50
std::cerr << str << std::endl;
51
#endif // MRPT_HAS_Qt5
52
}
WxUtils.h
error_box.h
gui-precomp.h
mrpt::gui::showErrorMessage
void showErrorMessage(const std::string &str)
Definition:
error_box.cpp:41
mrpt::gui::tryCatch
void tryCatch(const std::function< void()> &tryPart, const std::string &catchMessage)
Definition:
error_box.cpp:24
string
GLsizei const GLchar ** string
Definition:
glext.h:4101
_U
#define _U(x)
Definition:
WxSubsystem.h:505
Page generated by
Doxygen 1.8.17
for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST