yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
labeling.h
Go to the documentation of this file.
1#ifndef YAZE_APP_CORE_LABELING_H_
2#define YAZE_APP_CORE_LABELING_H_
3
4#include <cstdint>
5#include <fstream>
6#include <sstream>
7#include <string>
8#include <unordered_map>
9#include <vector>
10
11#include "absl/status/status.h"
12#include "absl/status/statusor.h"
13
14#include "app/core/constants.h"
15
16namespace yaze {
17namespace app {
18namespace core {
19
20std::string UppercaseHexByte(uint8_t byte, bool leading = false);
21std::string UppercaseHexWord(uint16_t word);
22std::string UppercaseHexLong(uint32_t dword);
23std::string UppercaseHexLongLong(uint64_t qword);
24
25bool StringReplace(std::string& str, const std::string& from,
26 const std::string& to);
27
28// Default types
29static constexpr absl::string_view kDefaultTypes[] = {
30 "Dungeon Names", "Dungeon Room Names", "Overworld Map Names"};
31
33 bool LoadLabels(const std::string& filename);
34 bool SaveLabels();
35 void DisplayLabels(bool* p_open);
36 void EditLabel(const std::string& type, const std::string& key,
37 const std::string& newValue);
38 void SelectableLabelWithNameEdit(bool selected, const std::string& type,
39 const std::string& key,
40 const std::string& defaultValue);
41 std::string GetLabel(const std::string& type, const std::string& key);
42 std::string CreateOrGetLabel(const std::string& type, const std::string& key,
43 const std::string& defaultValue);
44
45 bool labels_loaded_ = false;
46 std::string filename_;
47 struct ResourceType {
48 std::string key_name;
50 };
51
52 std::unordered_map<std::string, std::unordered_map<std::string, std::string>>
54};
55
56} // namespace core
57} // namespace app
58} // namespace yaze
59
60#endif // YAZE_APP_CORE_LABELING_H_
std::string UppercaseHexLongLong(uint64_t qword)
Definition labeling.cc:37
bool StringReplace(std::string &str, const std::string &from, const std::string &to)
Definition labeling.cc:42
std::string UppercaseHexWord(uint16_t word)
Definition labeling.cc:29
std::string UppercaseHexLong(uint32_t dword)
Definition labeling.cc:33
std::string UppercaseHexByte(uint8_t byte, bool leading)
Definition labeling.cc:21
Definition common.cc:21
std::string GetLabel(const std::string &type, const std::string &key)
Definition labeling.cc:157
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > labels_
Definition labeling.h:53
bool LoadLabels(const std::string &filename)
Definition labeling.cc:51
std::string CreateOrGetLabel(const std::string &type, const std::string &key, const std::string &defaultValue)
Definition labeling.cc:162
void EditLabel(const std::string &type, const std::string &key, const std::string &newValue)
Definition labeling.cc:127
void SelectableLabelWithNameEdit(bool selected, const std::string &type, const std::string &key, const std::string &defaultValue)
Definition labeling.cc:133