yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
palette_catalog.h
Go to the documentation of this file.
1#ifndef YAZE_CORE_PALETTE_CATALOG_H_
2#define YAZE_CORE_PALETTE_CATALOG_H_
3
4#include <filesystem>
5#include <string>
6#include <string_view>
7#include <vector>
8
9#include "absl/status/statusor.h"
10
11namespace yaze::core {
12
13// Context is required: an OBJ row is not a universal palette for an actor.
15 std::string name;
16 std::string context;
17 std::string use;
18 int obj_row = 0;
19 // Spriteset byte values, NOT Yaze gfx indices (gfx = sprite sheet + $73).
20 std::vector<int> sprite_sheets;
21 std::string source;
22};
23
25 std::string key;
26 std::string name;
27 std::string group;
28 int index = 0;
29 std::string world;
30 std::string use;
31 std::string description;
32 std::string provenance;
33 std::string ownership; // "rom" or "asm"; metadata, not a write permission.
34 std::vector<PaletteCatalogUsage> usages;
35};
36
37// Read-only project metadata. No ROM, palette-manager or singleton dependency.
39 public:
40 static absl::StatusOr<PaletteCatalog> Parse(std::string_view text);
41 // Catalogs must resolve within the descriptor's directory, including symlinks.
42 static absl::StatusOr<PaletteCatalog> LoadForProject(
43 const std::string& project_file, const std::string& catalog_file);
44 // Resolve without parsing, using the same containment rules as the loader.
45 static absl::StatusOr<std::filesystem::path> ResolvePathForProject(
46 const std::string& project_file, const std::string& catalog_file);
47 const std::vector<PaletteCatalogEntry>& entries() const { return entries_; }
48 std::vector<const PaletteCatalogEntry*> Filter(
49 std::string_view query, std::string_view world = {},
50 std::string_view use = {}) const;
51
52 private:
53 std::vector<PaletteCatalogEntry> entries_;
54};
55
56} // namespace yaze::core
57#endif // YAZE_CORE_PALETTE_CATALOG_H_
const std::vector< PaletteCatalogEntry > & entries() const
std::vector< const PaletteCatalogEntry * > Filter(std::string_view query, std::string_view world={}, std::string_view use={}) const
static absl::StatusOr< PaletteCatalog > Parse(std::string_view text)
static absl::StatusOr< std::filesystem::path > ResolvePathForProject(const std::string &project_file, const std::string &catalog_file)
std::vector< PaletteCatalogEntry > entries_
static absl::StatusOr< PaletteCatalog > LoadForProject(const std::string &project_file, const std::string &catalog_file)
std::vector< PaletteCatalogUsage > usages