modernize-use-using

This commit is contained in:
Daniel Chabrowski 2018-02-24 22:35:09 +01:00
parent abc0d43995
commit 7f4c1bb77c
12 changed files with 42 additions and 36 deletions

View File

@ -75,7 +75,7 @@ using log_err_handler = std::function<void(const std::string &err_msg)>;
//Log level enum //Log level enum
namespace level namespace level
{ {
typedef enum enum level_enum
{ {
trace = 0, trace = 0,
debug = 1, debug = 1,
@ -84,7 +84,7 @@ typedef enum
err = 4, err = 4,
critical = 5, critical = 5,
off = 6 off = 6
} level_enum; };
#if !defined(SPDLOG_LEVEL_NAMES) #if !defined(SPDLOG_LEVEL_NAMES)
#define SPDLOG_LEVEL_NAMES { "trace", "debug", "info", "warning", "error", "critical", "off" } #define SPDLOG_LEVEL_NAMES { "trace", "debug", "info", "warning", "error", "critical", "off" }

View File

@ -157,7 +157,7 @@ private:
size_t const max_size_; size_t const max_size_;
static size_t const cacheline_size = 64; static size_t const cacheline_size = 64;
typedef char cacheline_pad_t[cacheline_size]; using cacheline_pad_t = char[cacheline_size];
cacheline_pad_t pad0_; cacheline_pad_t pad0_;
cell_t* const buffer_; cell_t* const buffer_;

View File

@ -216,10 +216,12 @@ private:
std::chrono::milliseconds _flush_interval_ms; std::chrono::milliseconds _flush_interval_ms;
std::function<void()> _worker_teardown_cb = nullptr; std::function<void()> _worker_teardown_cb = nullptr;
}; };
#ifdef SPDLOG_NO_REGISTRY_MUTEX #ifdef SPDLOG_NO_REGISTRY_MUTEX
typedef registry_t<spdlog::details::null_mutex> registry; using registry = registry_t<spdlog::details::null_mutex>;
#else #else
typedef registry_t<std::mutex> registry; using registry = registry_t<std::mutex>;
#endif #endif
} }
} }

View File

@ -116,6 +116,9 @@ public:
{} {}
}; };
using ansicolor_stdout_sink_mt = ansicolor_stdout_sink<std::mutex>;
using ansicolor_stdout_sink_st = ansicolor_stdout_sink<details::null_mutex>;
template<class Mutex> template<class Mutex>
class ansicolor_stderr_sink: public ansicolor_sink<Mutex> class ansicolor_stderr_sink: public ansicolor_sink<Mutex>
{ {
@ -124,11 +127,8 @@ public:
{} {}
}; };
typedef ansicolor_stdout_sink<std::mutex> ansicolor_stdout_sink_mt; using ansicolor_stderr_sink_mt = ansicolor_stderr_sink<std::mutex>;
typedef ansicolor_stdout_sink<details::null_mutex> ansicolor_stdout_sink_st; using ansicolor_stderr_sink_st = ansicolor_stderr_sink<details::null_mutex>;
typedef ansicolor_stderr_sink<std::mutex> ansicolor_stderr_sink_mt;
typedef ansicolor_stderr_sink<details::null_mutex> ansicolor_stderr_sink_st;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog

View File

@ -66,7 +66,8 @@ public:
} }
}; };
typedef dist_sink<std::mutex> dist_sink_mt; using dist_sink_mt = dist_sink<std::mutex>;
typedef dist_sink<details::null_mutex> dist_sink_st; using dist_sink_st = dist_sink<details::null_mutex>;
} }
} }

View File

@ -55,8 +55,8 @@ private:
bool _force_flush; bool _force_flush;
}; };
typedef simple_file_sink<std::mutex> simple_file_sink_mt; using simple_file_sink_mt = simple_file_sink<std::mutex>;
typedef simple_file_sink<details::null_mutex> simple_file_sink_st; using simple_file_sink_st = simple_file_sink<details::null_mutex>;
/* /*
* Rotating file sink based on size * Rotating file sink based on size
@ -149,8 +149,8 @@ private:
details::file_helper _file_helper; details::file_helper _file_helper;
}; };
typedef rotating_file_sink<std::mutex> rotating_file_sink_mt; using rotating_file_sink_mt = rotating_file_sink<std::mutex>;
typedef rotating_file_sink<details::null_mutex>rotating_file_sink_st; using rotating_file_sink_st = rotating_file_sink<details::null_mutex>;
/* /*
* Default generator of daily log file names. * Default generator of daily log file names.
@ -247,7 +247,8 @@ private:
details::file_helper _file_helper; details::file_helper _file_helper;
}; };
typedef daily_file_sink<std::mutex> daily_file_sink_mt; using daily_file_sink_mt = daily_file_sink<std::mutex>;
typedef daily_file_sink<details::null_mutex> daily_file_sink_st; using daily_file_sink_st = daily_file_sink<details::null_mutex>;
} }
} }

View File

@ -42,8 +42,8 @@ protected:
{} {}
}; };
typedef msvc_sink<std::mutex> msvc_sink_mt; using msvc_sink_mt = msvc_sink<std::mutex>;
typedef msvc_sink<details::null_mutex> msvc_sink_st; using msvc_sink_st = msvc_sink<details::null_mutex>;
} }
} }

View File

@ -26,8 +26,9 @@ protected:
{} {}
}; };
typedef null_sink<details::null_mutex> null_sink_st;
typedef null_sink<details::null_mutex> null_sink_mt; using null_sink_mt = null_sink<details::null_mutex>;
using null_sink_st = null_sink<details::null_mutex>;
} }
} }

View File

@ -41,7 +41,8 @@ protected:
bool _force_flush; bool _force_flush;
}; };
typedef ostream_sink<std::mutex> ostream_sink_mt; using ostream_sink_mt = ostream_sink<std::mutex>;
typedef ostream_sink<details::null_mutex> ostream_sink_st; using ostream_sink_st = ostream_sink<details::null_mutex>;
} }
} }

View File

@ -42,9 +42,8 @@ protected:
} }
}; };
typedef stdout_sink<details::null_mutex> stdout_sink_st; using stdout_sink_mt = stdout_sink<std::mutex>;
typedef stdout_sink<std::mutex> stdout_sink_mt; using stdout_sink_st = stdout_sink<details::null_mutex>;
template <class Mutex> template <class Mutex>
class stderr_sink SPDLOG_FINAL : public base_sink<Mutex> class stderr_sink SPDLOG_FINAL : public base_sink<Mutex>
@ -71,7 +70,8 @@ protected:
} }
}; };
typedef stderr_sink<std::mutex> stderr_sink_mt; using stderr_sink_mt = stderr_sink<std::mutex>;
typedef stderr_sink<details::null_mutex> stderr_sink_st; using stderr_sink_st = stderr_sink<details::null_mutex>;
} }
} }

View File

@ -85,7 +85,7 @@ private:
back_color &= static_cast<WORD>(~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY)); back_color &= static_cast<WORD>(~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY));
// keep the background color unchanged // keep the background color unchanged
SetConsoleTextAttribute(out_handle_, attribs | back_color); SetConsoleTextAttribute(out_handle_, attribs | back_color);
return orig_buffer_info.wAttributes; //return orig attribs return orig_buffer_info.wAttributes; //return orig attribs
} }
}; };
@ -100,8 +100,8 @@ public:
{} {}
}; };
typedef wincolor_stdout_sink<std::mutex> wincolor_stdout_sink_mt; using wincolor_stdout_sink_mt = wincolor_stdout_sink<std::mutex>;
typedef wincolor_stdout_sink<details::null_mutex> wincolor_stdout_sink_st; using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>;
// //
// windows color console to stderr // windows color console to stderr
@ -114,8 +114,8 @@ public:
{} {}
}; };
typedef wincolor_stderr_sink<std::mutex> wincolor_stderr_sink_mt; using wincolor_stderr_sink_mt = wincolor_stderr_sink<std::mutex>;
typedef wincolor_stderr_sink<details::null_mutex> wincolor_stderr_sink_st; using wincolor_stderr_sink_st = wincolor_stderr_sink<details::null_mutex>;
} }
} }

View File

@ -20,8 +20,8 @@ namespace sinks
template<class Mutex> template<class Mutex>
using windebug_sink = msvc_sink<Mutex>; using windebug_sink = msvc_sink<Mutex>;
typedef msvc_sink_mt windebug_sink_mt; using windebug_sink_mt = msvc_sink_mt;
typedef msvc_sink_st windebug_sink_st; using windebug_sink_st = msvc_sink_st;
} }
} }