diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2023-04-12 11:14:08 +0200 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2023-04-12 21:52:36 +0200 |
commit | 5f78556078d2e61d5c0ef44e36d58f3864cd84d1 (patch) | |
tree | eb8e9e52d156b00e8699e46c01de42c606b935d7 /src/flags.h | |
parent | 15f29d4852e01bc6c6fb802ee818d991142e2f36 (diff) | |
download | fork-ledger-5f78556078d2e61d5c0ef44e36d58f3864cd84d1.tar.gz fork-ledger-5f78556078d2e61d5c0ef44e36d58f3864cd84d1.tar.bz2 fork-ledger-5f78556078d2e61d5c0ef44e36d58f3864cd84d1.zip |
Refactor basic_flags_t to ledger::flags::basic_t
Diffstat (limited to 'src/flags.h')
-rw-r--r-- | src/flags.h | 38 |
1 files changed, 19 insertions, 19 deletions
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 <typename T = boost::uint_least8_t, typename U = T> class supports_flags @@ -93,33 +93,33 @@ public: }; template <typename T = boost::uint_least8_t, typename U = T> -class basic_flags_t : public supports_flags<T, U> +class basic_t : public supports_flags<T, U> { 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<T, U>::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<T, U>::set_flags(static_cast<T>(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<T, U>(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<T, U>::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 |