diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-09-30 17:29:14 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-09-30 17:29:14 +0300 |
commit | 628fab696cfaefdd2ac758849c8a1e9a3a0beef0 (patch) | |
tree | d24db3bab2e501ef702dc87cddb732ffd61fb1a4 /source/blender/blenkernel/BKE_asset_catalog.hh | |
parent | 5d42ea036999a7e82dbc03947968f4ad61093d06 (diff) |
Asset Catalog: introduce `AssetCatalogPath` class
So far we have used `std::string` for asset catalog paths. Some
operations are better described on a dedicated class for this, though.
This commits switches catalog paths from using `std::string` to a
dedicated `blender::bke::AssetCatalogPath` class.
The `using CatalogPath = AssetCatalogPath` alias is still there, and
will be removed in a following cleanup commit.
New `AssetCatalogPath` code reviewed by @severin in D12710.
Diffstat (limited to 'source/blender/blenkernel/BKE_asset_catalog.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_asset_catalog.hh | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh index 05db3c808cf..c141ce5fca0 100644 --- a/source/blender/blenkernel/BKE_asset_catalog.hh +++ b/source/blender/blenkernel/BKE_asset_catalog.hh @@ -30,6 +30,8 @@ #include "BLI_uuid.h" #include "BLI_vector.hh" +#include "BKE_asset_catalog_path.hh" + #include <map> #include <memory> #include <set> @@ -38,7 +40,7 @@ namespace blender::bke { using CatalogID = bUUID; -using CatalogPath = std::string; +using CatalogPath = AssetCatalogPath; using CatalogPathComponent = std::string; /* Would be nice to be able to use `std::filesystem::path` for this, but it's currently not * available on the minimum macOS target version. */ @@ -52,7 +54,6 @@ class AssetCatalogTree; * directory hierarchy). */ class AssetCatalogService { public: - static const char PATH_SEPARATOR; static const CatalogFilePath DEFAULT_CATALOG_FILENAME; public: @@ -298,22 +299,12 @@ class AssetCatalog { } flags; /** - * \return true only if this catalog's path is contained within the given path. - * When this catalog's path is equal to the given path, return true as well. - * - * Note that non-normalized paths (so for example starting or ending with a slash) are not - * supported, and result in undefined behavior. - */ - bool is_contained_in(const CatalogPath &other_path) const; - - /** * Create a new Catalog with the given path, auto-generating a sensible catalog simple-name. * * NOTE: the given path will be cleaned up (trailing spaces removed, etc.), so the returned * `AssetCatalog`'s path differ from the given one. */ static std::unique_ptr<AssetCatalog> from_path(const CatalogPath &path); - static CatalogPath cleanup_path(const CatalogPath &path); protected: /** Generate a sensible catalog ID for the given path. */ |