Atmosphere/libraries/libvapours/include/vapours/util/util_uuid.hpp
2019-12-10 15:13:00 +11:00

43 lines
1.3 KiB
C++

/*
* Copyright (c) 2018-2019 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstring>
#include <switch.h>
namespace ams::util {
struct Uuid {
u8 uuid[0x10];
bool operator==(const Uuid& other) const {
return memcmp(this->uuid, other.uuid, sizeof(Uuid)) == 0;
}
bool operator!=(const Uuid& other) const {
return !(*this == other);
}
u8& operator[](size_t i) {
return uuid[i];
}
};
static_assert(sizeof(Uuid) == 0x10, "Uuid definition!");
static constexpr Uuid InvalidUuid = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
}