]> git.lyx.org Git - lyx.git/blob - src/support/ConsoleApplication.h
Disable CheckTeX while buffer is processed
[lyx.git] / src / support / ConsoleApplication.h
1 /**
2  * \file ConsoleApplication.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Georg Baum
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #ifndef CONSOLEAPPLICATION_H
12 #define CONSOLEAPPLICATION_H
13
14 #include "support/strfwd.h"
15
16 namespace lyx {
17
18 namespace support {
19
20 class ConsoleApplicationPrivate;
21
22 /// The main application class for console mode.
23 /**
24 There should be only one instance of this class. No Qt object
25 initialisation should be done before the instantiation of this class.
26 This class could be moved to src/frontends/console in the future.
27 This would make sense if more console app related code is created.
28 */
29 class ConsoleApplication
30 {
31         friend class ConsoleApplicationPrivate;
32 public:
33         ConsoleApplication(std::string const & app, int & argc, char ** argv);
34         virtual ~ConsoleApplication();
35
36         /// Start the event loop and execute the application
37         int exec();
38
39 protected:
40         /// Do the real work.
41         /// This is called after the event loop was started.
42         virtual void doExec() = 0;
43         /**
44          * Exit the application with status \p status.
45          * This must be called from doExec(), otherwise the application runs
46          * forever.
47          * Note that in contrast to the ISO C function ::exit() this method does
48          * return. It only registers that the program is to be stopped with the
49          * given status code, and this happens the next time the event loop is
50          * processed.
51          */
52         void exit(int status);
53
54 private:
55         ConsoleApplicationPrivate * const d;
56 };
57
58 } // namespace support
59 } // namespace lyx
60
61 #endif // CONSOLEAPPLICATION_H