Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement equality operator for AnyAsset #725

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions engine/include/cubos/engine/assets/asset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ namespace cubos::engine
/// @param other Handle to move.
AnyAsset& operator=(AnyAsset&& other) noexcept;

/// @brief Equality operator for comparing two AnyAsset objects.
/// @param other The other AnyAsset to compare.
/// @return True if the two AnyAsset objects have the same UUID , otherwise false.
bool operator==(const AnyAsset& other) const;

/// @brief Gets the version of the asset last seen by this handle.
/// @return Asset version.
int getVersion() const;
Expand Down
5 changes: 5 additions & 0 deletions engine/src/cubos/engine/assets/asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ AnyAsset& AnyAsset::operator=(AnyAsset&& other) noexcept
return *this;
}

bool AnyAsset::operator==(const AnyAsset& other) const
{
return this->getId() == other.getId();
}

int AnyAsset::getVersion() const
{
return reflectedId == mId ? mVersion : 0;
Expand Down
Loading