refactoring
Co-authored-by: n.fedorov <mail@nfedorov.dev> Co-committed-by: n.fedorov <mail@nfedorov.dev>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// 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
|
||||
Reference in New Issue
Block a user