X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcpp-common%2Fbt2%2Finteger-range.hpp;h=6f449403098dd95294ab6a84d9c0839c9f2f8ecc;hb=HEAD;hp=7e94e9e037c42bbcefe0711056f692f94dc05b22;hpb=e0c2afae96a9cdfd2a5bab7f97a6342131da499c;p=babeltrace.git diff --git a/src/cpp-common/bt2/integer-range.hpp b/src/cpp-common/bt2/integer-range.hpp index 7e94e9e0..6f449403 100644 --- a/src/cpp-common/bt2/integer-range.hpp +++ b/src/cpp-common/bt2/integer-range.hpp @@ -7,20 +7,20 @@ #ifndef BABELTRACE_CPP_COMMON_BT2_INTEGER_RANGE_HPP #define BABELTRACE_CPP_COMMON_BT2_INTEGER_RANGE_HPP -#include #include +#include + #include -#include "internal/borrowed-obj.hpp" +#include "borrowed-object.hpp" namespace bt2 { - namespace internal { template struct ConstIntegerRangeSpec; -// Functions specific to unsigned integer ranges +/* Functions specific to unsigned integer ranges */ template <> struct ConstIntegerRangeSpec final { @@ -41,7 +41,7 @@ struct ConstIntegerRangeSpec final } }; -// Functions specific to signed integer ranges +/* Functions specific to signed integer ranges */ template <> struct ConstIntegerRangeSpec final { @@ -62,61 +62,51 @@ struct ConstIntegerRangeSpec final } }; -} // namespace internal +} /* namespace internal */ template -class ConstIntegerRange final : public internal::BorrowedObj +class ConstIntegerRange final : public BorrowedObject { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; - using _ThisConstIntegerRange = ConstIntegerRange; + using typename BorrowedObject::_ThisBorrowedObject; public: + using typename BorrowedObject::LibObjPtr; + using Value = typename std::conditional::value, std::uint64_t, std::int64_t>::type; public: - explicit ConstIntegerRange(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} - { - } - - ConstIntegerRange(const _ThisConstIntegerRange& range) noexcept : _ThisBorrowedObj {range} - { - } - - _ThisConstIntegerRange& operator=(const _ThisConstIntegerRange& range) noexcept + explicit ConstIntegerRange(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { - _ThisBorrowedObj::operator=(range); - return *this; } - bool operator==(const _ThisConstIntegerRange& other) const noexcept + bool operator==(const ConstIntegerRange& other) const noexcept { - return internal::ConstIntegerRangeSpec::isEqual(this->_libObjPtr(), - other._libObjPtr()); + return internal::ConstIntegerRangeSpec::isEqual(this->libObjPtr(), + other.libObjPtr()); } - bool operator!=(const _ThisConstIntegerRange& other) const noexcept + bool operator!=(const ConstIntegerRange& other) const noexcept { return !(*this == other); } Value lower() const noexcept { - return internal::ConstIntegerRangeSpec::lower(this->_libObjPtr()); + return internal::ConstIntegerRangeSpec::lower(this->libObjPtr()); } Value upper() const noexcept { - return internal::ConstIntegerRangeSpec::upper(this->_libObjPtr()); + return internal::ConstIntegerRangeSpec::upper(this->libObjPtr()); } }; using ConstUnsignedIntegerRange = ConstIntegerRange; using ConstSignedIntegerRange = ConstIntegerRange; -} // namespace bt2 +} /* namespace bt2 */ -#endif // BABELTRACE_CPP_COMMON_BT2_INTEGER_RANGE_HPP +#endif /* BABELTRACE_CPP_COMMON_BT2_INTEGER_RANGE_HPP */