![]() |
Murl Engine API
Version 2018.3
|
The console printing class. More...
#include <murl_system_console.h>
The console printing class.
The console prints to std::printf or ANDROID_LOG_INFO.
The console class has serveral static methods to print without a class context e.g. System::Console::Print().
An instance of the console class can print three levels:
Printing a message supports:
The output string is: [global prefix]" "[indent string][level prefix]" "[message].
Public Types | |
enum | Level { QUIET, ERROR, WARNING, INFO } |
Definition of the print levels. More... | |
Public Member Functions | |
Console () | |
The default constructor. | |
Console (const String &globalPrefix) | |
Constructor taking a global prefix string. More... | |
Bool | SetLevel (Level level) |
Set the current print level. More... | |
Level | GetLevel () const |
Get the current print level. More... | |
void | SetIndentWidth (UInt32 indentWidth) |
Set the number of indent characters per section. More... | |
UInt32 | GetIndentWidth () const |
Get the number of indent characters per section. More... | |
void | SetIndentChar (Char indentChar) |
Set the indent character. More... | |
Char | GetIndentChar () const |
Get the indent character. More... | |
void | SetGlobalPrefix (const String &prefix) |
Set the global prefix string. More... | |
const String & | GetGlobalPrefix () const |
Get the global prefix string. More... | |
void | SetInfoPrefix (const String &prefix) |
Set the info prefix string. More... | |
const String & | GetInfoPrefix () const |
Get the info prefix string. More... | |
void | SetWarningPrefix (const String &prefix) |
Set the warning prefix string. More... | |
const String & | GetWarningPrefix () const |
Get the warning prefix string. More... | |
void | SetErrorPrefix (const String &prefix) |
Set the error prefix string. More... | |
const String & | GetErrorPrefix () const |
Get the error prefix string. More... | |
UInt32 | GetCurrentSection () const |
Get the current section. More... | |
const String & | GetCurrentIndentString () const |
Get the current indent string. More... | |
Bool | BeginSection (const Char *format,...) |
Begin a section and print formatted variadic arguments. More... | |
Bool | BeginSection (const String &message) |
Begin a section and print a string. More... | |
Bool | BeginSection () |
Begin a section. More... | |
Bool | EndSection (const Char *format,...) |
End a section and print formatted variadic arguments. More... | |
Bool | EndSection (const String &message) |
End a section and print a string. More... | |
Bool | EndSection () |
End a section. More... | |
Bool | PrintInfo (const Char *format,...) const |
Print formatted variadic arguments at info level. More... | |
Bool | PrintInfo (const String &message) const |
Print a string at info level. More... | |
Bool | PrintWarning (const Char *format,...) const |
Print formatted variadic arguments at warning level. More... | |
Bool | PrintWarning (const String &message) const |
Print a string at warning level. More... | |
Bool | PrintError (const Char *format,...) const |
Print formatted variadic arguments at error level. More... | |
Bool | PrintError (const String &message) const |
Print a string at error level. More... | |
Static Public Member Functions | |
static Bool | Print (const Char *format,...) |
Print formatted variadic arguments. More... | |
static Bool | Print (const String &message) |
Print a string. More... | |
static Bool | PrintEndline (const String &message) |
Print a string including an end-of-line character at the end of the string. More... | |
static Bool | PrintHex (const ConstData &data, UInt32 bytesPerLine=16) |
Print the hex dump of a data object. More... | |
Protected Member Functions | |
void | PrintMessage (const String &prefix, const String &message) const |
Print a string with level prefix. More... | |
Protected Attributes | |
Level | mLevel |
The current level. More... | |
Char | mIndentChar |
The indentation character. More... | |
UInt32 | mIndentWidth |
The indentation width. More... | |
UInt32 | mSection |
The section counter. More... | |
String | mIndentString |
The indentation string cache. More... | |
String | mGlobalPrefix |
The global prefix string. More... | |
String | mInfoPrefix |
The info prefix string. More... | |
String | mWarningPrefix |
The warning prefix string. More... | |
String | mErrorPrefix |
The error prefix string. More... | |
Definition of the print levels.
Use GetLevel() to get the current level.
Enumerator | |
---|---|
QUIET | Do not print. |
ERROR | Print errors only. |
WARNING | Print errors and warnings. |
INFO | Print errors, warnings and infos. |
Murl::System::Console::Console | ( | const String & | globalPrefix | ) |
Constructor taking a global prefix string.
globalPrefix | The global prefix string. |
Print formatted variadic arguments.
format | The format string. |
... | The variadic arguments. |
Print a string.
message | The message string to print. |
Print a string including an end-of-line character at the end of the string.
message | The message string to print. |
|
static |
Print the hex dump of a data object.
data | The data object to print. |
bytesPerLine | The the number of source bytes per line. |
Set the current print level.
level | The current print level. |
Level Murl::System::Console::GetLevel | ( | ) | const |
Get the current print level.
void Murl::System::Console::SetIndentWidth | ( | UInt32 | indentWidth | ) |
Set the number of indent characters per section.
The default number of indent characters is 2. The indent string contains the indent character (GetIndentWidth() * GetCurrentSection()) times. The indent string is printed for each message.
indentWidth | The number of indent characters per section, a width of zero disables indentation. |
UInt32 Murl::System::Console::GetIndentWidth | ( | ) | const |
Get the number of indent characters per section.
void Murl::System::Console::SetIndentChar | ( | Char | indentChar | ) |
Set the indent character.
The default indent character is a space. The indent string contains the indent character (GetIndentWidth() * GetCurrentSection()) times. The indent string is printed for each message.
indentChar | The indent character. |
Char Murl::System::Console::GetIndentChar | ( | ) | const |
Get the indent character.
void Murl::System::Console::SetGlobalPrefix | ( | const String & | prefix | ) |
Set the global prefix string.
The global prefix string is printed for each message including a trailing space character.
prefix | The global prefix string. |
const String& Murl::System::Console::GetGlobalPrefix | ( | ) | const |
Get the global prefix string.
void Murl::System::Console::SetInfoPrefix | ( | const String & | prefix | ) |
Set the info prefix string.
The info prefix string is printed for info messages including a trailing space character.
prefix | The info prefix string. |
const String& Murl::System::Console::GetInfoPrefix | ( | ) | const |
Get the info prefix string.
void Murl::System::Console::SetWarningPrefix | ( | const String & | prefix | ) |
Set the warning prefix string.
The warning prefix string is printed for warning messages including a trailing space character.
prefix | The warning prefix string. |
const String& Murl::System::Console::GetWarningPrefix | ( | ) | const |
Get the warning prefix string.
void Murl::System::Console::SetErrorPrefix | ( | const String & | prefix | ) |
Set the error prefix string.
The error prefix string is printed for error messages including a trailing space character.
prefix | The error prefix string. |
const String& Murl::System::Console::GetErrorPrefix | ( | ) | const |
Get the error prefix string.
UInt32 Murl::System::Console::GetCurrentSection | ( | ) | const |
Get the current section.
The currend section is incremented by BeginInfo() and decremented by EndInfo(). The current section is used for indentation only, see SetIndentChar() and SetIndentWidth().
const String& Murl::System::Console::GetCurrentIndentString | ( | ) | const |
Get the current indent string.
The indent string contains the indent character (GetIndentWidth() * GetCurrentSection()) times. The indent string is printed for each message.
Begin a section and print formatted variadic arguments.
The message is printed before incrementing the current section.
format | The format string. |
... | The variadic arguments. |
Begin a section and print a string.
The message is printed before incrementing the current section.
message | The message string to print. |
Bool Murl::System::Console::BeginSection | ( | ) |
Begin a section.
Increments the current section.
End a section and print formatted variadic arguments.
The message is printed after decrementing the current section.
format | The format string. |
... | The variadic arguments. |
End a section and print a string.
The message is printed after decrementing the current section.
message | The message string to print. |
Bool Murl::System::Console::EndSection | ( | ) |
End a section.
Decrements the current section.
Print formatted variadic arguments at info level.
format | The format string. |
... | The variadic arguments. |
Print a string at info level.
message | The message string to print. |
Print formatted variadic arguments at warning level.
format | The format string. |
... | The variadic arguments. |
Print a string at warning level.
message | The message string to print. |
Print formatted variadic arguments at error level.
format | The format string. |
... | The variadic arguments. |
Print a string at error level.
message | The message string to print. |
|
protected |
Print a string with level prefix.
prefix | The level prefix string. |
message | The message string to print. |
|
protected |
The current level.
|
protected |
The indentation character.
|
protected |
The indentation width.
|
protected |
The section counter.
|
protected |
The indentation string cache.
|
protected |
The global prefix string.
|
protected |
The info prefix string.
|
protected |
The warning prefix string.
|
protected |
The error prefix string.