Engine → Assets → asset_importer.h
importer_registry
| Type | Class |
| Namespace | conjure::assets |
| Include File Path | engine/include/conjure/assets/asset_importer.h |
| Source File Path | engine/src/assets/asset_importer.cpp |
| API ↗ | Database, importers and hot reload, Assets |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | importer_registry(); |
Important
Copy constructor and assignment has been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~importer_registry(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mImporters | std:: | {} | |
| private | m | std::atomic<u32> | 0 | |
| private | mView | std:: | {} |
Functions
Public
begin_imports
begin_importsvoid begin_imports() noexcept;Marks the start and end of an import batch; unregister_importer is refused between them. Used by asset_database.
end_imports
end_importsvoid end_imports() noexcept;find
find[[nodiscard]] const asset_importer *find(
std::string_view id) const noexcept;find_for_extension
find_for_extension[[nodiscard]] const asset_importer *find_for_extension(
std::string_view extension) const noexcept;The importer handling an extension, matched ignoring case; the dot is optional.
find_for_path
find_for_path[[nodiscard]] const asset_importer *find_for_path(
std::string_view path) const noexcept;The importer whose registered extension is the longest suffix of the path's file name, ignoring case, so a ".scene.json" importer wins over a ".json" one for "main.scene.json". nullptr when no extension matches. An extension registered without its dot ("json") matches the same names as the dotted spelling. A suffix never consumes the whole file name: a leading dot is part of the name (path_utils), so ".scene.json" matches ".json" and ".json" matches nothing.
importers
importers[[nodiscard]] std::span<const asset_importer *const> importers() const noexcept;Every importer in registration order.
imports_in_flight
imports_in_flight[[nodiscard]] u32 imports_in_flight() const noexcept;register_importer
register_importer[[nodiscard]] core::result<void> register_importer(
std::unique_ptr<asset_importer> importer);ALREADY_EXISTS when an importer with the same id is registered; INVALID_ARGUMENT for a null importer or an empty id. An extension another importer already claims is accepted with a WARN naming both: the earlier importer stays the one chosen by extension and the new one applies only to a file whose .meta names it.
unregister_importer
unregister_importer[[nodiscard]] core::result<void> unregister_importer(
std::string_view id);NOT_FOUND (core) for an unknown id; INVALID_STATE while imports are in flight.