Leviathan  0.8.0.0
Leviathan game engine
Leviathan::ComplainOnce Class Reference

#include <ComplainOnce.h>

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

Todo:
Make this thread safe

Definition at line 11 of file ComplainOnce.h.

Member Function Documentation

◆ PrintErrorOnce()

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

Definition at line 25 of file ComplainOnce.cpp.

27 {
28  // Print only once to log //
29  auto end = FiredErrors.end();
30  for(auto iter = FiredErrors.begin(); iter != end; ++iter){
31 
32  if(**iter == error)
33  return false;
34  }
35 
36  // Value wasn't there, print //
37  Logger::Get()->Error(message);
38 
39  FiredErrors.push_back(std::make_shared<std::string>(error));
40  return true;
41 }
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106
DLLEXPORT void Error(const std::string &data) override
Definition: Logger.cpp:177

◆ 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  // Print only once to log //
11  auto end = FiredErrors.end();
12  for(auto iter = FiredErrors.begin(); iter != end; ++iter){
13 
14  if(**iter == warning)
15  return false;
16  }
17 
18  // Value wasn't there, print //
19  Logger::Get()->Warning(message);
20 
21  FiredErrors.push_back(std::make_shared<std::string>(warning));
22  return true;
23 }
DLLEXPORT void Warning(const std::string &data) override
Definition: Logger.cpp:190
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106

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