mirror of
				https://github.com/Laupetin/OpenAssetTools.git
				synced 2025-10-30 18:17:15 +00:00 
			
		
		
		
	Add menu unary expression for minus
This commit is contained in:
		| @@ -31,10 +31,24 @@ const CommonExpressionUnaryOperationType CommonExpressionUnaryOperationType::OPE | ||||
|     } | ||||
| ); | ||||
|  | ||||
| const CommonExpressionUnaryOperationType CommonExpressionUnaryOperationType::OPERATION_NEGATIVE( | ||||
|     "-", | ||||
|     [](const CommonExpressionValue& operand) -> CommonExpressionValue | ||||
|     { | ||||
|         if(operand.m_type == CommonExpressionValue::Type::INT) | ||||
|             return CommonExpressionValue(-operand.m_int_value); | ||||
|         if (operand.m_type == CommonExpressionValue::Type::DOUBLE) | ||||
|             return CommonExpressionValue(-operand.m_double_value); | ||||
|  | ||||
|         return CommonExpressionValue(0); | ||||
|     } | ||||
| ); | ||||
|  | ||||
| const CommonExpressionUnaryOperationType* const CommonExpressionUnaryOperationType::ALL_OPERATION_TYPES[static_cast<int>(UnaryOperationId::COUNT)] | ||||
| { | ||||
|     &OPERATION_NOT, | ||||
|     &OPERATION_BITWISE_NOT, | ||||
|     &OPERATION_NEGATIVE, | ||||
| }; | ||||
|  | ||||
| CommonExpressionUnaryOperation::CommonExpressionUnaryOperation(const CommonExpressionUnaryOperationType* operationType, std::unique_ptr<ICommonExpression> operand) | ||||
|   | ||||
| @@ -13,6 +13,7 @@ namespace menu | ||||
|     { | ||||
|         NOT, | ||||
|         BITWISE_NOT, | ||||
|         NEGATIVE, | ||||
|  | ||||
|         COUNT | ||||
|     }; | ||||
| @@ -31,6 +32,7 @@ namespace menu | ||||
|     public: | ||||
|         static const CommonExpressionUnaryOperationType OPERATION_NOT; | ||||
|         static const CommonExpressionUnaryOperationType OPERATION_BITWISE_NOT; | ||||
|         static const CommonExpressionUnaryOperationType OPERATION_NEGATIVE; | ||||
|  | ||||
|         static const CommonExpressionUnaryOperationType* const ALL_OPERATION_TYPES[static_cast<int>(UnaryOperationId::COUNT)]; | ||||
|     }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user