modernize-use-equals-default

This commit is contained in:
Daniel Chabrowski 2018-02-25 01:25:15 +01:00
parent e5bbe57f01
commit 1e1ca23101
4 changed files with 39 additions and 44 deletions

View File

@ -31,7 +31,7 @@ public:
const int open_tries = 5;
const int open_interval = 10;
explicit file_helper() {}
explicit file_helper() = default;
file_helper(const file_helper&) = delete;
file_helper& operator=(const file_helper&) = delete;
@ -135,6 +135,7 @@ public:
// finally - return a valid base and extension tuple
return std::make_tuple(fname.substr(0, ext_index), fname.substr(ext_index));
}
private:
FILE* _fd{ nullptr };
filename_t _filename;

View File

@ -27,8 +27,7 @@ namespace details
class flag_formatter
{
public:
virtual ~flag_formatter()
{}
virtual ~flag_formatter() = default;
virtual void format(details::log_msg& msg, const std::tm& tm_time) = 0;
};
@ -118,7 +117,6 @@ class B_formatter:public flag_formatter
}
};
//write 2 ints separated by sep with padding of 2
static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, char sep)
{
@ -133,7 +131,6 @@ static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, int v
return w;
}
//Date and time representation (Thu Aug 23 15:35:46 2014)
class c_formatter SPDLOG_FINAL : public flag_formatter
{
@ -144,7 +141,6 @@ class c_formatter SPDLOG_FINAL:public flag_formatter
}
};
// year - 2 digit
class C_formatter SPDLOG_FINAL : public flag_formatter
{
@ -154,8 +150,6 @@ class C_formatter SPDLOG_FINAL:public flag_formatter
}
};
// Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01
class D_formatter SPDLOG_FINAL : public flag_formatter
{
@ -165,7 +159,6 @@ class D_formatter SPDLOG_FINAL:public flag_formatter
}
};
// year - 4 digit
class Y_formatter SPDLOG_FINAL : public flag_formatter
{
@ -281,7 +274,6 @@ class p_formatter SPDLOG_FINAL:public flag_formatter
}
};
// 12 hour clock 02:55:02 pm
class r_formatter SPDLOG_FINAL : public flag_formatter
{
@ -315,7 +307,7 @@ class z_formatter SPDLOG_FINAL : public flag_formatter
public:
const std::chrono::seconds cache_refresh = std::chrono::seconds(5);
z_formatter() {}
z_formatter() = default;
z_formatter(const z_formatter&) = delete;
z_formatter& operator=(const z_formatter&) = delete;
@ -363,8 +355,6 @@ private:
}
};
// Thread id
class t_formatter SPDLOG_FINAL : public flag_formatter
{
@ -418,8 +408,8 @@ private:
class aggregate_formatter SPDLOG_FINAL : public flag_formatter
{
public:
aggregate_formatter()
{}
aggregate_formatter() = default;
void add_ch(char ch)
{
_str += ch;

View File

@ -194,7 +194,7 @@ public:
}
private:
registry_t<Mutex>() {}
registry_t<Mutex>() = default;
registry_t<Mutex>(const registry_t<Mutex>&) = delete;
registry_t<Mutex>& operator=(const registry_t<Mutex>&) = delete;
@ -203,6 +203,7 @@ private:
if (_loggers.find(logger_name) != _loggers.end())
throw spdlog_ex("logger with name '" + logger_name + "' already exists");
}
Mutex _mutex;
std::unordered_map <std::string, std::shared_ptr<logger>> _loggers;
formatter_ptr _formatter;

View File

@ -21,14 +21,16 @@ template <class Mutex>
class stdout_sink SPDLOG_FINAL : public base_sink<Mutex>
{
using MyType = stdout_sink<Mutex>;
public:
stdout_sink()
{}
explicit stdout_sink() = default;
static std::shared_ptr<MyType> instance()
{
static std::shared_ptr<MyType> instance = std::make_shared<MyType>();
return instance;
}
protected:
void _sink_it(const details::log_msg& msg) override
{
@ -49,8 +51,9 @@ template <class Mutex>
class stderr_sink SPDLOG_FINAL : public base_sink<Mutex>
{
using MyType = stderr_sink<Mutex>;
public:
explicit stderr_sink() {}
explicit stderr_sink() = default;
static std::shared_ptr<MyType> instance()
{