37 lines
957 B
C++
37 lines
957 B
C++
// Copyright (C) 2024-2026 NXST contributors
|
|
#pragma once
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <switch.h>
|
|
|
|
// Hash and comparison support for AccountUid as map/unordered_map key.
|
|
namespace std {
|
|
template <> struct hash<AccountUid> {
|
|
size_t operator()(const AccountUid& a) const noexcept {
|
|
return (hash<u64>()(a.uid[0]) ^ (hash<u64>()(a.uid[1]) << 1)) >> 1;
|
|
}
|
|
};
|
|
} // namespace std
|
|
|
|
inline bool operator==(const AccountUid& x, const AccountUid& y) {
|
|
return x.uid[0] == y.uid[0] && x.uid[1] == y.uid[1];
|
|
}
|
|
|
|
inline bool operator<(const AccountUid& x, const AccountUid& y) {
|
|
return x.uid[0] != y.uid[0] ? x.uid[0] < y.uid[0] : x.uid[1] < y.uid[1];
|
|
}
|
|
|
|
struct User {
|
|
AccountUid id;
|
|
std::string name;
|
|
};
|
|
|
|
namespace Account {
|
|
Result init();
|
|
void exit();
|
|
std::vector<AccountUid> ids();
|
|
std::string username(AccountUid id);
|
|
std::string iconPath(AccountUid id);
|
|
} // namespace Account
|