SmartTableObjectModel.h
The model behind Set Items. It holds the objects and reads them by name.
The model SetItems builds, and the one most tables never name.
Rows are UObjects, and columns resolve by name to a property or to a pure function that needs no input, once per class. That is the whole path with no code behind it: text, sorting and filtering all fall out of the same resolved binding.
It owns its items, the way UListView holds a strong array. Items are usually built in a Blueprint and held nowhere else, so a model that only pointed at them would empty itself at the next garbage collection, in no fixed order.
- Class
- USmartTableObjectModel
- Extends
- USmartTableModel
- Members
- 29
Public functions 8
Replaces the whole set. Nulls are dropped and counted for one log line, never drawn as empty rows.
The table hears which items arrived and which left, by comparing row ids with the set before. A set that shares no item with the one before is a new set.
Adds one item at the end, and the table hears that its row arrived.
Drops one item, every copy of it. Does nothing when it is not in the set.
Drops every item, which the table hears as a new set. The columns stay as they were.
A view of the items as they are held. It points at the array, so nothing may keep it past a tick.
Natural row of this item, or INDEX_NONE when the set does not hold it.
The row id of an item, which GetRowId answers and SetItems compares. None for a null item.
One id per object for as long as it lives. An object name is unique only among the objects of one outer, and two rows with one id would trade their selection, their entrance and the row a view holds.
The columns this model resolves its bindings against.
Given by the table and never asked for, because the table owns the column names and a model must not reach into the widget that owns it.
Protected functions 7
Private functions 6
Resolves every column against Class, warning for each column that resolves against nothing. Once per call and not once ever, so a table that resolves again says it again.
The row id of every item, in the order they are held.
Not const, because a miss resolves: the cache is filled here or nowhere. Every caller is one of the read events of this model, which are not const for exactly this reason.
Private variables 5
- Transient
- Never saved.
- Transient
- Never saved.
Reflected because a column carries a CellClass, and a UClass held only by a plain array is one the garbage collector can not see.
Keyed by item class, because a set holding several classes is fine. A column that resolves on some of them draws for those and stays empty for the rest, which is a fact about the data.
Weak, and swept on a miss inside FindBinding. A Blueprint compile gives the same objects a freshly built UClass. The entry for the class it replaced can never be found again, since a weak key is matched by its number, and the two writers that clear this map are not on that path. Without the sweep every compile leaves one dead entry behind, for the life of the model.
Column id to its place in Columns. Filled in SetColumns, so it holds for every class at once: the binding arrays are all in the same order as Columns. A cell draw would otherwise walk the columns to find its own, once per cell per frame.
Item to its row, so IndexOfItem is a lookup and not a walk of every item.
Every writer of Items writes this in the same call, and there are five. SetItems and MoveRows rebuild it. RemoveItem rebuilds it too, since taking one out moves every row after it. ClearItems empties it, and AddItem adds the one row it appended.
A writer that forgets leaves the table scrolling to the wrong row and selecting nothing, and says nothing anywhere.
The FIRST of a repeated item holds the row, which is what a walk of the items answered.
FColumnBinding struct
The bindings of one column against one item class. Resolved per class and never per cell, or a table of ten thousand rows would do ten thousand name lookups to draw one column.
Public variables 3
Where in Columns this one sits. Every array of these is filled in step with Columns, and SetColumns drops them all, so the two can not come apart.