KiCad PCB EDA Suite
CONSOLE_LOG Class Reference

#include <drc_proto.h>

Public Types

enum  COLOR {
  RED = 0 , GREEN , DEFAULT , RED = 0 ,
  GREEN , DEFAULT
}
 
enum  COLOR {
  RED = 0 , GREEN , DEFAULT , RED = 0 ,
  GREEN , DEFAULT
}
 

Public Member Functions

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

Private Member Functions

void eraseLastLine ()
 
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 [1/2]

Enumerator
RED 
GREEN 
DEFAULT 
RED 
GREEN 
DEFAULT 

Definition at line 40 of file drc_proto.h.

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

◆ COLOR [2/2]

Enumerator
RED 
GREEN 
DEFAULT 
RED 
GREEN 
DEFAULT 

Definition at line 38 of file console_log.h.

38 {
39 RED = 0,
40 GREEN,
42 };

Constructor & Destructor Documentation

◆ CONSOLE_LOG() [1/2]

CONSOLE_LOG::CONSOLE_LOG ( )
inline

Definition at line 46 of file drc_proto.h.

46{};

◆ CONSOLE_LOG() [2/2]

CONSOLE_LOG::CONSOLE_LOG ( )
inline

Definition at line 44 of file console_log.h.

44{};

Member Function Documentation

◆ eraseLastLine() [1/2]

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().

◆ eraseLastLine() [2/2]

void CONSOLE_LOG::eraseLastLine ( )
inlineprivate

Definition at line 85 of file console_log.h.

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

◆ Print() [1/2]

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

Definition at line 60 of file drc_proto.h.

61 {
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().

◆ Print() [2/2]

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

Definition at line 58 of file console_log.h.

59 {
62
63 printf("%s", (const char *) aMessage.c_str() );
64 fflush(stdout);
65
67 }

References eraseLastLine(), and m_lastLineIsProgressBar.

◆ PrintProgress() [1/2]

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

Definition at line 48 of file drc_proto.h.

49 {
52
53 printf("%s", (const char *) aMessage.c_str() );
54 fflush(stdout);
55
57 }

References eraseLastLine(), and m_lastLineIsProgressBar.

Referenced by CONSOLE_PROGRESS_REPORTER::updateUI().

◆ PrintProgress() [2/2]

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

Definition at line 46 of file console_log.h.

47 {
50
51 printf("%s", (const char *) aMessage.c_str() );
52 fflush(stdout);
53
55 }

References eraseLastLine(), and m_lastLineIsProgressBar.

◆ SetColor() [1/2]

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().

◆ SetColor() [2/2]

void CONSOLE_LOG::SetColor ( COLOR  color)
inline

Definition at line 70 of file console_log.h.

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

References color, DEFAULT, GREEN, and RED.

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 files: