mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 14:58:10 -05:00
Add equals operation to simpleexpressionvalue to check if an expression is the same as another one
This commit is contained in:
@ -7,6 +7,29 @@ CommonExpressionFunctionCall::CommonExpressionFunctionCall(std::string functionN
|
||||
{
|
||||
}
|
||||
|
||||
bool CommonExpressionFunctionCall::Equals(const ISimpleExpression* other) const
|
||||
{
|
||||
const auto otherFunctionCall = dynamic_cast<const CommonExpressionFunctionCall*>(other);
|
||||
|
||||
if (!otherFunctionCall
|
||||
|| m_function_name != otherFunctionCall->m_function_name
|
||||
|| m_args.size() != otherFunctionCall->m_args.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for(auto i = 0u; i < m_args.size(); i++)
|
||||
{
|
||||
const auto* arg = m_args[i].get();
|
||||
const auto* otherArg = otherFunctionCall->m_args[i].get();
|
||||
|
||||
if (!arg->Equals(otherArg))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommonExpressionFunctionCall::IsStatic() const
|
||||
{
|
||||
return false;
|
||||
|
@ -13,6 +13,7 @@ namespace menu
|
||||
|
||||
explicit CommonExpressionFunctionCall(std::string functionName);
|
||||
|
||||
_NODISCARD bool Equals(const ISimpleExpression* other) const override;
|
||||
_NODISCARD bool IsStatic() const override;
|
||||
_NODISCARD SimpleExpressionValue Evaluate() const override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user