|
wavelength 1.0.0
|
Stream for diagnostic text, written to standard output or to a log file. More...
#include <debug.h>


Public Types | |
| enum | ModalType { kModalFail = 0 , kModalNotify = 1 , kModalCancelable = 2 } |
| Kinds of message Modal() shows. More... | |
| typedef void(* | ModalCallback) (int *pState, const char *pszMessage) |
| Routine that shows a message on the screen and waits for the player. | |
Public Member Functions | |
| Debug () | |
| Construct an enabled stream with no log file. | |
| ~Debug () override | |
| Close the log file and release the stream. | |
| void | Print (const char *pszText) override |
| Write diagnostic text, to the log file with each newline as a carriage return and a line feed, or to standard output. | |
| void | OpenLog (const char *pszFile) |
| Write the text to a log file from now on, replacing any log file. | |
| void | CloseLog () |
| Close the log file, if any. | |
| void | SetModalCallback (ModalCallback pfnCallback) |
| Set the routine that shows a message on the screen. | |
| ModalCallback | GetModalCallback () const |
| Debug () | |
| Create the stream with output enabled and no log. | |
| virtual | ~Debug () |
| Close the log. | |
| virtual void | Print (const char *str) |
| Write text to the log, converting each line feed to a carriage return and a line feed, or to the console and the debugger when no log is open. | |
| void | Fail (const char *fmt,...) |
| Report a failure and exit, or throw the message when mThrowOnFail is set. | |
| void | Notify (const char *fmt,...) |
| Show a notice. | |
| void | Modal (int type, const char *message) |
| Show a message through mModalCallback or a message box, and exit when the message remains a failure. | |
| void | StartLog (const char *file) |
| Close any log and open a new one. | |
| void | StopLog () |
| Close the log. | |
| Public Member Functions inherited from PrnStream | |
| PrnStream () | |
| Construct a stream with a dump level of 0. | |
| virtual | ~PrnStream () |
| Release the stream. | |
| void | Printf (const char *pszFormat,...) |
| Format text into the shared format buffer and write the result through Print(). | |
| PrnStream & | operator<< (const char *pszText) |
| Write text. | |
| PrnStream & | operator<< (char ch) |
| Write a character. | |
| PrnStream & | operator<< (short nValue) |
| Write a short integer in decimal. | |
| PrnStream & | operator<< (int nValue) |
| Write an integer in decimal. | |
| PrnStream & | operator<< (unsigned char nValue) |
| Write a byte as an unsigned integer in decimal. | |
| PrnStream & | operator<< (unsigned short nValue) |
| Write an unsigned short integer in decimal. | |
| PrnStream & | operator<< (unsigned int nValue) |
| Write an unsigned integer in decimal. | |
| PrnStream & | operator<< (unsigned long long nValue) |
| Write an unsigned 64-bit number in decimal. | |
| PrnStream & | operator<< (float fValue) |
| Write a number with two decimals. | |
| PrnStream & | operator<< (bool bValue) |
| Write true or false. | |
| void | Space (int nCount) |
| Write a number of spaces, one Print() call each. | |
| int | GetDumpLevel () const |
| PrnStream () | |
| virtual | ~PrnStream () |
| Destroy the stream. | |
| void | Printf (const char *format,...) |
| Format text with printf() conventions and write it. | |
| PrnStream & | operator<< (char c) |
| Write a character. | |
| PrnStream & | operator<< (int i) |
| Write an integer in decimal. | |
| PrnStream & | operator<< (float f) |
| Write a number with two decimal places. | |
| PrnStream & | operator<< (const char *str) |
| Write text. | |
| void | Space (int count) |
| Write spaces. | |
Public Attributes | |
| bool | mFailing |
| bool | mThrowOnFail |
| bool | mEnabled |
| FileStream * | mLog |
| ModalCallbackFunc | mModalCallback |
Stream for diagnostic text, written to standard output or to a log file.
Stream for diagnostic text and failure reports.
The RTTI records the class as deriving from PrnStream, and the vtable is at 0x003d68c8. The object is 0x1c bytes.
The RTTI records the class as deriving from PrnStream. The object is 0x14 bytes. Text goes to the log file when one is open, and otherwise to the console and the debugger.
| typedef void(* Debug::ModalCallback) (int *pState, const char *pszMessage) |
Routine that shows a message on the screen and waits for the player.
The state is the caller's. A state of 2 is cleared when the player presses the button that dismisses the message.
| pState | The caller's state. |
| pszMessage | The message. |
| enum Debug::ModalType |
Kinds of message Modal() shows.
| Enumerator | |
|---|---|
| kModalFail | A failure. The program exits after the message. |
| kModalNotify | A notice the user acknowledges. |
| kModalCancelable | A notice the user may turn into a failure with Cancel. |
| Debug::Debug | ( | ) |
Construct an enabled stream with no log file.
|
override |
Close the log file and release the stream.
| Debug::Debug | ( | ) |
Create the stream with output enabled and no log.
|
virtual |
Close the log.
|
overridevirtual |
Write diagnostic text, to the log file with each newline as a carriage return and a line feed, or to standard output.
A disabled stream writes nothing.
| pszText | The text. |
Implements PrnStream.
| void Debug::OpenLog | ( | const char * | pszFile | ) |
Write the text to a log file from now on, replacing any log file.
A file that cannot be opened reports a notice and leaves no log file.
The name is inferred.
| pszFile | The file. |
| void Debug::CloseLog | ( | ) |
Close the log file, if any.
The name is inferred.
|
inline |
Set the routine that shows a message on the screen.
| pfnCallback | The routine the renderer installs, or null. |
|
inline |
|
virtual |
Write text to the log, converting each line feed to a carriage return and a line feed, or to the console and the debugger when no log is open.
| str | The text. |
Implements PrnStream.
| void Debug::Fail | ( | const char * | fmt, |
| ... ) |
Report a failure and exit, or throw the message when mThrowOnFail is set.
A failure while one is being reported is ignored.
| fmt | The printf format. |
| void Debug::Notify | ( | const char * | fmt, |
| ... ) |
Show a notice.
| fmt | The printf format. |
| void Debug::Modal | ( | int | type, |
| const char * | message ) |
Show a message through mModalCallback or a message box, and exit when the message remains a failure.
| type | The kind of message, one of ModalType. |
| message | The text. |
| void Debug::StartLog | ( | const char * | file | ) |
Close any log and open a new one.
When the file does not open, the stream reports it and continues without a log.
| file | The path of the log. |
| void Debug::StopLog | ( | ) |
Close the log.
| bool Debug::mFailing |
Whether a failure is being reported.
| bool Debug::mThrowOnFail |
Whether Fail() throws the message instead of exiting.
| bool Debug::mEnabled |
Whether Print() writes anything.
| FileStream* Debug::mLog |
The log, or null.
| ModalCallbackFunc Debug::mModalCallback |
The handler of Modal(), or null for message boxes.