3
0

LocalUserProfile.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzFramework/Input/User/LocalUserId.h>
  10. #include <AzCore/Memory/SystemAllocator.h>
  11. #include <AzCore/std/smart_ptr/make_shared.h>
  12. #include <AzCore/std/string/string.h>
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////
  14. namespace LocalUser
  15. {
  16. ////////////////////////////////////////////////////////////////////////////////////////////////
  17. //! Abstract class that represents a local user profile, uniquely identified by a local user id.
  18. //! Please note that on some platforms there does not exist any concept of a local user profile.
  19. class LocalUserProfile
  20. {
  21. public:
  22. ////////////////////////////////////////////////////////////////////////////////////////////
  23. // Allocator
  24. AZ_CLASS_ALLOCATOR(LocalUserProfile, AZ::SystemAllocator);
  25. ////////////////////////////////////////////////////////////////////////////////////////////
  26. // Type Info
  27. AZ_RTTI(LocalUserProfile, "{2A681065-FA77-46CF-9533-04D6C5C5EAF0}");
  28. ////////////////////////////////////////////////////////////////////////////////////////////
  29. //! Constructor
  30. //! \param[in] localUserId The local user id that uniquely identifies the local user profile
  31. explicit LocalUserProfile(AzFramework::LocalUserId locaUserId) : m_locaUserId(locaUserId) {}
  32. ////////////////////////////////////////////////////////////////////////////////////////////
  33. //! Default destructor
  34. virtual ~LocalUserProfile() = default;
  35. ////////////////////////////////////////////////////////////////////////////////////////////
  36. //! Get the local user id that uniquely identifies this local user profile on the system.
  37. //! \return The local user id that uniquely identifies this local user profile on the system.
  38. inline AzFramework::LocalUserId GetLocalUserId() const { return m_locaUserId; }
  39. ////////////////////////////////////////////////////////////////////////////////////////////
  40. //! Query whether this local user profile is currently signed in.
  41. //! \return True if this local user profile is currently signed in, false otherwise.
  42. virtual bool IsSignedIn() const = 0;
  43. ////////////////////////////////////////////////////////////////////////////////////////////
  44. //! Query the user name associated with this local user profile.
  45. //! \return A UTF-8 string containing this local user's user name.
  46. virtual AZStd::string GetUserName() const = 0;
  47. private:
  48. ////////////////////////////////////////////////////////////////////////////////////////////
  49. //! The local user id that uniquely identifies this local user profile.
  50. const AzFramework::LocalUserId m_locaUserId = AzFramework::LocalUserIdNone;
  51. };
  52. } // namespace LocalUser