Class FZagalaSpecDocumentLayout#
Defined in File ZagalaSpecDocumentLayout.h
Class Documentation#
-
class FZagalaSpecDocumentLayout#
An ordered list of section builders.
Building the layout runs every builder in order and returns the rows of the whole document (or of a scenario block, for the scenario layout).
The default layouts are created by CreateDefaultFeatureLayout and CreateDefaultScenarioLayout. Other modules can change them through FZagalaSpecEditorModule, for example:
Layout->InsertAfter(ZagalaSpecDocumentSectionIds::FeatureHeader, MakeShared<FMyNotesSectionBuilder>());
Public Functions
Appends a section at the end of the layout.
- Parameters:
Builder – The section to add.
- Returns:
False (and nothing is added) if a section with the same id already exists.
Inserts a section right before an existing one.
- Parameters:
ExistingId – The id of the section to insert before.
Builder – The section to insert.
- Returns:
False (and nothing is inserted) if ExistingId is not in the layout or Builder’s id is already used.
Inserts a section right after an existing one.
- Parameters:
ExistingId – The id of the section to insert after.
Builder – The section to insert.
- Returns:
False (and nothing is inserted) if ExistingId is not in the layout or Builder’s id is already used.
Replaces an existing section with another one, keeping its position.
- Parameters:
ExistingId – The id of the section to replace.
Builder – The new section.
- Returns:
False (and nothing is replaced) if ExistingId is not in the layout or Builder’s id belongs to another section.
-
bool Remove(const FName Id)#
Removes a section.
- Parameters:
Id – The id of the section to remove.
- Returns:
True if the section was in the layout.
-
TArray<FName> GetSectionIds() const#
Returns the ids of the sections in build order.
- Returns:
The section ids.
-
void Build(const FZagalaSpecDocumentBuildContext &Context, TArray<FZagalaSpecDocumentRowPtr> &OutRows) const#
Runs every section in order and collects the rows.
Spacer rows left at the end are removed so the document never ends with an empty line.
- Parameters:
Context – The feature (and scenario) the rows are built for.
OutRows – Receives the rows; appended to, not cleared.
Public Static Functions
-
static TSharedRef<FZagalaSpecDocumentLayout> CreateDefaultScenarioLayout()#
Creates the layout of one scenario: header, then steps.
- Returns:
The default scenario layout.
Creates the layout of a whole feature: header, shared context extensions, then scenarios.
- Parameters:
ScenarioLayout – The layout used to build each scenario. Kept by reference, so later changes to it are used.
- Returns:
The default feature layout.