DiscIO: Use std::optional for GetTitleID instead of pointer

This makes the interface slightly cleaner and a bit more consistent
with the other getters. Still not fully the same, since the others
don't really handle failures with std::optional; but at least the
value is returned by value now, as opposed to having the function
take a pointer to a u64.
This commit is contained in:
Léo Lam
2017-06-03 21:29:08 +02:00
parent 5d6074f157
commit 1a17c02d6f
9 changed files with 31 additions and 26 deletions

View File

@ -8,6 +8,7 @@
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
@ -53,8 +54,8 @@ public:
}
virtual std::vector<Partition> GetPartitions() const { return {{}}; }
virtual Partition GetGamePartition() const { return PARTITION_NONE; }
bool GetTitleID(u64* buffer) const { return GetTitleID(buffer, GetGamePartition()); }
virtual bool GetTitleID(u64* buffer, const Partition& partition) const { return false; }
std::optional<u64> GetTitleID() const { return GetTitleID(GetGamePartition()); }
virtual std::optional<u64> GetTitleID(const Partition& partition) const { return {}; }
virtual const IOS::ES::TicketReader& GetTicket(const Partition& partition) const
{
return INVALID_TICKET;