Loading...
Searching...
No Matches
FUniqueNetIdAccelByteUser Class Reference

Unique IDs to be used by the AccelByte online subsystem for users. This implementation follows a composite structure, where we not only store the AccelByte ID in a single structure, but also, optionally, the platform name and ID in the same structure. More...

#include <OnlineSubsystemAccelByteTypes.h>

Inheritance diagram for FUniqueNetIdAccelByteUser:
FUniqueNetIdAccelByteResource

Public Member Functions

virtual FName GetType () const override
 Return the type of this unique ID. In this case, it should always be ACCELBYTE_USER_ID_TYPE.
virtual bool IsValid () const override
 Whether or not this ID is a valid AccelByte UniqueNetId type. Will do a number of checks including:
virtual FString ToDebugString () const override
 Returns the JSON representation of AccelByte composite ID, useful for debugging.
FString GetAccelByteId () const
 Get the string representation of the AccelByte user ID from the composite ID.
FString GetPlatformType () const
 Get the string representation of the type of platform for platform ID from the composite ID.
FString GetPlatformId () const
 Get the string representation of the ID of the user for the platform type specified from the composite ID.
bool HasPlatformInformation () const
 Checks whether or not this composite ID has platform information included.
FUniqueNetIdPtr GetPlatformUniqueId () const
 Tries to convert the platform ID information into that native platform OSS' unique ID type.
FAccelByteUniqueIdComposite GetCompositeStructure () const
 Gets the underlying composite structure for this unique ID.
virtual bool Compare (FUniqueNetId const &Other) const override
 Override equal check operator to check the AccelByte ID first, and then the platform type/ID.

Static Public Member Functions

static FUniqueNetIdAccelByteUserRef Create (FAccelByteUniqueIdComposite const &InCompositeId)
 Create a new AccelByte User UniqueNetId instance from a composite ID.
static FUniqueNetIdAccelByteUserRef Create (FString const &InNetIdStr)
 Create a new AccelByte User UniqueNetId instance from a string of UniqueNetId.
static FUniqueNetIdAccelByteUserRef Create (FUniqueNetId const &InNetId)
 Create a new AccelByte User UniqueNetId instance from a generic UniqueNetId.
static FUniqueNetIdAccelByteUserRef Cast (FUniqueNetId const &InNetId)
 Takes an UniqueNetId object and converts it to an AccelByte User UniqueNetId instance if the type matches. Will return an Invalid ID reference if the conversion cannot be made. Prefer the other Cast methods if possible.
static FUniqueNetIdAccelByteUserPtr TryCast (FUniqueNetId const &InNetId)
 Attempts to convert an UniqueNetId object to an AccelByte User UniqueNetId instance. Will return nullptr if the cast cannot be made.
static FUniqueNetIdAccelByteUserPtr TryCast (FUniqueNetIdRef const &InNetId)
 Attempts to convert a shared reference of UniqueNetId object to an AccelByte User UniqueNetId instance. Will return nullptr if the cast cannot be made.
static FUniqueNetIdAccelByteUserRef Invalid ()
 Convenience method to construct an invalid instance of an AccelByte UniqueNetId.
static FUniqueNetIdAccelByteUserRef CastChecked (FUniqueNetId const &InNetId)
 Attempts to convert an UniqueNetId object to an AccelByte User UniqueNetId instance. Guarded by a check call that will crash if an improper ID is attempted to be casted.
static FUniqueNetIdAccelByteUserRef CastChecked (FUniqueNetIdRef const &InNetIdRef)
 Attempts to convert a shared reference of UniqueNetId object to an AccelByte User UniqueNetId instance. Guarded by a check call that will will crash if an improper ID is attempted to be casted.
Static Public Member Functions inherited from FUniqueNetIdAccelByteResource
template<typename... TArgs>
static FUniqueNetIdAccelByteResourceRef Create (TArgs &&... Args)
 Create a new AccelByte Resource UniqueNetId instance.
static FUniqueNetIdAccelByteResourceRef Cast (FUniqueNetId const &InNetId)
 Takes an UniqueNetId object and converts it to an AccelByte Resource UniqueNetId instance if the type matches. Will return an Invalid ID reference if the conversion cannot be made. Prefer the other Cast methods if possible.
static FUniqueNetIdAccelByteResourcePtr TryCast (FUniqueNetId const &InNetId)
 Attempts to convert an UniqueNetId object to an AccelByte Resource UniqueNetId instance. Will return nullptr if the cast cannot be made.
static FUniqueNetIdAccelByteResourcePtr TryCast (FUniqueNetIdRef const &InNetIdRef)
 Attempts to convert a shared reference of UniqueNetId object to an AccelByte Resource UniqueNetId instance. Will return nullptr if the cast cannot be made.
static FUniqueNetIdAccelByteResourceRef Invalid ()
 Convenience method to construct an invalid instance of AccelByte Resource UniqueNetId.
static FUniqueNetIdAccelByteResourceRef CastChecked (FUniqueNetIdRef const &InNetIdRef)
 Attempts to convert a shared reference of UniqueNetId object to an AccelByte Resource UniqueNetId instance. Guarded by a check call that will crash if an improper ID is attempted to be casted.

Public Attributes

PACKAGE_SCOPE : explicit FUniqueNetIdAccelByteUser(FAccelByteUniqueIdComposite const& CompositeId
PACKAGE_SCOPE FString const & EncodedComposite
Public Attributes inherited from FUniqueNetIdAccelByteResource
PACKAGE_SCOPE : static FUniqueNetIdAccelByteResourceRef CastChecked(FUniqueNetId const& InNetId)

Protected Member Functions

 FUniqueNetIdAccelByteUser ()
 Default constructor.
 FUniqueNetIdAccelByteUser (FString const &InNetIdStr)
 Internal constructor that accepts an UniqueNetId string.
 FUniqueNetIdAccelByteUser (FString &&InNetIdStr)
 Internal constructor that pass the ownership of UniqueNetId string.
 FUniqueNetIdAccelByteUser (FUniqueNetId const &InNetId)
 Internal constructor that accepts an instance of UniqueNetId.
 FUniqueNetIdAccelByteUser (FString const &InNetIdStr, FName const InType)
 Internal constructor that accepts an UniqueNetId string and its type name.
 FUniqueNetIdAccelByteUser (FString &&InNetIdStr, FName const InType)
 Internal constructor that accepts the ownership of UniqueNetId string and its type name.
Protected Member Functions inherited from FUniqueNetIdAccelByteResource
 FUniqueNetIdAccelByteResource ()
 Default constructor.
 FUniqueNetIdAccelByteResource (FString const &InNetIdStr)
 Internal constructor that accepts an UniqueNetId string.
 FUniqueNetIdAccelByteResource (FString &&InNetIdStr)
 Internal constructor that pass the ownership of UniqueNetId string.
 FUniqueNetIdAccelByteResource (FUniqueNetId const &InNetId)
 Internal constructor that accepts an instance of UniqueNetId.
 FUniqueNetIdAccelByteResource (FString const &InNetIdStr, FName const InType)
 Internal constructor that accepts an UniqueNetId string and its type name.
 FUniqueNetIdAccelByteResource (FString &&InNetIdStr, FName const InType)
 Internal constructor that accepts the ownership of UniqueNetId string and its type name.

Detailed Description

Unique IDs to be used by the AccelByte online subsystem for users. This implementation follows a composite structure, where we not only store the AccelByte ID in a single structure, but also, optionally, the platform name and ID in the same structure.

These IDs can be casted to and broken apart to get those IDs as needed, such as for interop with native platform SDKs.

For this, there will be three extra fields in an FUniqueNetIdAccelByte, which are as follows:

  • AccelByteIDString
  • PlatformTypeString
  • PlatformIDString

When any of these are set, the underlying string for FUniqueNetIdString is set to a Base64 encoded JSON object that contains all of these fields individually. An example of this JSON object is as follows: { "id": "<AccelByte ID>", "platformType": "<type of platform the platformId field corresponds to, can be blank>", "platformId": "<ID of the platform that platformType corresponds to, can be blank>" }

ToString will return the encoded version of this string, while ToDebugString will return the decoded version.

To get any of these fields from the ID, you will want to cast to an FUniqueNetIdAccelByte and use the getters there. However, most of the ID manipulation is handled for you by the OSS, so there shouldn't be a need to crack open these IDs unless you need to make SDK calls yourself.

Constructor & Destructor Documentation

◆ FUniqueNetIdAccelByteUser() [1/5]

FUniqueNetIdAccelByteUser::FUniqueNetIdAccelByteUser ( FString const & InNetIdStr)
explicitprotected

Internal constructor that accepts an UniqueNetId string.

Parameters
InNetIdStrThe UniqueNetId string.

◆ FUniqueNetIdAccelByteUser() [2/5]

FUniqueNetIdAccelByteUser::FUniqueNetIdAccelByteUser ( FString && InNetIdStr)
explicitprotected

Internal constructor that pass the ownership of UniqueNetId string.

Parameters
InNetIdStrThe UniqueNetId string.

◆ FUniqueNetIdAccelByteUser() [3/5]

FUniqueNetIdAccelByteUser::FUniqueNetIdAccelByteUser ( FUniqueNetId const & InNetId)
explicitprotected

Internal constructor that accepts an instance of UniqueNetId.

Parameters
InNetIdThe UniqueNetId object.

◆ FUniqueNetIdAccelByteUser() [4/5]

FUniqueNetIdAccelByteUser::FUniqueNetIdAccelByteUser ( FString const & InNetIdStr,
FName const InType )
explicitprotected

Internal constructor that accepts an UniqueNetId string and its type name.

Parameters
InNetIdStrThe UniqueNetId string.
InTypeThe type name of UniqueNetId.

◆ FUniqueNetIdAccelByteUser() [5/5]

FUniqueNetIdAccelByteUser::FUniqueNetIdAccelByteUser ( FString && InNetIdStr,
FName const InType )
explicitprotected

Internal constructor that accepts the ownership of UniqueNetId string and its type name.

Parameters
InNetIdStrThe UniqueNetId string.
InTypeThe type name of UniqueNetId.

Member Function Documentation

◆ Cast()

FUniqueNetIdAccelByteUserRef FUniqueNetIdAccelByteUser::Cast ( FUniqueNetId const & InNetId)
static

Takes an UniqueNetId object and converts it to an AccelByte User UniqueNetId instance if the type matches. Will return an Invalid ID reference if the conversion cannot be made. Prefer the other Cast methods if possible.

Parameters
InNetIdThe UniqueNetId object to attempt to convert to an AccelByte User UniqueNetId instance.
Returns
A shared reference of AccelByte User UniqueNetId object.

◆ CastChecked() [1/2]

FUniqueNetIdAccelByteUserRef FUniqueNetIdAccelByteUser::CastChecked ( FUniqueNetId const & InNetId)
static

Attempts to convert an UniqueNetId object to an AccelByte User UniqueNetId instance. Guarded by a check call that will crash if an improper ID is attempted to be casted.

Parameters
InNetIdThe UniqueNetId object that will be converted to AccelByte User UniqueNetId instance.
Returns
A shared reference of AccelByte User UniqueNetId object.

◆ CastChecked() [2/2]

FUniqueNetIdAccelByteUserRef FUniqueNetIdAccelByteUser::CastChecked ( FUniqueNetIdRef const & InNetIdRef)
static

Attempts to convert a shared reference of UniqueNetId object to an AccelByte User UniqueNetId instance. Guarded by a check call that will will crash if an improper ID is attempted to be casted.

Parameters
InNetIdRefThe shared reference of UniqueNetId object that will be converted to AccelByte User UniqueNetId instance.
Returns
A shared reference of AccelByte User UniqueNetId object.

◆ Compare()

bool FUniqueNetIdAccelByteUser::Compare ( FUniqueNetId const & Other) const
overridevirtual

Override equal check operator to check the AccelByte ID first, and then the platform type/ID.

Parameters
OtherAnother UniqueNetId object.
Returns
true if both object has the same ID and false if not the same

◆ Create() [1/3]

FUniqueNetIdAccelByteUserRef FUniqueNetIdAccelByteUser::Create ( FAccelByteUniqueIdComposite const & InCompositeId)
static

Create a new AccelByte User UniqueNetId instance from a composite ID.

Parameters
InCompositeIdThe AccelByte User UniqueNetId in composite structure.
Returns
A shared reference of AccelByte User UniqueNetId object.

◆ Create() [2/3]

FUniqueNetIdAccelByteUserRef FUniqueNetIdAccelByteUser::Create ( FString const & InNetIdStr)
static

Create a new AccelByte User UniqueNetId instance from a string of UniqueNetId.

Parameters
InNetIdStrThe UniqueNetId string.
Returns
A shared reference of AccelByte User UniqueNetId object.

◆ Create() [3/3]

FUniqueNetIdAccelByteUserRef FUniqueNetIdAccelByteUser::Create ( FUniqueNetId const & InNetId)
static

Create a new AccelByte User UniqueNetId instance from a generic UniqueNetId.

Parameters
InNetIdThe UniqueNetId object.
Returns
A shared reference of AccelByte User UniqueNetId object.

◆ GetAccelByteId()

FString FUniqueNetIdAccelByteUser::GetAccelByteId ( ) const

Get the string representation of the AccelByte user ID from the composite ID.

Returns
AccelByte ID in UUID format.

◆ GetCompositeStructure()

FAccelByteUniqueIdComposite FUniqueNetIdAccelByteUser::GetCompositeStructure ( ) const

Gets the underlying composite structure for this unique ID.

Returns
AccelByte Unique ID in composite structure.

◆ GetPlatformId()

FString FUniqueNetIdAccelByteUser::GetPlatformId ( ) const

Get the string representation of the ID of the user for the platform type specified from the composite ID.

Returns
Platform user ID.

◆ GetPlatformType()

FString FUniqueNetIdAccelByteUser::GetPlatformType ( ) const

Get the string representation of the type of platform for platform ID from the composite ID.

Returns
a string representation of the type of platform.

◆ GetPlatformUniqueId()

FUniqueNetIdPtr FUniqueNetIdAccelByteUser::GetPlatformUniqueId ( ) const

Tries to convert the platform ID information into that native platform OSS' unique ID type.

Returns
A pointer to Native Platform UniqueNetId.

◆ GetType()

FName FUniqueNetIdAccelByteUser::GetType ( ) const
overridevirtual

Return the type of this unique ID. In this case, it should always be ACCELBYTE_USER_ID_TYPE.

Returns
ACCELBYTE_USER_ID_TYPE.

Reimplemented from FUniqueNetIdAccelByteResource.

◆ HasPlatformInformation()

bool FUniqueNetIdAccelByteUser::HasPlatformInformation ( ) const

Checks whether or not this composite ID has platform information included.

Returns
true if composite ID has platform information and false if no platform information presents.

◆ Invalid()

FUniqueNetIdAccelByteUserRef FUniqueNetIdAccelByteUser::Invalid ( )
static

Convenience method to construct an invalid instance of an AccelByte UniqueNetId.

Returns
A shared reference of AccelByte User UniqueNetId object that has Invalid ID.

◆ IsValid()

bool FUniqueNetIdAccelByteUser::IsValid ( ) const
overridevirtual

Whether or not this ID is a valid AccelByte UniqueNetId type. Will do a number of checks including:

  • Whether the underlying string value is Base64
  • Whether upon decoding the string value there is a JSON object with id, platformType, and platformId fields
  • Whether the id field in the JSON object is in the correct format for an AccelByte ID

Reimplemented from FUniqueNetIdAccelByteResource.

◆ ToDebugString()

FString FUniqueNetIdAccelByteUser::ToDebugString ( ) const
overridevirtual

Returns the JSON representation of AccelByte composite ID, useful for debugging.

Returns
a string of JSON representation of the composite ID.

◆ TryCast() [1/2]

FUniqueNetIdAccelByteUserPtr FUniqueNetIdAccelByteUser::TryCast ( FUniqueNetId const & InNetId)
static

Attempts to convert an UniqueNetId object to an AccelByte User UniqueNetId instance. Will return nullptr if the cast cannot be made.

Parameters
InNetIdThe UniqueNetId object to attempt to convert to an AccelByte User UniqueNetId instance.
Returns
A shared pointer of AccelByte User UniqueNetId object.

◆ TryCast() [2/2]

FUniqueNetIdAccelByteUserPtr FUniqueNetIdAccelByteUser::TryCast ( FUniqueNetIdRef const & InNetId)
static

Attempts to convert a shared reference of UniqueNetId object to an AccelByte User UniqueNetId instance. Will return nullptr if the cast cannot be made.

Parameters
InNetIdThe shared reference of UniqueNetId object to attempt to convert to an AccelByte User UniqueNetId instance.
Returns
A shared pointer of AccelByte User UniqueNetId object.