Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CUI_ErrorHandler Class Reference

The GUI error handler. More...

#include <CUI_ErrorHandler.h>

List of all members.

Public Types

enum  errorType { UI_WARNING, UI_ERROR, UI_FATAL }
 Types of errors to handle.


Public Member Functions

 CUI_ErrorHandler (char *filename)
virtual ~CUI_ErrorHandler ()
virtual CUI_MessageBoxProcessError (errorType type, char *message)
 Process an error.

virtual bool SetConsole (CUI_Console *con)
 Set the console object to log to.

virtual bool SetMessageBox (CUI_MessageBox *mbox)
 Set the message box object.

virtual bool SetReporting (unsigned short report)
 Set the reporting type flag.


Static Public Attributes

const unsigned short UI_REPORT_NONE = 0x0001
const unsigned short UI_REPORT_FILE = 0x0002
const unsigned short UI_REPORT_CONSOLE = 0x0004
const unsigned short UI_REPORT_MESSAGEBOX = 0x0008

Protected Member Functions

virtual bool OpenFile (char *filename)
 Open a file for logging.

virtual bool WriteToFile (char *text)
 Write to the open file.

virtual bool CloseFile ()
 Close the open file.


Protected Attributes

FILE * m_filep
 file pointer for basic output

bool m_fileOpen
 Is the logging file open?

unsigned short m_report
 Type of error reporting currently enabled.

CUI_Consolem_console
 The console to log to.

CUI_MessageBoxm_messageBox
 The message box to use.


Detailed Description

The GUI error handler.

Used internally by the core UI to report errors, and can also be used by the application to display errors within the GUI.

Can display error messages in a message box, log to the console, and/or log to a text file.

Inherit from this class to change the message formatting (to any destination) or change the way file i/o is handled.


Constructor & Destructor Documentation

CUI_ErrorHandler::CUI_ErrorHandler char *  filename  ) 
 

Should be instantiated by the application and passed to the CUI_UI object.

Recommended order for initializing the ui in an application:
Create the CUI_UI object.
Create the error handler - file logging only.
Tell the CUI_UI to use the error handler.
-Load shaders for the message box & console.
-Create the message box and console.
-Set error handler to enable console and message box
+Load the rest of the GUI.
( - : logging to file | + : logging to file & console, and optionally alerting via message box )

CUI_ErrorHandler::~CUI_ErrorHandler  )  [virtual]
 

Close the file and delete anything else allocated


Member Function Documentation

CUI_MessageBox * CUI_ErrorHandler::ProcessError errorType  type,
char *  message
[virtual]
 

Process an error.

Returns a pointer to the message box so the UI can display it


The documentation for this class was generated from the following files:
Generated on Mon Sep 29 23:07:03 2003 for glGUI by doxygen 1.3.4