From 5f78556078d2e61d5c0ef44e36d58f3864cd84d1 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Wed, 12 Apr 2023 11:14:08 +0200 Subject: Refactor basic_flags_t to ledger::flags::basic_t --- src/flags.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/flags.h') diff --git a/src/flags.h b/src/flags.h index cd01fc29..4d7e653c 100644 --- a/src/flags.h +++ b/src/flags.h @@ -41,7 +41,7 @@ */ #pragma once -namespace ledger { +namespace ledger { namespace flags { template class supports_flags @@ -93,33 +93,33 @@ public: }; template -class basic_flags_t : public supports_flags +class basic_t : public supports_flags { public: - basic_flags_t() { - TRACE_CTOR(basic_flags_t, ""); + basic_t() { + TRACE_CTOR(basic_t, ""); } - basic_flags_t(const T& bits) { - TRACE_CTOR(basic_flags_t, "const T&"); + basic_t(const T& bits) { + TRACE_CTOR(basic_t, "const T&"); supports_flags::set_flags(bits); } - basic_flags_t(const U& bits) { - TRACE_CTOR(basic_flags_t, "const U&"); + basic_t(const U& bits) { + TRACE_CTOR(basic_t, "const U&"); supports_flags::set_flags(static_cast(bits)); } - ~basic_flags_t() throw() { - TRACE_DTOR(basic_flags_t); + ~basic_t() throw() { + TRACE_DTOR(basic_t); } - basic_flags_t(const basic_flags_t& other) + basic_t(const basic_t& other) : supports_flags(other) { - TRACE_CTOR(basic_flags_t, "copy"); + TRACE_CTOR(basic_t, "copy"); } - basic_flags_t& operator=(const basic_flags_t& other) { + basic_t& operator=(const basic_t& other) { set_flags(other.flags()); return *this; } - basic_flags_t& operator=(const T& bits) { + basic_t& operator=(const T& bits) { set_flags(bits); return *this; } @@ -131,13 +131,13 @@ public: return supports_flags::flags(); } - basic_flags_t plus_flags(const T& arg) const { - basic_flags_t temp(*this); + basic_t plus_flags(const T& arg) const { + basic_t temp(*this); temp.add_flags(arg); return temp; } - basic_flags_t minus_flags(const T& arg) const { - basic_flags_t temp(*this); + basic_t minus_flags(const T& arg) const { + basic_t temp(*this); temp.drop_flags(arg); return temp; } @@ -184,4 +184,4 @@ public: } }; -} // namespace ledger +} } // namespace ledger::flags -- cgit v1.2.3