mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
33 lines
989 B
C++
33 lines
989 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace Map
|
|
{
|
|
struct LevelKey
|
|
{
|
|
std::string stageId;
|
|
std::string code;
|
|
std::string levelId;
|
|
std::string name;
|
|
|
|
bool empty_or_equal(const std::string& lhs, const std::string& rhs) const noexcept
|
|
{
|
|
return (lhs.empty() || rhs.empty()) ? true : lhs == rhs;
|
|
}
|
|
bool operator==(const LevelKey& other) const noexcept
|
|
{
|
|
return empty_or_equal(stageId, other.stageId) && empty_or_equal(code, other.code) &&
|
|
empty_or_equal(levelId, other.levelId) && empty_or_equal(name, other.name);
|
|
}
|
|
bool operator==(const std::string& any_key) const noexcept
|
|
{
|
|
if (any_key.empty()) {
|
|
return false;
|
|
}
|
|
return empty_or_equal(stageId, any_key) || empty_or_equal(code, any_key) ||
|
|
empty_or_equal(levelId, any_key) || empty_or_equal(name, any_key);
|
|
}
|
|
};
|
|
}
|