Leviathan  0.8.0.0
Leviathan game engine
Leviathan::ComplainOnce Class Reference

Prints a warning or an error once. More...

#include <ComplainOnce.h>

Public Member Functions

 ComplainOnce ()=delete
 

Static Public Member Functions

static DLLEXPORT bool PrintWarningOnce (const std::string &warning, const std::string &message)
 
static DLLEXPORT bool PrintErrorOnce (const std::string &error, const std::string &message)
 

Detailed Description

Prints a warning or an error once.

Definition at line 12 of file ComplainOnce.h.

Constructor & Destructor Documentation

◆ ComplainOnce()

Leviathan::ComplainOnce::ComplainOnce ( )
delete

Member Function Documentation

◆ PrintErrorOnce()

DLLEXPORT bool Leviathan::ComplainOnce::PrintErrorOnce ( const std::string &  error,
const std::string &  message 
)
static

Definition at line 23 of file ComplainOnce.cpp.

25 {
26  Lock lock(ErrorsMutex);
27 
28  // Print only once to log //
29  if(FiredErrors.find(error) != FiredErrors.end())
30  return false;
31 
32  // Value wasn't there, print //
33  Logger::Get()->Error(message);
34 
35  FiredErrors.insert(error);
36  return true;
37 }
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106
DLLEXPORT void Error(const std::string &data) override
Definition: Logger.cpp:177
std::unique_lock< std::mutex > Lock
Definition: ThreadSafe.h:16

◆ PrintWarningOnce()

DLLEXPORT bool Leviathan::ComplainOnce::PrintWarningOnce ( const std::string &  warning,
const std::string &  message 
)
static

Definition at line 7 of file ComplainOnce.cpp.

9 {
10  Lock lock(ErrorsMutex);
11 
12  // Print only once to log //
13  if(FiredErrors.find(warning) != FiredErrors.end())
14  return false;
15 
16  // Value wasn't there, print //
17  Logger::Get()->Warning(message);
18 
19  FiredErrors.insert(warning);
20  return true;
21 }
DLLEXPORT void Warning(const std::string &data) override
Definition: Logger.cpp:190
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106
std::unique_lock< std::mutex > Lock
Definition: ThreadSafe.h:16

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