Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Olympe::ConditionPreset Struct Reference

A globally-stored, reusable condition expression. More...

#include <ConditionPreset.h>

+ Collaboration diagram for Olympe::ConditionPreset:

Public Member Functions

 ConditionPreset ()
 Default constructor — generates an empty preset.
 
 ConditionPreset (const std::string &id, const Operand &l, ComparisonOp o, const Operand &r)
 Full constructor.
 
std::string GetPreview () const
 Returns a human-readable preview string.
 
bool NeedsLeftPin () const
 Returns true when the left operand is in Pin mode.
 
bool NeedsRightPin () const
 Returns true when the right operand is in Pin mode.
 
std::pair< bool, boolGetPinNeeds () const
 Returns a pair {needsLeft, needsRight}.
 
nlohmann::json ToJson () const
 Serializes this preset to a JSON object.
 

Static Public Member Functions

static std::string OpToString (ComparisonOp o)
 Returns the operator as a display string (e.g. "<=").
 
static ComparisonOp OpFromString (const std::string &s)
 Parses a display string back to a ComparisonOp.
 
static ConditionPreset FromJson (const nlohmann::json &data)
 Deserializes a ConditionPreset from a JSON object.
 

Public Attributes

std::string id
 Global unique UUID (e.g. "preset_001")
 
std::string name
 Human-readable display name (e.g. "Condition #1")
 
Operand left
 
ComparisonOp op
 
Operand right
 

Detailed Description

A globally-stored, reusable condition expression.

Identified by a UUID string. Holds a left Operand, a ComparisonOp, and a right Operand. Serialized to / loaded from ./Blueprints/Presets/condition_presets.json.

Definition at line 49 of file ConditionPreset.h.

Constructor & Destructor Documentation

◆ ConditionPreset() [1/2]

Olympe::ConditionPreset::ConditionPreset ( )

Default constructor — generates an empty preset.

Definition at line 21 of file ConditionPreset.cpp.

◆ ConditionPreset() [2/2]

Olympe::ConditionPreset::ConditionPreset ( const std::string &  id,
const Operand l,
ComparisonOp  o,
const Operand r 
)

Full constructor.

Parameters
idUUID string (caller must supply a unique value).
lLeft operand.
oComparison operator.
rRight operand.

Definition at line 34 of file ConditionPreset.cpp.

Member Function Documentation

◆ FromJson()

ConditionPreset Olympe::ConditionPreset::FromJson ( const nlohmann::json data)
static

Deserializes a ConditionPreset from a JSON object.

Definition at line 114 of file ConditionPreset.cpp.

References Olympe::Operand::FromJson(), GetComponentTypeID_Static(), id, and OpFromString().

Referenced by Olympe::ConditionPresetRegistry::Load(), and Olympe::TaskGraphLoader::ParseSchemaV4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPinNeeds()

std::pair< bool, bool > Olympe::ConditionPreset::GetPinNeeds ( ) const

Returns a pair {needsLeft, needsRight}.

Definition at line 67 of file ConditionPreset.cpp.

References Olympe::Operand::IsPin(), left, and right.

+ Here is the call graph for this function:

◆ GetPreview()

std::string Olympe::ConditionPreset::GetPreview ( ) const

Returns a human-readable preview string.

Example: "[mHealth] <= [2]"

Definition at line 50 of file ConditionPreset.cpp.

References Olympe::Operand::GetDisplayString(), left, op, OpToString(), and right.

Referenced by Olympe::ConditionPresetEditDialog::GetPreview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NeedsLeftPin()

bool Olympe::ConditionPreset::NeedsLeftPin ( ) const

Returns true when the left operand is in Pin mode.

Definition at line 57 of file ConditionPreset.cpp.

References Olympe::Operand::IsPin(), and left.

+ Here is the call graph for this function:

◆ NeedsRightPin()

bool Olympe::ConditionPreset::NeedsRightPin ( ) const

Returns true when the right operand is in Pin mode.

Definition at line 62 of file ConditionPreset.cpp.

References Olympe::Operand::IsPin(), and right.

+ Here is the call graph for this function:

◆ OpFromString()

ComparisonOp Olympe::ConditionPreset::OpFromString ( const std::string &  s)
static

Parses a display string back to a ComparisonOp.

Returns ComparisonOp::Equal on unknown input.

Definition at line 88 of file ConditionPreset.cpp.

References Olympe::Equal, GetComponentTypeID_Static(), Olympe::Greater, Olympe::GreaterEqual, Olympe::Less, Olympe::LessEqual, and Olympe::NotEqual.

Referenced by FromJson(), Olympe::ConditionPresetEditDialog::RenderOperatorSelector(), and Olympe::ConditionPresetEditDialog::SetOperator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OpToString()

std::string Olympe::ConditionPreset::OpToString ( ComparisonOp  o)
static

Returns the operator as a display string (e.g. "<=").

Definition at line 73 of file ConditionPreset.cpp.

References Olympe::Equal, GetComponentTypeID_Static(), Olympe::Greater, Olympe::GreaterEqual, Olympe::Less, Olympe::LessEqual, and Olympe::NotEqual.

Referenced by GetPreview(), Olympe::ConditionPresetEditDialog::RenderOperatorSelector(), and ToJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToJson()

nlohmann::json Olympe::ConditionPreset::ToJson ( ) const

Serializes this preset to a JSON object.

Definition at line 102 of file ConditionPreset.cpp.

References GetComponentTypeID_Static(), id, left, name, op, OpToString(), right, and Olympe::Operand::ToJson().

+ Here is the call graph for this function:

Member Data Documentation

◆ id

std::string Olympe::ConditionPreset::id

◆ left

Operand Olympe::ConditionPreset::left

◆ name

std::string Olympe::ConditionPreset::name

◆ op

ComparisonOp Olympe::ConditionPreset::op

◆ right

Operand Olympe::ConditionPreset::right

The documentation for this struct was generated from the following files: