CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csapplicationframework.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003 by Odes B. Boatwright.
00003 
00004 This library is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU Library General Public
00006 License as published by the Free Software Foundation; either
00007 version 2 of the License, or (at your option) any later version.
00008 
00009 This library is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012 Library General Public License for more details.
00013 
00014 You should have received a copy of the GNU Library General Public
00015 License along with this library; if not, write to the Free
00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_CSAPPLICATIONFRAMEWORK_H__
00020 #define __CS_CSAPPLICATIONFRAMEWORK_H__
00021 
00030 #include <cstool/initapp.h>
00031 #include <iutil/objreg.h>
00032 #include <ivaria/reporter.h>
00033 
00098 class csApplicationFramework : public csInitializer
00099 {
00100 private:
00104   static iObjectRegistry* mp_object_reg;
00105 
00117   static csApplicationFramework* m_Ptr;
00118 
00125   static const char* m_FoundationStringName;
00126 
00133   static char* m_ApplicationStringName;
00134 
00144 protected:
00145   csApplicationFramework ();
00146 
00150 public:
00151   virtual ~csApplicationFramework ();
00152 
00153 
00154 public:
00168   static bool Initialize (int argc, char* argv[]);
00169 
00179   static bool Start ();
00180 
00189         static void End ();
00190 
00198   static void Quit (void);
00199 
00200 protected:
00215   virtual bool OnInitialize (int argc, char* argv[]) = 0;
00216 
00228   virtual bool Application () = 0;
00229 
00238         virtual void OnExit ();
00239 
00240   // Inline Helper Functions
00241 public:
00245   static iObjectRegistry* GetObjectRegistry () { return mp_object_reg; };
00246 
00255   operator iObjectRegistry* () { return mp_object_reg; }
00256 
00260   bool Open () { return OpenApplication (mp_object_reg); }
00261 
00274   static void SetApplicationName (char *name)
00275   {
00276     m_ApplicationStringName = name;
00277   }
00278 
00284   static void ProcessQueue ()
00285   {
00286     csDefaultRunLoop (mp_object_reg);
00287   }
00288 
00289 private:
00296   static bool DisplayLibError (const char* description)
00297   {
00298     csReport (mp_object_reg, CS_REPORTER_SEVERITY_ERROR,
00299       m_FoundationStringName,
00300       description);
00301     return false;
00302   }
00303 
00304 public:
00311   static bool DisplayError (const char* description)
00312   {
00313     csReport (mp_object_reg, CS_REPORTER_SEVERITY_ERROR,
00314       m_ApplicationStringName,
00315       description);
00316     return false;
00317   }
00318 
00325   static void DisplayInfo (const char* description)
00326   {
00327     csReport (mp_object_reg, CS_REPORTER_SEVERITY_NOTIFY,
00328       m_ApplicationStringName,
00329       description);
00330   }
00331 };
00332 
00335 #endif //__CS_CSAPPLICATIONFRAMEWORK_H__

Generated for Crystal Space by doxygen 1.2.14