EntityTable.h header
#include <ew/app/EntityTable.h>
Namespace ew::app
EntityTable struct
struct ew::app::EntityTable
A category's entities rendered as a table: a header row of column names plus one row of values per entity. fieldKeys is parallel to headers and gives the entity field key each column maps to (empty for the leading Name column), so the same table can be pushed back to the codex. entityIds is parallel to rows, naming the source entity of each row (a null id for a row the user added by hand).
Members
std::vector<QString> ew::app::EntityTable::headers
Column display names ("Name", then each field's label).
std::vector<QString> ew::app::EntityTable::fieldKeys
The entity field key each column maps to; empty for the Name column. Parallel to headers.
std::vector<std::vector<QString> > ew::app::EntityTable::rows
One row of cell values per entity, each parallel to headers.
std::vector<ew::core::ContentId> ew::app::EntityTable::entityIds
The source entity id of each row; parallel to rows.
Functions
EntityTable ew::app::entityTableForCategory(const ew::core::Project &project, ew::core::CategoryId categoryId, const MountedLibraries *libraries=nullptr)
Builds the entity table for categoryId: headers are "Name" plus the category's effective field labels (own and inherited), with one row per entity that is a direct member of the category, sorted by name then id, holding the entity's name and field values. A Reference field's value (stored as the target's ContentId) is shown as the referenced entity's name – resolved across libraries when given, otherwise within project alone – rather than a raw id, and blank when it points at no entity. An unknown category yields just the "Name" header and no rows.
std::unique_ptr< ew::core::Command > ew::app::makeSheetToEntitiesCommand(ew::core::Project &project, const ew::core::Spreadsheet &sheet, ew::core::CategoryId categoryId, const std::vector< int > &rows, const MountedLibraries *libraries=nullptr)
Builds an undoable command that pushes the data rows of sheet into entities of categoryId. A row whose Name matches an existing entity of that category updates that entity's field values; a row with a new Name creates a new entity. Columns map to fields by matching each header (row 0) to a field's label or key; the Name column is the one headed "Name", or column 0 if none is. Empty cells are left untouched (they do not clear a field), and duplicate names within the pushed rows are de-duplicated (first wins). An empty rows means every data row (row 1 downward). Returns nullptr when nothing needs to change. project is mutated only when the returned command is applied. A Reference column's cell holds a display name (as produced by entityTableForCategory); it is resolved back to the target's ContentId – across libraries when given, otherwise within project – before it is stored, and a name matching no entity is left untouched so a valid reference is never overwritten with free text.