DuplicateCategories.h header
#include <ew/app/DuplicateCategories.h>
Namespace ew::app
DuplicateCategoryGroup struct
struct ew::app::DuplicateCategoryGroup
Two or more categories that are really one, seen through the escaping that split them.
Members
QString ew::app::entity::DuplicateCategoryGroup::name
The name they all mean – entity references decoded. What the survivor is renamed to.
std::vector<ew::core::foundation::CategoryId> ew::app::entity::DuplicateCategoryGroup::categories
The categories, the one to KEEP first: the one holding the most entities, so the merge moves as little as possible and the id most of the project already points at survives.
std::vector<int> ew::app::entity::DuplicateCategoryGroup::entityCounts
How many entities each holds, in the same order.
Functions
std::unique_ptr< ew::core::undo::Command > ew::app::entity::buildMergeDuplicateCategoriesCommand(ew::core::project::Project &project, const DuplicateCategoryGroup &group)
A command merging every category in group into the first, as ONE undoable step.
The survivor takes the decoded name and gains any property the others declared that it lacks, so no entity loses sight of a value it already had. Entities and sub-categories are re-pointed at the survivor, and the emptied categories are removed.
No VALUE is touched. An entity keeps everything it holds; what changes is which category it is filed under, and therefore which properties are willing to display what it already stores.
Null when group names fewer than two categories that still exist.
std::vector< DuplicateCategoryGroup > ew::app::entity::findDuplicateCategories(const ew::core::project::Project &project)
The groups of categories in project whose names differ only by HTML escaping.
A project grew "Lore & Concepts" beside "Lore & Concepts" because escaped text reached a create tool; the two are different strings, so they are different categories, and the writer's entities end up split between them with nothing on screen to explain why. This finds them.
Names are compared decoded AND case-sensitively otherwise: "Items" and "items" are a judgement call about the writer's intent, but "Items & Artifacts" and "Items & Artifacts" are the same name written twice, and only the second kind is safe to offer merging.