From a8d8fa09461519f0c43ada9b928dbe1f7ce9c974 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 23 Nov 2021 11:28:54 +0200 Subject: [PATCH] Modernize debugging. --- src/libs/vdxf/libdxfrw/drw_base.h | 6 +++--- src/libs/vdxf/libdxfrw/intern/drw_dbg.cpp | 6 +++--- src/libs/vdxf/libdxfrw/intern/drw_dbg.h | 12 ++++++------ src/libs/vdxf/libdxfrw/libdxfrw.cpp | 10 +++++----- src/libs/vdxf/libdxfrw/libdxfrw.h | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/libs/vdxf/libdxfrw/drw_base.h b/src/libs/vdxf/libdxfrw/drw_base.h index ae0d2bbfc..ea395e919 100644 --- a/src/libs/vdxf/libdxfrw/drw_base.h +++ b/src/libs/vdxf/libdxfrw/drw_base.h @@ -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 diff --git a/src/libs/vdxf/libdxfrw/intern/drw_dbg.cpp b/src/libs/vdxf/libdxfrw/intern/drw_dbg.cpp index 999e065a3..52cd204a2 100644 --- a/src/libs/vdxf/libdxfrw/intern/drw_dbg.cpp +++ b/src/libs/vdxf/libdxfrw/intern/drw_dbg.cpp @@ -59,10 +59,10 @@ DRW_dbg::DRW_dbg() : prClass(std::make_unique()) {} -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(); 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; } diff --git a/src/libs/vdxf/libdxfrw/intern/drw_dbg.h b/src/libs/vdxf/libdxfrw/intern/drw_dbg.h index 7408f695d..ab752ac09 100644 --- a/src/libs/vdxf/libdxfrw/intern/drw_dbg.h +++ b/src/libs/vdxf/libdxfrw/intern/drw_dbg.h @@ -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 prClass; }; diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.cpp b/src/libs/vdxf/libdxfrw/libdxfrw.cpp index f1a9ec27a..0c1e84c28 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.cpp +++ b/src/libs/vdxf/libdxfrw/libdxfrw.cpp @@ -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); } } diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.h b/src/libs/vdxf/libdxfrw/libdxfrw.h index 35db5cab3..1052dc6b2 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.h +++ b/src/libs/vdxf/libdxfrw/libdxfrw.h @@ -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