refactor: warp everything in Cubed namespace

This commit is contained in:
2026-04-20 22:18:02 +08:00
parent 6c74f4582c
commit c2321a0a6e
49 changed files with 288 additions and 66 deletions

View File

@@ -3,18 +3,20 @@
#include <Cubed/tools/cubed_assert.hpp>
#include <Cubed/tools/cubed_hash.hpp>
namespace Cubed {
std::unordered_map<unsigned, std::string> MapTable::id_to_name_map;
std::unordered_map<size_t, unsigned> MapTable::name_to_id_map;
const std::string& MapTable::get_name_from_id(unsigned id) {
auto it = id_to_name_map.find(id);
CUBED_ASSERT_MSG(it != id_to_name_map.end(), "Id: " + std::to_string(id) + " is not exist");
ASSERT_MSG(it != id_to_name_map.end(), "Id: " + std::to_string(id) + " is not exist");
return it->second;
}
const unsigned MapTable::get_id_from_name(const std::string& name) {
auto it = name_to_id_map.find(HASH::str(name));
CUBED_ASSERT_MSG(it != name_to_id_map.end(), "Name " + name + " is not exist");
ASSERT_MSG(it != name_to_id_map.end(), "Name " + name + " is not exist");
return it->second;
}
@@ -29,4 +31,5 @@ void MapTable::init_map() {
}
}