Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::Console Struct Reference

#include <Console.h>

+ Inheritance diagram for Divide::Console:

Classes

struct  ConsolePrintCallbackEntry
 
struct  OutputEntry
 

Public Types

enum class  EntryType : U8 {
  INFO = 0 , WARNING , ERR , COMMAND ,
  COUNT
}
 
enum class  Flags : U8 {
  DECORATE_TIMESTAMP = toBit( 1 ) , DECORATE_THREAD_ID = toBit( 2 ) , DECORATE_SEVERITY = toBit( 3 ) , DECORATE_FRAME = toBit( 4 ) ,
  ENABLE_OUTPUT = toBit( 5 ) , ENABLE_ERROR_STREAM = toBit( 6 ) , PRINT_IMMEDIATE = toBit( 7 ) , COUNT = 7
}
 
using ConsolePrintCallback = std::function< void(const OutputEntry &)>
 

Public Member Functions

template<typename... Args>
NO_INLINE void d_printfn (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_printf (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_warnfn (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_warnf (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_errorfn (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_errorf (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void printfn (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void printf (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void warnfn (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void warnf (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void errorfn (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void errorf (const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void printfn (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void printf (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void warnfn (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void warnf (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void errorfn (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void errorf (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_printfn (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_printf (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_warnfn (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_warnf (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_errorfn (std::ofstream &outStream, const char *format, Args &&... args)
 
template<typename... Args>
NO_INLINE void d_errorf (std::ofstream &outStream, const char *format, Args &&... args)
 
- Public Member Functions inherited from Divide::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 

Static Public Member Functions

template<typename... T>
static NO_INLINE void printfn (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void printf (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void warnfn (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void warnf (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void errorfn (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void errorf (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_printfn (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_printf (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_warnfn (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_warnf (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_errorfn (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_errorf (const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void printfn (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void printf (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void warnfn (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void warnf (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void errorfn (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void errorf (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_printfn (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_printf (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_warnfn (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_warnf (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_errorfn (std::ofstream &outStream, const char *format, T &&... args)
 
template<typename... T>
static NO_INLINE void d_errorf (std::ofstream &outStream, const char *format, T &&... args)
 
static void Flush ()
 
static void Start (std::string_view logFilePath, std::string_view erroFilePath, bool printCopyright) noexcept
 
static void Stop ()
 
static void ToggleFlag (const Flags flag, const bool state)
 
static bool IsFlagSet (const Flags flag)
 
static size_t BindConsoleOutput (const ConsolePrintCallback &guiConsoleCallback)
 
static bool UnbindConsoleOutput (size_t &index)
 

Static Protected Member Functions

static void Output (std::string_view text, bool newline, EntryType type)
 
static void Output (std::ostream &outStream, std::string_view text, bool newline, EntryType type)
 
static void DecorateAndPrint (std::ostream &outStream, std::string_view text, bool newline, EntryType type)
 
static void PrintToFile (const OutputEntry &entry)
 

Static Private Attributes

static std::ofstream s_logStream
 
static std::ofstream s_errorStream
 
static SharedMutex s_callbackLock
 
static vector< ConsolePrintCallbackEntrys_guiConsoleCallbacks
 
static U32 s_flags = DEFAULT_FLAGS
 
static std::atomic_bool s_running = false
 

Additional Inherited Members

- Protected Member Functions inherited from Divide::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Detailed Description

Definition at line 43 of file Console.h.

Member Typedef Documentation

◆ ConsolePrintCallback

using Divide::Console::ConsolePrintCallback = std::function<void( const OutputEntry& )>

Definition at line 124 of file Console.h.

Member Enumeration Documentation

◆ EntryType

enum class Divide::Console::EntryType : U8
strong
Enumerator
INFO 
WARNING 
ERR 
COMMAND 
COUNT 

Definition at line 97 of file Console.h.

◆ Flags

enum class Divide::Console::Flags : U8
strong
Enumerator
DECORATE_TIMESTAMP 
DECORATE_THREAD_ID 
DECORATE_SEVERITY 
DECORATE_FRAME 
ENABLE_OUTPUT 
ENABLE_ERROR_STREAM 
PRINT_IMMEDIATE 
COUNT 

Definition at line 106 of file Console.h.

Member Function Documentation

◆ BindConsoleOutput()

size_t Divide::Console::BindConsoleOutput ( const ConsolePrintCallback guiConsoleCallback)
static

Definition at line 194 of file Console.cpp.

◆ d_errorf() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_errorf ( const char *  format,
Args &&...  args 
)

Definition at line 110 of file Console.inl.

◆ d_errorf() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_errorf ( const char *  format,
T &&...  args 
)
static

◆ d_errorf() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_errorf ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 260 of file Console.inl.

◆ d_errorf() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_errorf ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ d_errorfn() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_errorfn ( const char *  format,
Args &&...  args 
)

Definition at line 97 of file Console.inl.

◆ d_errorfn() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_errorfn ( const char *  format,
T &&...  args 
)
static

◆ d_errorfn() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_errorfn ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 247 of file Console.inl.

◆ d_errorfn() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_errorfn ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ d_printf() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_printf ( const char *  format,
Args &&...  args 
)

Definition at line 58 of file Console.inl.

◆ d_printf() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_printf ( const char *  format,
T &&...  args 
)
static

◆ d_printf() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_printf ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 208 of file Console.inl.

◆ d_printf() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_printf ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ d_printfn() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_printfn ( const char *  format,
Args &&...  args 
)

Definition at line 45 of file Console.inl.

◆ d_printfn() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_printfn ( const char *  format,
T &&...  args 
)
static

◆ d_printfn() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_printfn ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 195 of file Console.inl.

◆ d_printfn() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_printfn ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ d_warnf() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_warnf ( const char *  format,
Args &&...  args 
)

Definition at line 84 of file Console.inl.

◆ d_warnf() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_warnf ( const char *  format,
T &&...  args 
)
static

◆ d_warnf() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_warnf ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 234 of file Console.inl.

◆ d_warnf() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_warnf ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ d_warnfn() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_warnfn ( const char *  format,
Args &&...  args 
)

Definition at line 71 of file Console.inl.

◆ d_warnfn() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_warnfn ( const char *  format,
T &&...  args 
)
static

◆ d_warnfn() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::d_warnfn ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 221 of file Console.inl.

◆ d_warnfn() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::d_warnfn ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ DecorateAndPrint()

void Divide::Console::DecorateAndPrint ( std::ostream &  outStream,
std::string_view  text,
bool  newline,
EntryType  type 
)
staticprotected

Definition at line 41 of file Console.cpp.

◆ errorf() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::errorf ( const char *  format,
Args &&...  args 
)

Definition at line 153 of file Console.inl.

◆ errorf() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::errorf ( const char *  format,
T &&...  args 
)
static

◆ errorf() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::errorf ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 189 of file Console.inl.

◆ errorf() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::errorf ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ errorfn() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::errorfn ( const char *  format,
Args &&...  args 
)

Definition at line 147 of file Console.inl.

◆ errorfn() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::errorfn ( const char *  format,
T &&...  args 
)
static

◆ errorfn() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::errorfn ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 183 of file Console.inl.

◆ errorfn() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::errorfn ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ Flush()

void Divide::Console::Flush ( )
static

Definition at line 126 of file Console.cpp.

◆ IsFlagSet()

static bool Divide::Console::IsFlagSet ( const Flags  flag)
inlinestatic

Definition at line 140 of file Console.h.

◆ Output() [1/2]

void Divide::Console::Output ( std::ostream &  outStream,
std::string_view  text,
bool  newline,
EntryType  type 
)
staticprotected

Definition at line 73 of file Console.cpp.

◆ Output() [2/2]

void Divide::Console::Output ( std::string_view  text,
bool  newline,
EntryType  type 
)
staticprotected

Definition at line 81 of file Console.cpp.

◆ printf() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::printf ( const char *  format,
Args &&...  args 
)

Definition at line 129 of file Console.inl.

◆ printf() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::printf ( const char *  format,
T &&...  args 
)
static

◆ printf() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::printf ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 165 of file Console.inl.

◆ printf() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::printf ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ printfn() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::printfn ( const char *  format,
Args &&...  args 
)

Definition at line 123 of file Console.inl.

◆ printfn() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::printfn ( const char *  format,
T &&...  args 
)
static

◆ printfn() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::printfn ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 159 of file Console.inl.

◆ printfn() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::printfn ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ PrintToFile()

void Divide::Console::PrintToFile ( const OutputEntry entry)
staticprotected

Definition at line 106 of file Console.cpp.

◆ Start()

void Divide::Console::Start ( std::string_view  logFilePath,
std::string_view  erroFilePath,
bool  printCopyright 
)
staticnoexcept

Do not remove the following license without express permission granted by Divide-Studio or Ionut Cava

Definition at line 144 of file Console.cpp.

◆ Stop()

void Divide::Console::Stop ( )
static

Definition at line 179 of file Console.cpp.

◆ ToggleFlag()

static void Divide::Console::ToggleFlag ( const Flags  flag,
const bool  state 
)
inlinestatic

Definition at line 135 of file Console.h.

◆ UnbindConsoleOutput()

bool Divide::Console::UnbindConsoleOutput ( size_t &  index)
static

Definition at line 206 of file Console.cpp.

◆ warnf() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::warnf ( const char *  format,
Args &&...  args 
)

Definition at line 141 of file Console.inl.

◆ warnf() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::warnf ( const char *  format,
T &&...  args 
)
static

◆ warnf() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::warnf ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 177 of file Console.inl.

◆ warnf() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::warnf ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

◆ warnfn() [1/4]

template<typename... Args>
NO_INLINE void Divide::Console::warnfn ( const char *  format,
Args &&...  args 
)

Definition at line 135 of file Console.inl.

◆ warnfn() [2/4]

template<typename... T>
static NO_INLINE void Divide::Console::warnfn ( const char *  format,
T &&...  args 
)
static

◆ warnfn() [3/4]

template<typename... Args>
NO_INLINE void Divide::Console::warnfn ( std::ofstream &  outStream,
const char *  format,
Args &&...  args 
)

Definition at line 171 of file Console.inl.

◆ warnfn() [4/4]

template<typename... T>
static NO_INLINE void Divide::Console::warnfn ( std::ofstream &  outStream,
const char *  format,
T &&...  args 
)
static

Member Data Documentation

◆ s_callbackLock

SharedMutex Divide::Console::s_callbackLock
staticprivate

Definition at line 154 of file Console.h.

◆ s_errorStream

std::ofstream Divide::Console::s_errorStream
staticprivate

Definition at line 153 of file Console.h.

◆ s_flags

U32 Divide::Console::s_flags = DEFAULT_FLAGS
staticprivate

Definition at line 156 of file Console.h.

◆ s_guiConsoleCallbacks

NO_DESTROY vector< Console::ConsolePrintCallbackEntry > Divide::Console::s_guiConsoleCallbacks
staticprivate

Definition at line 155 of file Console.h.

◆ s_logStream

std::ofstream Divide::Console::s_logStream
staticprivate

Definition at line 152 of file Console.h.

◆ s_running

std::atomic_bool Divide::Console::s_running = false
staticprivate

Definition at line 157 of file Console.h.


The documentation for this struct was generated from the following files: