csApplicationFramework Class Reference
[Application Framework]
Application framework class.
More...
#include <cstool/csapplicationframework.h>
Inheritance diagram for csApplicationFramework:

Public Member Functions | |
virtual | ~csApplicationFramework () |
Destructor. | |
operator iObjectRegistry * () | |
Allow a csApplicationFramework object to be used as an iObjectRegistry*. | |
bool | Open () |
Open plugins and open application window. | |
int | Main (int argc, char *argv[]) |
Starts up the application framework, to be called from main(). | |
Static Public Member Functions | |
void | Quit () |
Quit running the application. | |
iObjectRegistry * | GetObjectRegistry () |
Returns a pointer to the object registry. | |
void | SetApplicationName (char *name) |
Set the application's string name identifier. | |
const char * | GetApplicationName () |
Get the application name. | |
void | Run () |
Start event queue. | |
bool | ReportError (const char *description,...) |
Display an error notification. | |
void | ReportWarning (const char *description,...) |
Display a warning notification. | |
void | ReportInfo (const char *description,...) |
Display an information notification. | |
Protected Member Functions | |
csApplicationFramework () | |
Constructor. | |
virtual bool | OnInitialize (int argc, char *argv[])=0 |
Initialize the subclassed csApplicationFramework object. | |
virtual bool | Application ()=0 |
Perform application logic. | |
virtual void | OnExit () |
Perform any end of program processing. | |
Static Protected Attributes | |
iObjectRegistry * | object_reg |
Pointer to the application's object registry. |
Detailed Description
Application framework class.
- Remarks:
- This class provides a handy object-oriented wrapper around the Crystal Space initialization and start-up functions. It encapsulates a callback paradigm which provides methods such as OnInitialize() and OnExit() which you can override to customize the framework's behavior. You should also consider using csBaseEventHandler (csutil/csbaseeventh.h), which provides the same sort of object-oriented wrapper for the Crystal Space event mechanism; providing methods such as OnMouseClick(), OnKeyboard(), OnBroadcast(), etc.
- In order to properly use this class, you must derive your own class from it, providing a constructor and implementation for the OnInitialize() and Application() methods. You may only have one csApplicationFramework derived object in existence at any time (and generally, you will only have one such object in your application). In your source code create a global instance of the overridden object, as follows:
//-------------------------- // Example.h class MyApp : public csApplicationFramework { public: MyApp(); virtual bool OnInitialize(int argc, char* argv[]); virtual bool Application(); }; //-------------------------- // Example.cpp // File scope MyApp::MyApp() : csApplicationFramework() { SetApplicationName ("my.example.app"); } bool MyApp::OnInitialize(int argc, char* argv[]) { // Request plugins, initialize any global non-CS data and structures return true; } bool MyApp::Application() { // Perform initialization of CS data and structures, set event handler, // load world, etc. if (!Open()) return false; Run(); return true; } //-------------------------- // main.cpp CS_IMPLEMENT_APPLICATION int main (int argc, char* argv[]) { MyApp myApp; return myApp.Main (argc, argv); }
- csApplicationFramework itself is derived from csInitializer for convenience, allowing overridden members to call csInitializer methods without qualifying them with csInitializer::.
- This class is not related to csApp or any other class from the deprecated CSWS library.
Definition at line 110 of file csapplicationframework.h.
Constructor & Destructor Documentation
|
Constructor.
|
|
Destructor.
|
Member Function Documentation
|
Perform application logic.
|
|
Get the application name.
Definition at line 296 of file csapplicationframework.h. |
|
Returns a pointer to the object registry.
Definition at line 253 of file csapplicationframework.h. |
|
Starts up the application framework, to be called from main().
|
|
Perform any end of program processing.
|
|
Initialize the subclassed csApplicationFramework object.
|
|
Open plugins and open application window.
Definition at line 268 of file csapplicationframework.h. References csInitializer::OpenApplication(). |
|
Allow a csApplicationFramework object to be used as an iObjectRegistry*.
Definition at line 263 of file csapplicationframework.h. |
|
Quit running the application.
|
|
Display an error notification.
Definition at line 335 of file csapplicationframework.h. References CS_REPORTER_SEVERITY_ERROR, and csReportV. |
|
Display an information notification.
Definition at line 368 of file csapplicationframework.h. References CS_REPORTER_SEVERITY_NOTIFY, and csReportV. |
|
Display a warning notification.
Definition at line 352 of file csapplicationframework.h. References CS_REPORTER_SEVERITY_WARNING, and csReportV. |
|
Start event queue.
Definition at line 306 of file csapplicationframework.h. References csDefaultRunLoop(). |
|
Set the application's string name identifier.
Definition at line 285 of file csapplicationframework.h. |
Member Data Documentation
|
Pointer to the application's object registry.
Definition at line 208 of file csapplicationframework.h. |
The documentation for this class was generated from the following file:
- cstool/csapplicationframework.h
Generated for Crystal Space by doxygen 1.3.9.1