Class FZagalaSpecFeatureBuilder#
Defined in File ZagalaSpecFeatureBuilder.h
Class Documentation#
-
class FZagalaSpecFeatureBuilder#
Converts an FZagalaSpecFeatureIR Intermediate Representation (IR) struct into a fully configured feature data asset that can be saved to disk.
Private/protected UPROPERTY fields on the ZagalaSpec UObjects are set via UE’s property reflection system (FindFProperty) so this Editor module does not need friend access or changes to access specifiers.
And/But step phases are resolved against the preceding explicit step (Given/When/Then) following the standard Gherkin inheritance rule.
Star (*) steps are treated as Given.
Steps become UZagalaSpecTextStep objects.
Framework tags are created as GameplayTags under the configured parent path.
Internal helpers (also usable by sibling builders within this module)
-
static EZagalaSpecStepPhase ResolvePhase(EZagalaSpecStepIRPhase RawPhase, EZagalaSpecStepPhase PreviousExplicit)#
Resolve And/But phases relative to the previous explicit phase.
- Parameters:
RawPhase – Phase parsed from the step keyword.
PreviousExplicit – Last explicit phase, inherited by And/But.
- Returns:
The resolved step phase.
-
static FGameplayTag EnsureGameplayTag(const FString &TagPath, TArray<FString> &OutWarnings)#
Create or reuse a GameplayTag, appending OutWarnings if a collision is detected.
- Parameters:
TagPath – Full tag name.
OutWarnings – Receives warnings if the tag cannot be created or found.
- Returns:
The tag; invalid if creation failed.
-
static FName MakeScenarioObjectName(const FString &Title)#
Derive a safe UObject name from a scenario title.
- Parameters:
Title – Scenario title.
- Returns:
The slugified object name.
-
static FString RetrieveExamplesEntryMatchingText()#
Retrieve A default matching Examples Iterator’s text step definition that matches the Examples Iterator pattern.
- Returns:
A default matching Examples Iterator text step definition that matches the Examples Iterator pattern.
Reflection helpers
-
template<typename T>
static inline bool SetPropertyValue(UObject *Object, FName PropName, const T &Value)# Write a typed UPROPERTY value on an arbitrary UObject via reflection.
- Parameters:
Object – Object that owns the property.
PropName – Name of the property.
Value – Value to write.
- Returns:
false if the property was not found.
-
static bool SetGameplayTagProp(UObject *Object, FName PropName, const FGameplayTag &Tag)#
Write a FGameplayTag UPROPERTY via reflection.
- Parameters:
Object – Object that owns the property.
PropName – Name of the property.
Tag – Tag to write.
- Returns:
false if not found.
-
static bool SetObjectProp(UObject *Object, FName PropName, UObject *Value)#
Write a UObject* UPROPERTY via reflection.
- Parameters:
Object – Object that owns the property.
PropName – Name of the property.
Value – Object to write.
- Returns:
false if not found.
-
template<typename T>
static inline bool AppendToArrayProp(UObject *Object, FName PropName, T *Item)# Append an item to a TArray<TObjectPtr<T>> UPROPERTY via reflection.
- Parameters:
Object – Object that owns the array property.
PropName – Name of the array property.
Item – Item to append.
- Returns:
false if the array property was not found.
Public Static Functions
-
static UObject *Build(const FZagalaSpecFeatureIR &ImportedFeature, UObject *InOuter, const FName &InAssetName, TArray<FString> &OutWarnings)#
Build a feature from an IR feature.
- Parameters:
ImportedFeature – Parsed IR data.
InOuter – UObject outer for the created asset (typically a UPackage).
InAssetName – Name for the created asset.
OutWarnings – Additional warnings encountered during build.
- Returns:
The created asset, or nullptr on failure.
-
static void BuildFeatureScenarios(const FZagalaSpecFeatureIR &ImportedFeature, UObject *Feature, const FString &FeatureTagPath, TArray<FString> &OutWarnings, const FName &InAssetName)#
Build all scenarios from an IR feature and attach them to the feature asset.
- Parameters:
ImportedFeature – Parsed IR data.
Feature – The feature asset to attach the scenarios to.
FeatureTagPath – GameplayTag path of the feature (used as a prefix for scenario tags).
OutWarnings – Additional warnings encountered during build.
InAssetName – Name of the feature asset (used for logging).
-
static void BuildScenarioSteps(const FZagalaSpecFeatureIR &ImportedFeature, const FZagalaSpecScenarioIR &ImportedScenario, UObject *Scenario, TArray<FString> &OutWarnings)#
Build the steps for a scenario, creating context extensions and expectations as needed.
depending on whether background steps or per-scenario context extension steps exist.
- Parameters:
ImportedFeature – Parsed IR data for the feature (used to check for background steps).
ImportedScenario – Parsed IR data for the scenario (used to check for context extension steps).
Scenario – The scenario asset to attach the context to.
OutWarnings – Additional warnings encountered during build.
-
static void SetScenarioDescription(const FZagalaSpecScenarioIR &ImportedScenario, UObject *Scenario)#
Build the Description string from the scenario’s steps, preserving original keywords.
And/But are kept verbatim for human readability in the editor. The resulting string is stored in the Description property.
- Parameters:
ImportedScenario – Parsed IR data for the scenario.
Scenario – The scenario asset to set the description on.
-
static void SetFeatureBasicProperties(UObject *Feature, const FGameplayTag &Identifier, const FZagalaSpecFeatureIR &ImportedFeature)#
Set the basic properties of a UObject (Identifier, Description, bIncludeAllScenariosInTests).
- Parameters:
Feature – The feature asset to set properties on.
Identifier – GameplayTag to assign to the feature (should be pre-created by the caller).
ImportedFeature – Parsed IR data to source the properties from. Note: This does not set up scenarios or context extensions, which are handled separately.
-
static void InjectTextStepsIntoProperty(const TArray<FZagalaSpecStepIR> &IntermediateSteps, UObject *PropertyHolder, FName PropertyName)#
Inject a list of FZagalaSpecStepIR into a UPROPERTY FString or TArray<FString> on an arbitrary UObject.
- Parameters:
IntermediateSteps – The steps to inject (will be converted to text).
PropertyHolder – The UObject that holds the property to set.
PropertyName – The name of the property to set (must be FString or TArray<FString>).
-
static FString SlugifyTitle(const FString &Title)#
Slugify a free-text title into a valid GameplayTag leaf component.
Spaces, hyphens, and underscores are removed and cause the next character to be capitalised (PascalCase). Other non-alphanumeric characters are removed.
- Parameters:
Title – Free-text title.
- Returns:
The PascalCase slug, or
Unnamedif no characters remain.