00001 /* 00002 * Application.h 00003 * 00004 * Smalltalk like class library for C++ 00005 * Abstract application. Header. 00006 * 00007 * Copyright (c) 2004 Milan Cermak 00008 */ 00009 /* 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 #ifndef __APPLICATION_H 00025 #define __APPLICATION_H 00026 00027 #include <stlib/Object.h> 00028 00029 #include <stlib/tools/CmdLineParser.h> 00030 #include <stlib/Stream.h> 00031 #include <stlib/GenericException.h> 00032 00036 namespace Tools { 00037 00038 class Application : public Core::Object 00039 { 00040 public: 00041 Stream *cin; 00042 Stream *cout; 00043 Stream *cerr; 00045 protected: 00046 static Application *_current; 00047 00048 public: 00049 Application(void); 00050 virtual ~Application(void); 00051 00052 /* Class-accessing protocol */ 00053 static Application *current(void); 00054 00055 /* Initialize/release protocol */ 00062 virtual void initialize(void); 00063 00070 virtual void initialize(int argc, char **argv); 00071 00084 virtual void initializeCommandLineParser(CommandLineParser *parser); 00085 00094 virtual void release(void); 00095 00096 /* Error handling protocol */ 00101 virtual void defaultExceptionHandler(GenericException *ex); 00102 00103 /* Processing protocol */ 00104 virtual void run(void); 00105 00109 virtual void startUp(void) abstract; 00113 virtual void shutDown(void) abstract; 00117 virtual void execute(void) abstract; 00118 }; 00119 00120 }; 00121 00122 #endif /* __APPLICATION_H */