Unified interface for accessing resource labels with project overrides. More...
#include <resource_labels.h>
Public Types | |
| using | LabelMap = std::unordered_map<std::string, std::string> |
| using | ProjectLabels = std::unordered_map<std::string, LabelMap> |
Public Member Functions | |
| ResourceLabelProvider ()=default | |
| void | SetProjectLabels (ProjectLabels *labels) |
| Set the project labels reference (typically from YazeProject) | |
| std::string | GetLabel (ResourceType type, int id) const |
| Get a label for a resource by type and ID. | |
| std::string | GetLabel (const std::string &type_str, int id) const |
| Get a label using string type key (for compatibility) | |
| void | SetProjectLabel (ResourceType type, int id, const std::string &label) |
| Set a project-specific label override. | |
| void | ClearProjectLabel (ResourceType type, int id) |
| Clear a project-specific label (revert to default) | |
| bool | HasProjectLabel (ResourceType type, int id) const |
| Check if a project-specific label exists. | |
| std::string | GetVanillaLabel (ResourceType type, int id) const |
| Get the vanilla (default) label for a resource. | |
| std::string | GetHMagicLabel (ResourceType type, int id) const |
| Get the Hyrule Magic label for a resource (sprites only) | |
| void | SetPreferHMagicNames (bool prefer) |
| Set whether to prefer Hyrule Magic sprite names. | |
| bool | PreferHMagicNames () const |
| Get whether Hyrule Magic names are preferred. | |
| absl::Status | ImportFromZScreamFormat (const std::string &content) |
| Import labels from ZScream DefaultNames.txt format. | |
| std::string | ExportToZScreamFormat () const |
| Export project labels to ZScream DefaultNames.txt format. | |
| int | GetResourceCount (ResourceType type) const |
| Get the count of resources for a given type. | |
| const LabelMap * | GetProjectLabelsForType (ResourceType type) const |
| Get all project labels for a given type. | |
| void | ClearAllProjectLabels () |
| Clear all project labels. | |
| const ProjectLabels * | GetAllProjectLabels () const |
| Get all project labels (read-only) | |
Private Member Functions | |
| bool | ParseZScreamLine (const std::string &line, const std::string §ion, int &line_index) |
Private Attributes | |
| ProjectLabels * | project_labels_ = nullptr |
| bool | prefer_hmagic_ = true |
Unified interface for accessing resource labels with project overrides.
This class provides a centralized way to access resource labels (names) for various game resources. It supports:
Resolution Priority: Project Labels -> Hyrule Magic (if enabled) -> Vanilla
Definition at line 56 of file resource_labels.h.
| using yaze::zelda3::ResourceLabelProvider::LabelMap = std::unordered_map<std::string, std::string> |
Definition at line 58 of file resource_labels.h.
| using yaze::zelda3::ResourceLabelProvider::ProjectLabels = std::unordered_map<std::string, LabelMap> |
Definition at line 59 of file resource_labels.h.
|
default |
|
inline |
Set the project labels reference (typically from YazeProject)
Definition at line 66 of file resource_labels.h.
References project_labels_.
| std::string yaze::zelda3::ResourceLabelProvider::GetLabel | ( | ResourceType | type, |
| int | id ) const |
Get a label for a resource by type and ID.
| type | The resource type |
| id | The numeric ID of the resource |
Resolution order:
Definition at line 96 of file resource_labels.cc.
References GetHMagicLabel(), GetVanillaLabel(), yaze::zelda3::kSprite, prefer_hmagic_, project_labels_, and yaze::zelda3::ResourceTypeToString().
Referenced by ExportToZScreamFormat(), yaze::zelda3::GetEntranceLabel(), yaze::zelda3::GetItemLabel(), GetLabel(), yaze::zelda3::GetMusicLabel(), yaze::zelda3::GetOverlordLabel(), yaze::zelda3::GetOverworldMapLabel(), yaze::zelda3::GetRoomLabel(), yaze::zelda3::GetRoomTagLabel(), yaze::zelda3::GetSpriteLabel(), and yaze::zelda3::ResolveSpriteName().

| std::string yaze::zelda3::ResourceLabelProvider::GetLabel | ( | const std::string & | type_str, |
| int | id ) const |
Get a label using string type key (for compatibility)
Definition at line 122 of file resource_labels.cc.
References GetLabel(), and yaze::zelda3::StringToResourceType().

| void yaze::zelda3::ResourceLabelProvider::SetProjectLabel | ( | ResourceType | type, |
| int | id, | ||
| const std::string & | label ) |
Set a project-specific label override.
Definition at line 128 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| void yaze::zelda3::ResourceLabelProvider::ClearProjectLabel | ( | ResourceType | type, |
| int | id ) |
Clear a project-specific label (revert to default)
Definition at line 137 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| bool yaze::zelda3::ResourceLabelProvider::HasProjectLabel | ( | ResourceType | type, |
| int | id ) const |
Check if a project-specific label exists.
Definition at line 148 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| std::string yaze::zelda3::ResourceLabelProvider::GetVanillaLabel | ( | ResourceType | type, |
| int | id ) const |
Get the vanilla (default) label for a resource.
Definition at line 160 of file resource_labels.cc.
References yaze::zelda3::Zelda3Labels::GetEntranceNames(), yaze::zelda3::Zelda3Labels::GetGraphicsSheetNames(), yaze::zelda3::Zelda3Labels::GetItemNames(), yaze::zelda3::Zelda3Labels::GetMusicTrackNames(), yaze::zelda3::Zelda3Labels::GetOverlordNames(), yaze::zelda3::Zelda3Labels::GetOverworldMapNames(), yaze::zelda3::Zelda3Labels::GetRoomEffectNames(), yaze::zelda3::Zelda3Labels::GetRoomNames(), yaze::zelda3::Zelda3Labels::GetRoomTagNames(), yaze::zelda3::Zelda3Labels::GetSpriteNames(), yaze::zelda3::Zelda3Labels::GetTileTypeNames(), yaze::zelda3::kEntrance, yaze::zelda3::kGraphics, yaze::zelda3::kItem, yaze::zelda3::kMusic, yaze::zelda3::kOverlord, yaze::zelda3::kOverworldMap, yaze::zelda3::kRoom, yaze::zelda3::kRoomEffect, yaze::zelda3::kRoomTag, yaze::zelda3::kSprite, and yaze::zelda3::kTileType.
Referenced by GetLabel().
| std::string yaze::zelda3::ResourceLabelProvider::GetHMagicLabel | ( | ResourceType | type, |
| int | id ) const |
Get the Hyrule Magic label for a resource (sprites only)
Definition at line 244 of file resource_labels.cc.
References yaze::zelda3::kSprite, yaze::zelda3::kSpriteNameCount, and yaze::zelda3::kSpriteNames.
Referenced by GetLabel().
|
inline |
Set whether to prefer Hyrule Magic sprite names.
Definition at line 118 of file resource_labels.h.
References prefer_hmagic_.
Referenced by yaze::zelda3::SetPreferHmagicSpriteNames().
|
inline |
Get whether Hyrule Magic names are preferred.
Definition at line 123 of file resource_labels.h.
References prefer_hmagic_.
Referenced by yaze::zelda3::PreferHmagicSpriteNames().
| absl::Status yaze::zelda3::ResourceLabelProvider::ImportFromZScreamFormat | ( | const std::string & | content | ) |
Import labels from ZScream DefaultNames.txt format.
| content | The file content to parse |
Parses sections:
Definition at line 309 of file resource_labels.cc.
References ParseZScreamLine(), and project_labels_.

| std::string yaze::zelda3::ResourceLabelProvider::ExportToZScreamFormat | ( | ) | const |
Export project labels to ZScream DefaultNames.txt format.
Definition at line 416 of file resource_labels.cc.
References GetLabel(), GetResourceCount(), yaze::zelda3::kItem, yaze::zelda3::kRoom, yaze::zelda3::kRoomTag, and yaze::zelda3::kSprite.

| int yaze::zelda3::ResourceLabelProvider::GetResourceCount | ( | ResourceType | type | ) | const |
Get the count of resources for a given type.
Definition at line 258 of file resource_labels.cc.
References yaze::zelda3::Zelda3Labels::GetGraphicsSheetNames(), yaze::zelda3::Zelda3Labels::GetItemNames(), yaze::zelda3::Zelda3Labels::GetMusicTrackNames(), yaze::zelda3::Zelda3Labels::GetOverlordNames(), yaze::zelda3::Zelda3Labels::GetRoomEffectNames(), yaze::zelda3::Zelda3Labels::GetRoomTagNames(), yaze::zelda3::Zelda3Labels::GetTileTypeNames(), yaze::zelda3::kEntrance, yaze::zelda3::kGraphics, yaze::zelda3::kItem, yaze::zelda3::kMusic, yaze::zelda3::kOverlord, yaze::zelda3::kOverworldMap, yaze::zelda3::kRoom, yaze::zelda3::kRoomEffect, yaze::zelda3::kRoomTag, yaze::zelda3::kSprite, and yaze::zelda3::kTileType.
Referenced by ExportToZScreamFormat().
| const ResourceLabelProvider::LabelMap * yaze::zelda3::ResourceLabelProvider::GetProjectLabelsForType | ( | ResourceType | type | ) | const |
Get all project labels for a given type.
Definition at line 287 of file resource_labels.cc.
References project_labels_, and yaze::zelda3::ResourceTypeToString().

| void yaze::zelda3::ResourceLabelProvider::ClearAllProjectLabels | ( | ) |
Clear all project labels.
Definition at line 299 of file resource_labels.cc.
References project_labels_.
|
inline |
Get all project labels (read-only)
Definition at line 170 of file resource_labels.h.
References project_labels_.
|
private |
Definition at line 349 of file resource_labels.cc.
References project_labels_.
Referenced by ImportFromZScreamFormat().
|
private |
Definition at line 174 of file resource_labels.h.
Referenced by ClearAllProjectLabels(), ClearProjectLabel(), GetAllProjectLabels(), GetLabel(), GetProjectLabelsForType(), HasProjectLabel(), ImportFromZScreamFormat(), ParseZScreamLine(), SetProjectLabel(), and SetProjectLabels().
|
private |
Definition at line 177 of file resource_labels.h.
Referenced by GetLabel(), PreferHMagicNames(), and SetPreferHMagicNames().