17 : name_(name), catalog_id_(catalog_id), simple_name_(simple_name), parent_(parent)
37 return has_unsaved_changes_;
60 return !children_.empty();
64 const ItemIterFn callback)
66 for (
const auto &[key, item] : children) {
68 foreach_item_recursive(item.children_, callback);
74 for (
const auto &[key, item] : children_) {
81 AssetCatalogTreeItem::foreach_item_recursive(children_, callback);
87 const std::optional<StringRef> skip_prefix)
95 "Malformed catalog path; should not start with a separator");
99 std::optional<StringRef> skip_prefix_tmp = skip_prefix;
102 if (skip_prefix_tmp && skip_prefix_tmp->startswith(component_name)) {
103 if (skip_prefix_tmp->size() == component_name.
size() ||
106 skip_prefix_tmp = skip_prefix_tmp->drop_prefix(component_name.
size() + 1);
112 auto [key_and_item, was_inserted] = current_item_children->emplace(
115 is_last_component ? catalog.
catalog_id : nil_id,
122 if (is_last_component) {
131 current_item_children = &item.children_;
137 AssetCatalogTreeItem::foreach_item_recursive(root_items_, callback);
142 for (
const auto &[key, item] : root_items_) {
149 return root_items_.empty();
#define BLI_assert_msg(a, msg)
const std::string & str() const
AssetCatalogPath()=default
void iterate_components(ComponentIteratorFn callback) const
static const char SEPARATOR
void foreach_child(ItemIterFn callback) const
AssetCatalogTreeItem(StringRef name, CatalogID catalog_id, StringRef simple_name, const AssetCatalogTreeItem *parent=nullptr)
int count_parents() const
AssetCatalogPath catalog_path() const
FunctionRef< void(const AssetCatalogTreeItem &)> ItemIterFn
CatalogID get_catalog_id() const
StringRefNull get_simple_name() const
std::map< std::string, AssetCatalogTreeItem > ChildMap
StringRefNull get_name() const
void foreach_item(ItemIterFn callback) const
bool has_unsaved_changes() const
bool has_children() const
void insert_item(const AssetCatalog &catalog, std::optional< StringRef > skip_prefix=std::nullopt)
void foreach_root_item(ItemIterFn callback) const
const AssetCatalogTreeItem * find_item(const AssetCatalogPath &path) const
void foreach_item(ItemIterFn callback) const
const AssetCatalogTreeItem * find_root_item(const AssetCatalogPath &path) const
const CatalogID catalog_id
struct blender::asset_system::AssetCatalog::Flags flags
constexpr int64_t size() const
bool BLI_uuid_is_nil(bUUID uuid)