Modernize debugging.

This commit is contained in:
Roman Telezhynskyi 2021-11-23 11:28:54 +02:00
parent 642fbe815d
commit a8d8fa0946
5 changed files with 18 additions and 18 deletions

View File

@ -128,9 +128,9 @@ BAD_READ_ENTITIES, /*!< error in entities read process. */
BAD_READ_OBJECTS /*!< error in objects read process. */
};
enum DBG_LEVEL {
NONE,
DEBUG
enum class DebugLevel {
None,
Debug
};
//! Special codes for colors

View File

@ -59,10 +59,10 @@ DRW_dbg::DRW_dbg() :
prClass(std::make_unique<print_none>())
{}
void DRW_dbg::setLevel(LEVEL lvl){
void DRW_dbg::setLevel(Level lvl){
level = lvl;
switch (level){
case DEBUG:
case Level::Debug:
prClass = std::make_unique<print_debug>();
break;
default:
@ -70,7 +70,7 @@ void DRW_dbg::setLevel(LEVEL lvl){
}
}
DRW_dbg::LEVEL DRW_dbg::getLevel() const{
DRW_dbg::Level DRW_dbg::getLevel() const{
return level;
}

View File

@ -32,12 +32,12 @@ class print_none;
class DRW_dbg {
public:
enum LEVEL {
NONE,
DEBUG
enum class Level {
None,
Debug
};
void setLevel(LEVEL lvl);
LEVEL getLevel() const;
void setLevel(Level lvl);
Level getLevel() const;
static DRW_dbg *getInstance();
void print(const std::string &s);
void print(int i);
@ -56,7 +56,7 @@ private:
DRW_dbg();
~DRW_dbg();
static DRW_dbg *instance;
LEVEL level{NONE};
Level level{Level::None};
std::ios_base::fmtflags flags{std::cerr.flags()};
std::unique_ptr<print_none> prClass;
};

View File

@ -54,7 +54,7 @@ dxfRW::dxfRW(const char* name)
imageDef(),
currHandle()
{
DRW_DBGSL(DRW_dbg::NONE);
DRW_DBGSL(DRW_dbg::Level::None);
}
dxfRW::~dxfRW(){
@ -68,13 +68,13 @@ dxfRW::~dxfRW(){
imageDef.clear();
}
void dxfRW::setDebug(DRW::DBG_LEVEL lvl){
void dxfRW::setDebug(DRW::DebugLevel lvl){
switch (lvl){
case DRW::DEBUG:
DRW_DBGSL(DRW_dbg::DEBUG);
case DRW::DebugLevel::Debug:
DRW_DBGSL(DRW_dbg::Level::Debug);
break;
default:
DRW_DBGSL(DRW_dbg::NONE);
DRW_DBGSL(DRW_dbg::Level::None);
}
}

View File

@ -28,7 +28,7 @@ class dxfRW {
public:
explicit dxfRW(const char* name);
~dxfRW();
static void setDebug(DRW::DBG_LEVEL lvl);
static void setDebug(DRW::DebugLevel lvl);
/// reads the file specified in constructor
/*!
* An interface must be provided. It is used by the class to signal various