logog
logger optimized for games
Formatter Class Referenceabstract

#include <formatter.hpp>

+ Inheritance diagram for Formatter:

Public Member Functions

 Formatter ()
 
virtual LOGOG_STRINGFormat (const Topic &topic, const Target &target)=0
 
virtual void RenderTimeOfDay ()
 
virtual TOPIC_FLAGS GetTopicFlags (const Topic &topic)
 
bool GetShowTimeOfDay () const
 
void SetShowTimeOfDay (bool val)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
void * operator new (size_t nSize)
 
void * operator new[] (size_t nSize)
 
void operator delete (void *ptr)
 
void operator delete[] (void *ptr)
 

Protected Member Functions

const LOGOG_CHARErrorDescription (const LOGOG_LEVEL_TYPE level)
 

Protected Attributes

LOGOG_STRING m_sMessageBuffer
 
LOGOG_STRING m_sIntBuffer
 
bool m_bShowTimeOfDay
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void * Allocate (size_t nSize)
 
static void Deallocate (void *ptr)
 

Detailed Description

Converts a topic into a human-readable string for printing or otherwise rendering to a target.

Constructor & Destructor Documentation

Formatter ( )

Member Function Documentation

const LOGOG_CHAR* ErrorDescription ( const LOGOG_LEVEL_TYPE  level)
protected
virtual LOGOG_STRING& Format ( const Topic topic,
const Target target 
)
pure virtual

Causes this formatter to format a topic into its own m_sMessageBuffer field, and thence to return a reference to that string. This function must be written to be efficient; it will be called for every logging operation. It is strongly recommended not to allocate or free memory in this function.

Implemented in FormatterMSVC, and FormatterGCC.

bool GetShowTimeOfDay ( ) const

Should this formatter render the current time of day?

virtual TOPIC_FLAGS GetTopicFlags ( const Topic topic)
virtual

In the base case, this function calls GetTopicFlags() on the provided topic in order to figure out which fields this formatter should render. However, subclasses of the Formatter class can override this function in order to change the default fields that the topic wants to be rendered. For example, you can turn off the TOPIC_LINE_NUMBER_FLAG and the TOPIC_FILE_NAME_FLAG in order to disable these fields from being rendered in your own Formatter subclass.

Parameters
topicThe topic whose flags are to be determined
Returns
The set of flags representing the topics that really need to be rendered.
virtual void RenderTimeOfDay ( )
virtual

Causes the time of day to be rendered, if it needs to be rendered. This function is only supported on ANSI builds, not Unicode, as the underlying functions are ANSI only.

void SetShowTimeOfDay ( bool  val)

Sets whether this formatter renders the current time of day. Time of day is not rendered by default. This function is only supported on ANSI builds, not Unicode, as the underlying functions are ANSI only.

Member Data Documentation

bool m_bShowTimeOfDay
protected
LOGOG_STRING m_sIntBuffer
protected
LOGOG_STRING m_sMessageBuffer
protected

The documentation for this class was generated from the following file: