|
Blender V4.3
|
#include <asset_catalog_definition_file.hh>
Inherited by blender::asset_system::tests::TestableAssetCatalogDefinitionFile.
Public Types | |
| using | AssetCatalogParsedFn = FunctionRef<bool(std::unique_ptr<AssetCatalog>)> |
Public Member Functions | |
| AssetCatalogDefinitionFile (const CatalogFilePath &file_path) | |
| bool | write_to_disk () const |
| bool | write_to_disk (const CatalogFilePath &dest_file_path) const |
| bool | contains (CatalogID catalog_id) const |
| void | add_overwrite (AssetCatalog *catalog) |
| void | add_new (AssetCatalog *catalog) |
| void | forget (CatalogID catalog_id) |
| void | parse_catalog_file (const CatalogFilePath &catalog_definition_file_path, AssetCatalogParsedFn catalog_loaded_callback) |
| std::unique_ptr< AssetCatalogDefinitionFile > | copy_and_remap (const OwningAssetCatalogMap &catalogs, const OwningAssetCatalogMap &deleted_catalogs) const |
Public Attributes | |
| const CatalogFilePath | file_path |
Static Public Attributes | |
| static const int | SUPPORTED_VERSION = 1 |
| static const std::string | VERSION_MARKER = "VERSION " |
| static const std::string | HEADER |
Protected Member Functions | |
| bool | parse_version_line (StringRef line) |
| std::unique_ptr< AssetCatalog > | parse_catalog_line (StringRef line) |
| bool | write_to_disk_unsafe (const CatalogFilePath &dest_file_path) const |
| bool | ensure_directory_exists (const CatalogFilePath &directory_path) const |
Protected Attributes | |
| Map< CatalogID, AssetCatalog * > | catalogs_ |
Keeps track of which catalogs are defined in a certain file on disk. Only contains non-owning pointers to the #AssetCatalog instances, so ensure the lifetime of this class is shorter than that of the #AssetCatalogs themselves.
Definition at line 24 of file asset_catalog_definition_file.hh.
| using blender::asset_system::AssetCatalogDefinitionFile::AssetCatalogParsedFn = FunctionRef<bool(std::unique_ptr<AssetCatalog>)> |
Definition at line 68 of file asset_catalog_definition_file.hh.
| blender::asset_system::AssetCatalogDefinitionFile::AssetCatalogDefinitionFile | ( | const CatalogFilePath & | file_path | ) |
Definition at line 154 of file asset_catalog_definition_file.cc.
| void blender::asset_system::AssetCatalogDefinitionFile::add_new | ( | AssetCatalog * | catalog | ) |
Add a new catalog. Undefined behavior if a catalog with the same ID was already added.
Definition at line 37 of file asset_catalog_definition_file.cc.
References blender::asset_system::AssetCatalog::catalog_id, and catalogs_.
Referenced by blender::asset_system::tests::TEST_F().
| void blender::asset_system::AssetCatalogDefinitionFile::add_overwrite | ( | AssetCatalog * | catalog | ) |
Add a catalog, overwriting the one with the same catalog ID.
Definition at line 42 of file asset_catalog_definition_file.cc.
References blender::asset_system::AssetCatalog::catalog_id, and catalogs_.
Referenced by parse_catalog_file().
| bool blender::asset_system::AssetCatalogDefinitionFile::contains | ( | CatalogID | catalog_id | ) | const |
Definition at line 32 of file asset_catalog_definition_file.cc.
References catalogs_.
Referenced by blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), and blender::asset_system::tests::TEST_F().
| std::unique_ptr< AssetCatalogDefinitionFile > blender::asset_system::AssetCatalogDefinitionFile::copy_and_remap | ( | const OwningAssetCatalogMap & | catalogs, |
| const OwningAssetCatalogMap & | deleted_catalogs ) const |
Definition at line 261 of file asset_catalog_definition_file.cc.
References BLI_assert_msg, catalogs_, copy(), and blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr().
|
protected |
Definition at line 225 of file asset_catalog_definition_file.cc.
References BLI_dir_create_recursive(), BLI_exists(), and BLI_is_dir().
Referenced by write_to_disk_unsafe().
| void blender::asset_system::AssetCatalogDefinitionFile::forget | ( | CatalogID | catalog_id | ) |
Remove the catalog from the collection of catalogs stored in this file.
Definition at line 47 of file asset_catalog_definition_file.cc.
References catalogs_.
| void blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_file | ( | const CatalogFilePath & | catalog_definition_file_path, |
| AssetCatalogParsedFn | catalog_loaded_callback ) |
Definition at line 52 of file asset_catalog_definition_file.cc.
References add_overwrite(), CLOG_ERROR, blender::StringRefBase::is_empty(), LOG, parse_catalog_line(), parse_version_line(), and blender::StringRefBase::trim().
Referenced by blender::asset_system::AssetCatalogService::reload_catalogs().
|
protected |
Definition at line 111 of file asset_catalog_definition_file.cc.
References BLI_uuid_parse_string(), blender::asset_system::AssetCatalogPath::cleanup(), file_path, blender::StringRefBase::find_first_of(), blender::StringRefBase::not_found, blender::StringRefBase::substr(), and blender::StringRefBase::trim().
Referenced by parse_catalog_file().
|
protected |
Definition at line 98 of file asset_catalog_definition_file.cc.
References SUPPORTED_VERSION, and VERSION_MARKER.
Referenced by parse_catalog_file().
| bool blender::asset_system::AssetCatalogDefinitionFile::write_to_disk | ( | ) | const |
Write the catalog definitions to the same file they were read from. Return true when the file was written correctly, false when there was a problem.
Definition at line 159 of file asset_catalog_definition_file.cc.
References BLI_assert_msg, file_path, and write_to_disk().
Referenced by blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), and write_to_disk().
| bool blender::asset_system::AssetCatalogDefinitionFile::write_to_disk | ( | const CatalogFilePath & | dest_file_path | ) | const |
Write the catalog definitions to an arbitrary file path.
Any existing file is backed up to "filename~". Any previously existing backup is overwritten.
Return true when the file was written correctly, false when there was a problem.
Definition at line 165 of file asset_catalog_definition_file.cc.
References BLI_exists(), BLI_rename_overwrite(), and write_to_disk_unsafe().
|
protected |
Write the catalog definitions to the given file path. Return true when the file was written correctly, false when there was a problem.
Definition at line 188 of file asset_catalog_definition_file.cc.
References BLI_path_split_dir_part(), catalogs_, ensure_directory_exists(), HEADER, output, PATH_MAX, SUPPORTED_VERSION, and VERSION_MARKER.
Referenced by write_to_disk().
|
protected |
Definition at line 28 of file asset_catalog_definition_file.hh.
Referenced by add_new(), add_overwrite(), contains(), copy_and_remap(), forget(), blender::asset_system::tests::TestableAssetCatalogDefinitionFile::get_catalogs(), and write_to_disk_unsafe().
| const CatalogFilePath blender::asset_system::AssetCatalogDefinitionFile::file_path |
Definition at line 40 of file asset_catalog_definition_file.hh.
Referenced by parse_catalog_line(), blender::asset_system::AssetCatalogService::reload_catalogs(), blender::asset_system::tests::AssetCatalogTest::save_from_memory_into_existing_asset_lib(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), and write_to_disk().
|
static |
Definition at line 38 of file asset_catalog_definition_file.hh.
Referenced by write_to_disk_unsafe().
|
static |
Definition at line 33 of file asset_catalog_definition_file.hh.
Referenced by parse_version_line(), and write_to_disk_unsafe().
|
static |
Definition at line 37 of file asset_catalog_definition_file.hh.
Referenced by parse_version_line(), and write_to_disk_unsafe().