#pragma once #include #include "JDefines.h" #include "HexFormatter.h" namespace Incart::Common { #define JT() JTerminal(MYDEBUG) #define JCL_NORM '0'//"\x1b[0m" // по умолчанию #define JCL_WHITE '7'//"\x1b[37m" // белый #define JCL_RED '1'//"\x1b[31m" // красный #define JCL_GREEN '2'//"\x1b[32m" // зеленый #define JCL_YELLOW '3'//"\x1b[33m" // желтый #define JCL_PURPLE '5'//"\x1b[35m" // пурпурный #define JCL_AZURE '6'//"\x1b[36m" // голубой #define JCL_BLUE '4'//"\x1b[34m" // синий class JTerminal { protected: QDebug DB; const bool MODE; public: JTerminal(bool mode = true) : DB(QDebug(QtInfoMsg)), MODE(mode) { if(MODE) { DB << JCL_NORM; } } JTerminal(char color, bool mode = true) : DB(QDebug(QtInfoMsg)), MODE(mode) { DB << color; } ~JTerminal() {} //{ if(MODE) { DB << JCL_NORM; } } template JTerminal& operator<<(const T& z) { if(MODE) { DB << z; } return *this; } JTerminal& operator<<(const std::string& z) { if(MODE) { DB << QString::fromStdString(z); } return *this; } protected: }; } // namespace Incart::Common