Skip to content

Commit

Permalink
Add get_hash_code method
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Feb 11, 2025
1 parent 5ac1da4 commit 393d5c8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/xtd.forms/include/xtd/forms/enable_debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,18 @@ namespace xtd {
/// @name Public Methods

/// @{
using object::equals;
bool equals(const enable_debug& value) const noexcept override;
/// @brief Determines whether the specified object is equal to the current object.
/// @param obj The object to compare with the current object.
/// @return `true` if the specified object is equal to the current object. otherwise, `false`.
bool equals(const xtd::object& obj) const noexcept override;
/// @brief Determines whether the specified object is equal to the current object.
/// @param other The object to compare with the current object.
/// @return `true` if the specified object is equal to the current object. otherwise, `false`.
bool equals(const enable_debug& other) const noexcept override;

/// @brief Serves as a hash function for a particular type.
/// @return A hash code for the current object.
xtd::size get_hash_code() const noexcept override;
/// @}

/// @name Public Static Methods
Expand Down
12 changes: 10 additions & 2 deletions src/xtd.forms/src/xtd/forms/enable_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ xtd::diagnostics::trace_switch& enable_debug::trace_switch() noexcept {
return trace_switch_;
}

bool enable_debug::equals(const enable_debug& value) const noexcept {
return value_ == value.value_;
bool enable_debug::equals(const object& obj) const noexcept {
return is<enable_debug>(obj) && equals(static_cast<const enable_debug&>(obj));
}

bool enable_debug::equals(const enable_debug& other) const noexcept {
return value_ == other.value_;
}

xtd::size enable_debug::get_hash_code() const noexcept {
return hash_code::combine(value_);
}

bool enable_debug::get(const enable_debug& flags) {
Expand Down

0 comments on commit 393d5c8

Please sign in to comment.