KiCad PCB EDA Suite
CONSOLE_LOG Class Reference

#include <drc_proto.h>

Public Types

enum  COLOR { RED = 0, GREEN, DEFAULT }
 

Public Member Functions

 CONSOLE_LOG ()
 
void PrintProgress (const wxString &aMessage)
 
void Print (const wxString &aMessage)
 
void SetColor (COLOR color)
 

Private Member Functions

void eraseLastLine ()
 

Private Attributes

bool m_lastLineIsProgressBar = false
 
std::mutex m_lock
 

Detailed Description

Definition at line 37 of file drc_proto.h.

Member Enumeration Documentation

◆ COLOR

Enumerator
RED 
GREEN 
DEFAULT 

Definition at line 40 of file drc_proto.h.

40  {
41  RED = 0,
42  GREEN,
43  DEFAULT
44  };

Constructor & Destructor Documentation

◆ CONSOLE_LOG()

CONSOLE_LOG::CONSOLE_LOG ( )
inline

Definition at line 46 of file drc_proto.h.

46 {};

Member Function Documentation

◆ eraseLastLine()

void CONSOLE_LOG::eraseLastLine ( )
inlineprivate

Definition at line 87 of file drc_proto.h.

88  {
89  printf("\r\033[K");
90  fflush(stdout);
91  }

Referenced by Print(), and PrintProgress().

◆ Print()

void CONSOLE_LOG::Print ( const wxString &  aMessage)
inline

Definition at line 60 of file drc_proto.h.

61  {
63  eraseLastLine();
64 
65  printf("%s", (const char *) aMessage.c_str() );
66  fflush(stdout);
67 
69  }
void eraseLastLine()
Definition: drc_proto.h:87
bool m_lastLineIsProgressBar
Definition: drc_proto.h:93

References eraseLastLine(), and m_lastLineIsProgressBar.

Referenced by CONSOLE_MSG_REPORTER::Report(), and runDRCProto().

◆ PrintProgress()

void CONSOLE_LOG::PrintProgress ( const wxString &  aMessage)
inline

Definition at line 48 of file drc_proto.h.

49  {
51  eraseLastLine();
52 
53  printf("%s", (const char *) aMessage.c_str() );
54  fflush(stdout);
55 
57  }
void eraseLastLine()
Definition: drc_proto.h:87
bool m_lastLineIsProgressBar
Definition: drc_proto.h:93

References eraseLastLine(), and m_lastLineIsProgressBar.

Referenced by CONSOLE_PROGRESS_REPORTER::updateUI().

◆ SetColor()

void CONSOLE_LOG::SetColor ( COLOR  color)
inline

Definition at line 72 of file drc_proto.h.

73  {
74  std::map<COLOR, wxString> colorMap =
75  {
76  { RED, "\033[0;31m" },
77  { GREEN, "\033[0;32m" },
78  { DEFAULT, "\033[0;37m" }
79  };
80 
81  printf( "%s", (const char*) colorMap[ color ].c_str() );
82  fflush(stdout);
83  }
int color
Definition: DXF_plotter.cpp:57

References color, DEFAULT, GREEN, and RED.

Referenced by CONSOLE_MSG_REPORTER::Report(), and CONSOLE_PROGRESS_REPORTER::updateUI().

Member Data Documentation

◆ m_lastLineIsProgressBar

bool CONSOLE_LOG::m_lastLineIsProgressBar = false
private

Definition at line 93 of file drc_proto.h.

Referenced by Print(), and PrintProgress().

◆ m_lock

std::mutex CONSOLE_LOG::m_lock
private

Definition at line 94 of file drc_proto.h.


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