diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-10-08 13:34:45 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-10-08 13:34:58 +0300 |
commit | 5da58f48ae0a429eb2aa5745362f8c7ee9c165a7 (patch) | |
tree | 0bc1a66dd01770c09982969312f6391bd4f4f0d6 | |
parent | 482806c81678e351ff171c68a757386a5b2d4676 (diff) |
Cleanup: asset catalogs, move functions to their siblings
Moved function definitions around so that all members of a class are
next to each other. Previously some functions of one class were sitting
between functions of another class.
No functional changes.
-rw-r--r-- | source/blender/blenkernel/intern/asset_catalog.cc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc index d50942bd9fa..1d25bda480d 100644 --- a/source/blender/blenkernel/intern/asset_catalog.cc +++ b/source/blender/blenkernel/intern/asset_catalog.cc @@ -362,6 +362,11 @@ std::unique_ptr<AssetCatalogDefinitionFile> AssetCatalogService::construct_cdf_i return cdf; } +AssetCatalogTree *AssetCatalogService::get_catalog_tree() +{ + return catalog_tree_.get(); +} + std::unique_ptr<AssetCatalogTree> AssetCatalogService::read_into_tree() { auto tree = std::make_unique<AssetCatalogTree>(); @@ -466,6 +471,22 @@ bool AssetCatalogTreeItem::has_children() const return !children_.empty(); } +void AssetCatalogTreeItem::foreach_item_recursive(AssetCatalogTreeItem::ChildMap &children, + const ItemIterFn callback) +{ + for (auto &[key, item] : children) { + callback(item); + foreach_item_recursive(item.children_, callback); + } +} + +void AssetCatalogTreeItem::foreach_child(const ItemIterFn callback) +{ + for (auto &[key, item] : children_) { + callback(item); + } +} + /* ---------------------------------------------------------------------- */ void AssetCatalogTree::insert_item(const AssetCatalog &catalog) @@ -507,15 +528,6 @@ void AssetCatalogTree::foreach_item(AssetCatalogTreeItem::ItemIterFn callback) AssetCatalogTreeItem::foreach_item_recursive(root_items_, callback); } -void AssetCatalogTreeItem::foreach_item_recursive(AssetCatalogTreeItem::ChildMap &children, - const ItemIterFn callback) -{ - for (auto &[key, item] : children) { - callback(item); - foreach_item_recursive(item.children_, callback); - } -} - void AssetCatalogTree::foreach_root_item(const ItemIterFn callback) { for (auto &[key, item] : root_items_) { @@ -523,18 +535,6 @@ void AssetCatalogTree::foreach_root_item(const ItemIterFn callback) } } -void AssetCatalogTreeItem::foreach_child(const ItemIterFn callback) -{ - for (auto &[key, item] : children_) { - callback(item); - } -} - -AssetCatalogTree *AssetCatalogService::get_catalog_tree() -{ - return catalog_tree_.get(); -} - bool AssetCatalogDefinitionFile::contains(const CatalogID catalog_id) const { return catalogs_.contains(catalog_id); |