2 * \file ConsoleApplication.h
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
11 #ifndef CONSOLEAPPLICATION_H
12 #define CONSOLEAPPLICATION_H
14 #include "support/strfwd.h"
20 class ConsoleApplicationPrivate;
22 /// The main application class for console mode.
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.
29 class ConsoleApplication
31 friend class ConsoleApplicationPrivate;
33 ConsoleApplication(std::string const & app, int & argc, char ** argv);
34 virtual ~ConsoleApplication();
36 /// Start the event loop and execute the application
41 /// This is called after the event loop was started.
42 virtual void doExec() = 0;
44 * Exit the application with status \p status.
45 * This must be called from doExec(), otherwise the application runs
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
52 void exit(int status);
55 ConsoleApplicationPrivate * const d;
58 } // namespace support
61 #endif // CONSOLEAPPLICATION_H