Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
OperatorRegistry.h
Go to the documentation of this file.
1/**
2 * @file OperatorRegistry.h
3 * @brief Hardcoded lists of math and comparison operators for dropdown editors.
4 * @author Olympe Engine
5 * @date 2026-03-14
6 *
7 * @details
8 * Provides static access to the supported math operators (+, -, *, /, %)
9 * and comparison operators (==, !=, <, <=, >, >=) used by MathOp nodes
10 * and condition parameters.
11 *
12 * C++14 compliant — no std::optional, structured bindings, std::filesystem.
13 */
14
15#pragma once
16
17#include <string>
18#include <vector>
19
20namespace Olympe {
21
22/**
23 * @class OperatorRegistry
24 * @brief Static registry of math and comparison operator strings.
25 *
26 * @details
27 * All methods are static — no instance creation required.
28 */
30public:
31
32 /**
33 * @brief Returns the list of supported math operator symbols.
34 * @return Vector of strings: {"+", "-", "*", "/", "%"}
35 */
36 static const std::vector<std::string>& GetMathOperators();
37
38 /**
39 * @brief Returns the list of supported comparison operator symbols.
40 * @return Vector of strings: {"==", "!=", "<", "<=", ">", ">="}
41 */
42 static const std::vector<std::string>& GetComparisonOperators();
43
44 /**
45 * @brief Returns true if the given symbol is a valid math operator.
46 * @param op Operator symbol to check.
47 */
48 static bool IsValidMathOperator(const std::string& op);
49
50 /**
51 * @brief Returns true if the given symbol is a valid comparison operator.
52 * @param op Operator symbol to check.
53 */
54 static bool IsValidComparisonOperator(const std::string& op);
55
56 /**
57 * @brief Returns a human-readable display name for an operator.
58 *
59 * Examples: "+" -> "Add (+)", "==" -> "Equal (==)"
60 * Falls back to the operator symbol itself if not found.
61 *
62 * @param op Operator symbol.
63 * @return Display name string.
64 */
65 static std::string GetDisplayName(const std::string& op);
66
67private:
68 OperatorRegistry() = delete;
69};
70
71} // namespace Olympe
Static registry of math and comparison operator strings.
static bool IsValidMathOperator(const std::string &op)
Returns true if the given symbol is a valid math operator.
static bool IsValidComparisonOperator(const std::string &op)
Returns true if the given symbol is a valid comparison operator.
static std::string GetDisplayName(const std::string &op)
Returns a human-readable display name for an operator.
static const std::vector< std::string > & GetComparisonOperators()
Returns the list of supported comparison operator symbols.
static const std::vector< std::string > & GetMathOperators()
Returns the list of supported math operator symbols.
< Provides AssetID and INVALID_ASSET_ID