Joedb
10.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
src
joedb
ui
main_wrapper.cpp
Go to the documentation of this file.
1
#include "
joedb/ui/main_wrapper.h
"
2
3
#include <iostream>
4
#include <cstdio>
5
6
namespace
joedb
7
{
8
/// Process command-line arguments and catch exceptions from main
9
///
10
/// This function is particularly necessary in Windows, because no
11
/// exception information is printed when main throws.
12
///
13
/// @ingroup ui
14
int
main_wrapper
15
(
16
int
(*
main
)(
Arguments
&),
int
argc,
char
**argv
17
)
18
{
19
// necessary for fast console output in Windows
20
std::setvbuf(stdout,
nullptr
, _IOFBF, 8192);
21
std::setvbuf(stderr,
nullptr
, _IOFBF, 8192);
22
std::cerr.unsetf(std::ios_base::unitbuf);
23
24
try
25
{
26
Arguments
arguments(argc, argv);
27
const
int
result =
main
(arguments);
28
return
result;
29
}
30
catch
(
const
std::exception &e)
31
{
32
std::cerr <<
"Exception caught: "
<< e.what() <<
'\n'
;
33
return
1;
34
}
35
}
36
}
joedb::Arguments
Class for conveniently parsing command-line arguments.
Definition
Arguments.h:16
main
int main()
Definition
concurrency_tutorial.cpp:6
joedb::main_wrapper
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.
Definition
main_wrapper.cpp:15
main
int main(int argc, char **argv)
Definition
joedbc.cpp:283
main_wrapper.h
joedb
Definition
Server.cpp:10
Generated by
1.15.0