std::string GptPartitionTable::get_guid(const utils::ByteBuffer& bb, uint64_t _offset) { std::stringstream str{}; std::size_t offset = std::size_t(_offset); str << std::hex << std::uppercase << std::setfill('0'); str << std::setw(8) << bb.get_le32(offset + 0u) << "-" << std::setw(4) << bb.get_le16(offset + 4u) << "-" << std::setw(4) << bb.get_le16(offset + 6u) << "-" << std::setw(4) << bb.get_be16(offset + 8u) << "-" << std::setw(12) << bb.get_be48(offset + 10u); return str.str(); }
std::string GptPartitionTable::get_name(const utils::ByteBuffer& bb, uint64_t _offset) { std::stringstream str{}; std::size_t offset = std::size_t(_offset); for (unsigned i = 0; i < GPT_PARTITION_NAME_SIZE / 2; ++i) { // two bytes per one char uint8_t ch = uint8_t(bb.get_le16(offset + i * 2)); if (ch != 0) { str << ch; } } return str.str(); }