Operating System Simulator Plugin  3.5.1
Unreal Engine plugin that simulates an Operating System Environment
Loading...
Searching...
No Matches
UOperatingSystemUserManager Class Reference

Manager class for operating system users. More...

#include "OperatingSystemUserManager.h"

Inheritance diagram for UOperatingSystemUserManager:
[legend]
Collaboration diagram for UOperatingSystemUserManager:
[legend]

Public Member Functions

 UOperatingSystemUserManager ()
 
OPERATINGSYSTEMSIMULATOR_API bool FindUserByEmail (const FText &TestEmail, FOperatingSystemUser &OutUser)
 
OPERATINGSYSTEMSIMULATOR_API bool FindUserByUsername (const FText &TestUsername, FOperatingSystemUser &OutUser)
 
OPERATINGSYSTEMSIMULATOR_API bool CheckUserExistForOperatingSystem (const UOperatingSystem *TargetOS, const FOperatingSystemUser &TestUser, const bool bCheckByUsernameOnly) const
 
OPERATINGSYSTEMSIMULATOR_API bool CheckUserExist (const FOperatingSystemUser &TestUser, const bool bCheckByUsernameOnly) const
 
OPERATINGSYSTEMSIMULATOR_API bool HasUsers () const
 
OPERATINGSYSTEMSIMULATOR_API bool AuthorizeUser (const FText &Email, const FText &Password, FOperatingSystemUser &OutAuthorizedUser)
 
OPERATINGSYSTEMSIMULATOR_API void GetAllUsers (TArray< FOperatingSystemUser > &OutUsers) const
 
OPERATINGSYSTEMSIMULATOR_API bool CreateGenericUser (const FOperatingSystemUser &NewUser)
 
OPERATINGSYSTEMSIMULATOR_API bool CreateNewUser (UOperatingSystem *TargetOS, const FOperatingSystemUser &NewUser)
 Create a new user in the operating system.
 
OPERATINGSYSTEMSIMULATOR_API TSet< FOperatingSystemUserGetAllUsersForOS (const UOperatingSystem *TargetOS) const
 Retrieves all the users for a given operating system.
 
OPERATINGSYSTEMSIMULATOR_API bool UpdateUserDetails (UPARAM(ref) FOperatingSystemUser &TargetUser, const FOperatingSystemUser &UpdatedDetails)
 
OPERATINGSYSTEMSIMULATOR_API void ForEachUserInOS (const UOperatingSystem *TargetOS, const TFunctionRef< bool(const FOperatingSystemUser &)> Func) const
 
OPERATINGSYSTEMSIMULATOR_API void ForEachUserInOS (const UOperatingSystem *TargetOS, const TFunctionRef< bool(FOperatingSystemUser &)> Func)
 
OPERATINGSYSTEMSIMULATOR_API void ForEachUser (const TFunctionRef< bool(const FOperatingSystemUser &)> &Func) const
 
OPERATINGSYSTEMSIMULATOR_API void ForEachUser (const TFunctionRef< bool(FOperatingSystemUser &)> &Func)
 

Static Public Member Functions

static UOperatingSystemUserManagerCreateUserManager ()
 Create a new instance of the User Manager class. It checks if a save game file exists and loads it if found. If not, it creates a new instance and returns it.
 
static UOperatingSystemUserManagerGetUserManager (const UObject *WorldContextObject)
 Returns the user manager instance associated with the given WorldContextObject.
 
static OPERATINGSYSTEMSIMULATOR_API FString GetUserKey (const UOperatingSystem *TargetOS)
 Retrieves the user key for the specified operating system.
 

Protected Member Functions

void K2_OnUserCreated (const FOperatingSystemUser &CreatedUser)
 Blueprint implementable event called when a user is created.
 
void K2_OnUserUpdated (UPARAM(ref) FOperatingSystemUser &TargetUser, const FOperatingSystemUser &UpdatedDetails)
 BlueprintImplementableEvent called when a user's details are updated. The updated user details are provided as input parameters.
 

Protected Attributes

TMap< FString, FOperatingSystemUserManagerSaveDataUsers
 

Detailed Description

Manager class for operating system users.

This class manages the creation, retrieval, and modification of users in an operating system. It provides various methods for finding users, checking user existence, authorizing users, and performing user operations. Users are stored in a mapping structure where the key is the user's email and the value is the user's data. The class inherits from USaveGame to enable saving and loading of user data.

Constructor & Destructor Documentation

◆ UOperatingSystemUserManager()

UOperatingSystemUserManager::UOperatingSystemUserManager ( )

Member Function Documentation

◆ AuthorizeUser()

bool UOperatingSystemUserManager::AuthorizeUser ( const FText & Email,
const FText & Password,
FOperatingSystemUser & OutAuthorizedUser )

Authorizes a user by comparing the provided email and password with the stored user data.

Parameters
EmailThe email of the user to authorize.
PasswordThe password of the user to authorize.
OutAuthorizedUserThe authorized user object if the authorization is successful.
Returns
True if the user is authorized, false otherwise.
Here is the call graph for this function:

◆ CheckUserExist()

bool UOperatingSystemUserManager::CheckUserExist ( const FOperatingSystemUser & TestUser,
const bool bCheckByUsernameOnly ) const

Checks if a user exists in the operating system user manager. It can be used to verify if a user already exists before performing any operations related to user management.

Parameters
TestUserThe user to check for existence.
bCheckByUsernameOnlySpecifies whether to perform the existence check based on username only. Set to true to perform the check based on username only, or false to perform full user comparison.
Returns
True if the user exists, false otherwise.
Here is the call graph for this function:

◆ CheckUserExistForOperatingSystem()

bool UOperatingSystemUserManager::CheckUserExistForOperatingSystem ( const UOperatingSystem * TargetOS,
const FOperatingSystemUser & TestUser,
const bool bCheckByUsernameOnly ) const

Check if a user exists for the given operating system.

This method checks if the specified user exists for the specified operating system.

Parameters
TargetOSThe target operating system to check for user existence.
TestUserThe user object to compare against the operating system users.
bCheckByUsernameOnlyFlag indicating if the check should only be performed based on username. If this flag is true, the method will only check if the username of the TestUser matches any of the usernames in the operating system users. If this flag is false, the method will compare the entire TestUser object with each operating system user to determine if a match exists.
Returns
true if a match is found for the specified user, false otherwise.
Here is the call graph for this function:

◆ CreateGenericUser()

bool UOperatingSystemUserManager::CreateGenericUser ( const FOperatingSystemUser & NewUser)

Creates a generic user in the operating system user manager.

Parameters
NewUserThe operating system user to create.
Returns
True if the user was successfully created, false otherwise.

◆ CreateNewUser()

bool UOperatingSystemUserManager::CreateNewUser ( UOperatingSystem * TargetOS,
const FOperatingSystemUser & NewUser )

Create a new user in the operating system.

This method creates a new user in the specified operating system.

Parameters
TargetOSThe operating system in which to create the user.
NewUserThe user data of the new user.
Returns
True if the user is created successfully, false otherwise.
Here is the call graph for this function:

◆ CreateUserManager()

UOperatingSystemUserManager * UOperatingSystemUserManager::CreateUserManager ( )
static

Create a new instance of the User Manager class. It checks if a save game file exists and loads it if found. If not, it creates a new instance and returns it.

Returns
A pointer to UOperatingSystemUserManager instance.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindUserByEmail()

bool UOperatingSystemUserManager::FindUserByEmail ( const FText & TestEmail,
FOperatingSystemUser & OutUser )

Finds a user by email.

Searches for a user with the specified email and retrieves their information. If the email is empty or whitespace, an error will be logged and the method will return false. If the email matches the default email for the "No Reply" user, the "No Reply" user information will be returned. If a user with the specified email is found, their information will be stored in the OutUser parameter. If the found user's color is invalid, it will be updated and saved to the database.

Parameters
TestEmailThe email to search for.
OutUser[out] The user information if found.
Returns
True if a user was found and retrieved successfully, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindUserByUsername()

bool UOperatingSystemUserManager::FindUserByUsername ( const FText & TestUsername,
FOperatingSystemUser & OutUser )

Finds a user by their username.

This method searches for a user with the given username and populates the provided FOperatingSystemUser object with the found user's details.

Parameters
TestUsernameThe username to search for.
OutUserThe FOperatingSystemUser object to populate with the found user's details.
Returns
True if a user with the given username was found, false otherwise.
Note
This method handles certain special cases, such as an empty username or the default mail user.
The OutUser object will only be populated if a user with the given username is found.
If the found user's color is invalid, it will be updated and saved.
Here is the call graph for this function:

◆ ForEachUser() [1/2]

void UOperatingSystemUserManager::ForEachUser ( const TFunctionRef< bool(const FOperatingSystemUser &)> & Func) const

Applies a given function to each user in the operating system user manager.

The function receives a constant reference to an FOperatingSystemUser object and must return a boolean value. If the function returns true, the loop is stopped and no further users are processed.

Parameters
FuncA TFunctionRef object that represents the function to be applied to each user.
Here is the caller graph for this function:

◆ ForEachUser() [2/2]

void UOperatingSystemUserManager::ForEachUser ( const TFunctionRef< bool(FOperatingSystemUser &)> & Func)

Executes a lambda function for each user in the operating system user manager.

This method iterates over each user in the operating system user manager and executes the provided lambda function for each user. The lambda function should take a reference to an FOperatingSystemUser object as a parameter and return a boolean value indicating whether the iteration should stop or continue.

Parameters
FuncA lambda function that takes a reference to an FOperatingSystemUser object as a parameter and returns a boolean value.
Note
This method will stop iterating if the lambda function returns true.

◆ ForEachUserInOS() [1/2]

void UOperatingSystemUserManager::ForEachUserInOS ( const UOperatingSystem * TargetOS,
const TFunctionRef< bool(const FOperatingSystemUser &)> Func ) const

Executes a given function for each user in the specified operating system.

Parameters
TargetOSThe operating system for which the function should be executed.
FuncThe function to be executed for each user. It should accept a constant reference to an FOperatingSystemUser object and return a bool value.
Remarks
This method iterates through all the users in the specified operating system and executes the given function for each user. The function should return true to stop the iteration.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ForEachUserInOS() [2/2]

void UOperatingSystemUserManager::ForEachUserInOS ( const UOperatingSystem * TargetOS,
const TFunctionRef< bool(FOperatingSystemUser &)> Func )

Iterates over each user in the given operating system and calls the provided function on each user. If the function returns true, the iteration stops.

Parameters
TargetOSThe target operating system to iterate users on.
FuncThe function to call on each user. It should take an FOperatingSystemUser reference as input and return a boolean value indicating whether to stop the iteration.
Note
If the TargetOS is not valid or if there are no users associated with it, the iteration will not be performed.
Here is the call graph for this function:

◆ GetAllUsers()

void UOperatingSystemUserManager::GetAllUsers ( TArray< FOperatingSystemUser > & OutUsers) const

Retrieves all the operating system users managed by this user manager.

This method populates the provided array OutUsers with the operating system users. The array OutUsers is cleared and then filled with the operating system users managed by this user manager. The method does not return any values.

Parameters
OutUsersThe array to be populated with the operating system users.

◆ GetAllUsersForOS()

TSet< FOperatingSystemUser > UOperatingSystemUserManager::GetAllUsersForOS ( const UOperatingSystem * TargetOS) const

Retrieves all the users for a given operating system.

This method returns a set of operating system users associated with the specified operating system.

Parameters
TargetOSThe operating system for which to retrieve the users.
Returns
A set of operating system users for the specified operating system.
Here is the call graph for this function:

◆ GetUserKey()

FString UOperatingSystemUserManager::GetUserKey ( const UOperatingSystem * TargetOS)
static

Retrieves the user key for the specified operating system.

This method returns a unique identifier that represents the user associated with the given operating system.

Parameters
TargetOSThe pointer to the operating system to retrieve the user key for.
Returns
The user key as a string.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetUserManager()

UOperatingSystemUserManager * UOperatingSystemUserManager::GetUserManager ( const UObject * WorldContextObject)
static

Returns the user manager instance associated with the given WorldContextObject.

Parameters
WorldContextObjectThe world context object used to retrieve the user manager.
Returns
The user manager instance.
Here is the call graph for this function:

◆ HasUsers()

bool UOperatingSystemUserManager::HasUsers ( ) const

Checks if there are any users.

Returns
True if there are users, false otherwise.

◆ K2_OnUserCreated()

void UOperatingSystemUserManager::K2_OnUserCreated ( const FOperatingSystemUser & CreatedUser)
protected

Blueprint implementable event called when a user is created.

This event is called when a user is created in the OperatingSystemUserManager class. It passes the created user as a parameter.

Parameters
CreatedUserThe user that was created.

◆ K2_OnUserUpdated()

void UOperatingSystemUserManager::K2_OnUserUpdated ( UPARAM(ref) FOperatingSystemUser & TargetUser,
const FOperatingSystemUser & UpdatedDetails )
protected

BlueprintImplementableEvent called when a user's details are updated. The updated user details are provided as input parameters.

Parameters
TargetUserThe user object being updated. Passed by reference to allow modifications.
UpdatedDetailsThe new user details to be applied.
Here is the caller graph for this function:

◆ UpdateUserDetails()

bool UOperatingSystemUserManager::UpdateUserDetails ( UPARAM(ref) FOperatingSystemUser & TargetUser,
const FOperatingSystemUser & UpdatedDetails )

public UOperatingSystemUserManager::UpdateUserDetails Updates the details for the given user. If you don't want specific data to change, simply leave them empty or null.

Parameters
TargetUserUser to update
UpdatedDetailsDetails to update. If a setting is null or empty, it is not updated
Returns
True if the details were updated. False otherwise.
Here is the call graph for this function:

Member Data Documentation

◆ Users

TMap<FString, FOperatingSystemUserManagerSaveData> UOperatingSystemUserManager::Users
protected

This map associates user names (as strings) with their respective save data (as FOperatingSystemUserManagerSaveData objects).


The documentation for this class was generated from the following files: