From 0b6f8ba51e61792ea23a55394a963d0961a9906f Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 12 Aug 2018 01:34:22 +1000 Subject: Code cleanup for profile manager --- src/core/hle/service/acc/profile_manager.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/core/hle/service/acc/profile_manager.h') diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index 1815d520d..d86a7a226 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h @@ -5,6 +5,7 @@ #pragma once #include +#include "boost/optional.hpp" #include "common/common_types.h" #include "common/swap.h" #include "core/hle/result.h" @@ -82,15 +83,17 @@ public: ResultCode AddUser(ProfileInfo user); ResultCode CreateNewUser(UUID uuid, std::array& username); ResultCode CreateNewUser(UUID uuid, const std::string& username); - size_t GetUserIndex(const UUID& uuid) const; - size_t GetUserIndex(ProfileInfo user) const; - bool GetProfileBase(size_t index, ProfileBase& profile) const; + boost::optional GetUserIndex(const UUID& uuid) const; + boost::optional GetUserIndex(ProfileInfo user) const; + bool GetProfileBase(boost::optional index, ProfileBase& profile) const; bool GetProfileBase(UUID uuid, ProfileBase& profile) const; bool GetProfileBase(ProfileInfo user, ProfileBase& profile) const; - bool GetProfileBaseAndData(size_t index, ProfileBase& profile, std::array& data); - bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, std::array& data); + bool GetProfileBaseAndData(boost::optional index, ProfileBase& profile, + std::array& data) const; + bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, + std::array& data) const; bool GetProfileBaseAndData(ProfileInfo user, ProfileBase& profile, - std::array& data); + std::array& data) const; size_t GetUserCount() const; size_t GetOpenUserCount() const; bool UserExists(UUID uuid) const; @@ -105,10 +108,9 @@ public: private: std::array profiles{}; size_t user_count = 0; - size_t AddToProfiles(const ProfileInfo& profile); - bool RemoveProfileAtIdx(size_t index); + boost::optional AddToProfiles(const ProfileInfo& profile); + bool RemoveProfileAtIndex(size_t index); UUID last_opened_user{0, 0}; }; -using ProfileManagerPtr = std::unique_ptr; }; // namespace Service::Account -- cgit v1.2.3