Skip to content

Commit

Permalink
feat(engine): implemented equality operator for AnyAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
roby2014 committed Oct 16, 2023
1 parent 68771e0 commit 429875a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit 429875a

Please sign in to comment.