Operating System Simulator Plugin
3.5.1
Unreal Engine plugin that simulates an Operating System Environment
|
The UOperatingSystemDirectory class represents an operating system directory. It inherits from UObject and implements the IOperatingSystemExplorerInterface. This class provides functionalities for creating, managing, and accessing directories in an operating system. More...
#include "OperatingSystemDirectory.h"
Public Member Functions | |
UOperatingSystemDirectory () | |
FText | GetDirectoryName () const |
bool | IsSystemDirectory () const |
UObject * | GetDirectoryIconObject () const |
virtual TArray< UOperatingSystemDirectory * > | GetChildDirectories () const override final |
Get the child directories of the current operating system directory. | |
virtual void | GetParentExplorerInterface (TScriptInterface< IOperatingSystemExplorerInterface > &OutInterface) const override final |
Retrieves the parent explorer interface of the operating system directory. | |
virtual bool | IsPartition () const override final |
Check if the directory is a partition. This method checks whether the directory is a partition or not. | |
virtual FText | GetInterfaceDisplayName () const override final |
Returns the display name of the interface. This method returns the display name of the interface as a FText object. The display name is a textual representation of the interface. | |
virtual bool | FindDirectoryByTag (const FGameplayTag DirectoryTag, const bool bRecursive, UOperatingSystemDirectory *&OutDirectory) const override final |
Finds a directory by tag. This method searches for a directory with the specified tag within the current directory and, optionally, within its child directories recursively. | |
virtual TScriptInterface< IOperatingSystemExplorerInterface > | GetChildDirectory (const FString &TargetChildDirectoryName, const bool bRecursive=true) const override final |
Retrieves a child directory with the specified name. This method searches for a child directory with the given name in the current directory. If the child directory is found, it is returned. | |
virtual TArray< UOperatingSystemFile * > | GetAllFiles (const FString &WithExtension="*") const override final |
GetAllFiles is a method that returns an array of operating system files in the directory. | |
virtual bool | CanCreateNewFile () const override final |
Determines whether the operating system directory can create a new file. | |
virtual bool | HasEnoughSpace (const FOperatingSystemSizeInMB &TestSpace) const override final |
Determines if the operating system directory has enough space to hold a given amount of data. | |
virtual UOperatingSystem * | GetOperatingSystem () const override final |
Returns the operating system object associated with the directory. | |
virtual TOptional< FString > | GetFullPath () const override final |
Retrieves the full path of the operating system directory. This method returns the full path of the operating system directory by traversing through its parent directories and concatenating the directory names. | |
virtual TScriptInterface< IOperatingSystemExplorerInterface > | GetInterfaceFromPath (const FString &NewPath) const override final |
Retrieves an interface from a specified path. This method retrieves an interface from a specified path. The path is used to locate the desired interface in the operating system. | |
virtual bool | IsUnixRootDirectory () const |
void | LoadFiles (const FOperatingSystemDirectoriesSaveLoad &DirectoriesSaveLoad) |
Load the files from the provided FOperatingSystemDirectoriesSaveLoad object. This method creates UOperatingSystemFile objects for each file specified in the SaveLoad_Files array of the FOperatingSystemDirectoriesSaveLoad object and adds them to the Files array of the UOperatingSystemDirectory object. It also checks if there are any newly added file classes in the FileClasses array of the UOperatingSystemDirectory object, and creates UOperatingSystemFile objects for each newly added file class, if necessary. | |
FString | GetDirectoryPath () const |
void | GetSaveData (TArray< FOperatingSystemDirectoriesSaveLoad > &OutSaveData) const |
Retrieves the save data for the operating system directories. | |
bool | CheckForDirectoryWithTag (const FGameplayTag &TestTag, const bool bRecursive) const |
Check if the directory has a specific tag. | |
FORCEINLINE bool | CanCreateNewFolder () const |
Checks if the user has permission to create a new folder. | |
FORCEINLINE bool | CanRename () const |
Checks if the directory can be renamed. | |
FORCEINLINE FGameplayTag | GetDirectoryTag () const |
Retrieves the directory tag. | |
template<class T > | |
T * | GetAs () const |
Returns a pointer to the current object casted to the specified type. The specified type, T, must be derived from the UOperatingSystemDirectory class. | |
template<class T > | |
FORCEINLINE const T * | GetAsConst () const |
Returns a pointer to the current object casted to the specified type. The specified type, T, must be derived from the UOperatingSystemDirectory class. | |
template<class T > | |
T * | GetChildDirectory (const FString &TargetChildDirectoryName, const bool bRecursive=true) const |
Retrieves a child directory with the given name. | |
Static Public Member Functions | |
static UOperatingSystemDirectory * | CreateDirectory (const TWeakObjectPtr< UOperatingSystemPartition > OwningPartition, const TWeakObjectPtr< UOperatingSystemDirectory > OwningDirectory, const TWeakObjectPtr< UOperatingSystem > OwningOS, const TSoftClassPtr< UOperatingSystemDirectory > &DirectoryClass, const bool bIsFromSaveGame, FGenericError &OutError) |
template<class T > | |
static T * | CreateDirectory (const TWeakObjectPtr< UOperatingSystemPartition > OwningPartition, const TWeakObjectPtr< UOperatingSystemDirectory > OwningDirectory, const TWeakObjectPtr< UOperatingSystem > OwningOS, const TSoftClassPtr< UOperatingSystemDirectory > &DirectoryClass, const bool bIsFromSaveGame, FGenericError &OutError) |
Creates a new directory of type T in the operating system. | |
Protected Member Functions | |
virtual void | OnValidate (FGenericError &OutError) |
This method is called to perform custom validation for the operating system directory. | |
Protected Attributes | |
FText | Name |
FGameplayTag | Tag |
TSoftObjectPtr< UObject > | OverrideIcon |
uint8 | bCanCreateNewFolder: 1 |
uint8 | bCanCreateNewFile: 1 |
uint8 | bIsHidden: 1 |
TSet< TSoftClassPtr< UOperatingSystemFile > > | FileClasses |
TSoftObjectPtr< UOperatingSystemDirectoriesCollection > | ChildDirectoryCollection |
TWeakObjectPtr< UOperatingSystemDirectory > | ParentDirectory |
TWeakObjectPtr< UOperatingSystemPartition > | ParentPartition |
TArray< TObjectPtr< UOperatingSystemFile > > | Files |
TArray< TObjectPtr< UOperatingSystemDirectory > > | ChildDirectories |
TWeakObjectPtr< UOperatingSystem > | ParentOS |
The UOperatingSystemDirectory class represents an operating system directory. It inherits from UObject and implements the IOperatingSystemExplorerInterface. This class provides functionalities for creating, managing, and accessing directories in an operating system.
UOperatingSystemDirectory::UOperatingSystemDirectory | ( | ) |
|
inlinefinaloverridevirtual |
Determines whether the operating system directory can create a new file.
Implements IOperatingSystemExplorerInterface.
|
inline |
Checks if the user has permission to create a new folder.
This method returns a boolean value indicating whether the user has permission to create a new folder in the operating system directory.
|
inline |
Checks if the directory can be renamed.
bool UOperatingSystemDirectory::CheckForDirectoryWithTag | ( | const FGameplayTag & | TestTag, |
const bool | bRecursive ) const |
Check if the directory has a specific tag.
TestTag | The tag to check against. |
bRecursive | Whether to check recursively through child directories. |
|
static |
Creates a new directory.
OwningPartition | The owning partition that the directory belongs to. |
OwningDirectory | The parent directory that the directory belongs to. |
OwningOS | The operating system that the directory belongs to. |
DirectoryClass | The class of the directory. |
bIsFromSaveGame | Indicates if the directory is from a saved game. |
OutError | Error message in case of failure. |
|
inlinestatic |
Creates a new directory of type T in the operating system.
T | The type of directory to create. It must be derived from UOperatingSystemDirectory. |
OwningPartition | The owning partition of the directory. |
OwningDirectory | The parent directory of the directory being created. |
OwningOS | The operating system object that the directory will belong to. |
DirectoryClass | The class of the directory to create. |
bIsFromSaveGame | Flag indicating if the directory is being created from a save game. |
OutError | The error encountered during the creation process, if any. |
|
finaloverridevirtual |
Finds a directory by tag. This method searches for a directory with the specified tag within the current directory and, optionally, within its child directories recursively.
DirectoryTag | The tag of the directory to find. |
bRecursive | Whether to search the child directories recursively. |
OutDirectory | A pointer to the found directory. It will be set to nullptr if no directory with the specified tag is found. |
Implements IOperatingSystemExplorerInterface.
|
finaloverridevirtual |
GetAllFiles is a method that returns an array of operating system files in the directory.
WithExtension | The extension of files to filter. Defaults to "*". |
Implements IOperatingSystemExplorerInterface.
|
inline |
Returns a pointer to the current object casted to the specified type. The specified type, T, must be derived from the UOperatingSystemDirectory class.
T | The type to cast the current object to. |
|
inline |
Returns a pointer to the current object casted to the specified type. The specified type, T, must be derived from the UOperatingSystemDirectory class.
T | The type to cast the current object to. |
|
inlinefinaloverridevirtual |
Get the child directories of the current operating system directory.
Implements IOperatingSystemExplorerInterface.
|
inlinevirtual |
Retrieves a child directory with the given name.
This method returns a pointer to a child directory within the current directory with the specified name. The child directory is represented by an object of type T, which must be derived from UOperatingSystemDirectory. The method performs a static assertion to ensure that T is derived from UOperatingSystemDirectory.
TargetChildDirectoryName | The name of the child directory to retrieve. |
bRecursive | (optional) Determines whether the method should recursively search for the child directory within subdirectories. The default value is true. |
Implements IOperatingSystemExplorerInterface.
|
finaloverridevirtual |
Retrieves a child directory with the specified name. This method searches for a child directory with the given name in the current directory. If the child directory is found, it is returned.
TargetChildDirectoryName | The name of the child directory to retrieve. |
bRecursive | Optional boolean parameter that specifies whether to search for the child directory recursively in all descendant directories. If set to true, the method will first check the immediate child directories of the current directory, and then recursively search in their child directories as well. If set to false, the method will only check the immediate child directories of the current directory. The default value is true. |
Implements IOperatingSystemExplorerInterface.
UObject * UOperatingSystemDirectory::GetDirectoryIconObject | ( | ) | const |
Returns the directory icon object.
FText UOperatingSystemDirectory::GetDirectoryName | ( | ) | const |
Returns the name of this directory.
FString UOperatingSystemDirectory::GetDirectoryPath | ( | ) | const |
Same as GetFullPath except this removes the directory name from the path.
|
inline |
Retrieves the directory tag.
This method returns the gameplay tag associated with the directory.
|
finaloverridevirtual |
Retrieves the full path of the operating system directory. This method returns the full path of the operating system directory by traversing through its parent directories and concatenating the directory names.
Implements IOperatingSystemExplorerInterface.
|
inlinefinaloverridevirtual |
Returns the display name of the interface. This method returns the display name of the interface as a FText object. The display name is a textual representation of the interface.
Implements IOperatingSystemExplorerInterface.
|
finaloverridevirtual |
Retrieves an interface from a specified path. This method retrieves an interface from a specified path. The path is used to locate the desired interface in the operating system.
NewPath | The path to the interface. |
Implements IOperatingSystemExplorerInterface.
|
finaloverridevirtual |
Returns the operating system object associated with the directory.
Implements IOperatingSystemExplorerInterface.
|
finaloverridevirtual |
Retrieves the parent explorer interface of the operating system directory.
This method retrieves the parent explorer interface of the operating system directory. If the parent directory is valid, it sets the OutInterface
parameter to the parent directory interface. If the parent directory is not valid, it sets the OutInterface
parameter to the parent partition interface.
OutInterface | [out] The output parameter that will be set to the parent explorer interface. |
Implements IOperatingSystemExplorerInterface.
void UOperatingSystemDirectory::GetSaveData | ( | TArray< FOperatingSystemDirectoriesSaveLoad > & | OutSaveData | ) | const |
Retrieves the save data for the operating system directories.
This method populates the provided array with the save data for the operating system directories. Each directory's save data includes the path, name, and class information, as well as the save data for its child files.
OutSaveData | The array to populate with the save data for the operating system directories. Each element of the array represents the save data for a directory. The save data includes the path, name, class information, and save data for its child files. The array is appended with the save data for all directories and their child directories recursively. |
|
finaloverridevirtual |
Determines if the operating system directory has enough space to hold a given amount of data.
TestSpace | The size of the data to be tested for space. |
Implements IOperatingSystemExplorerInterface.
|
inlinefinaloverridevirtual |
Check if the directory is a partition. This method checks whether the directory is a partition or not.
Implements IOperatingSystemExplorerInterface.
bool UOperatingSystemDirectory::IsSystemDirectory | ( | ) | const |
Checks if the directory is classified as a system directory.
|
inlinevirtual |
DO NOT MODIFY THIS!
Reimplemented in UOperatingSystemRootDirectory.
void UOperatingSystemDirectory::LoadFiles | ( | const FOperatingSystemDirectoriesSaveLoad & | DirectoriesSaveLoad | ) |
Load the files from the provided FOperatingSystemDirectoriesSaveLoad object. This method creates UOperatingSystemFile objects for each file specified in the SaveLoad_Files array of the FOperatingSystemDirectoriesSaveLoad object and adds them to the Files array of the UOperatingSystemDirectory object. It also checks if there are any newly added file classes in the FileClasses array of the UOperatingSystemDirectory object, and creates UOperatingSystemFile objects for each newly added file class, if necessary.
DirectoriesSaveLoad | The FOperatingSystemDirectoriesSaveLoad object containing the files to be loaded. This object should have the SaveLoad_Files array populated with information of the files to be loaded. Each element of the SaveLoad_Files array should contain a ClassPath specifying the class of the file to be created. The ClassPath should be a valid TSoftClassPtr<UOperatingSystemFile> pointing to a UOperatingSystemFile subclass. |
|
inlineprotectedvirtual |
This method is called to perform custom validation for the operating system directory.
This method can be overridden in derived classes to perform custom validation logic. It is called during the process of validating the operating system directory.
OutError | A reference to a FGenericError object which can be used to report any validation errors encountered. |
|
protected |
Flag indicating whether the user is allowed to create new files in the operating system directory. If this flag is set to 1, the user can create new files; otherwise, the user is not allowed to create new files.
|
protected |
Boolean variable indicating whether a new folder can be created in the operating system directory.
If this variable is set to true, it means that the user has permission to create a new folder in the operating system directory specified by the application. If it is set to false, the user does not have permission to create a new folder in the directory.
|
protected |
Indicates whether the file or directory is hidden.
This variable represents a boolean flag indicating whether a file or directory is hidden in the operating system. A value of 1 indicates that the item is hidden, while a value of 0 indicates that the item is not hidden.
|
protected |
All the child directories that belongs to this directory.
|
protected |
Stores a collection of child directories in this directory.
|
protected |
Set of file classes representing files in the operating system directory.
|
protected |
Holds an array of UOperatingSystemFile's that belongs to this directory.
|
protected |
The Name variable represents the name of a specific operating system directory.
|
protected |
The icon to be used as an override for the default icon.
|
protected |
Represents the parent directory that owns this directory.
|
protected |
The operating system that owns this directory.
|
protected |
A weak object pointer to a UOperatingSystemPartition object representing the parent partition.
|
protected |
Indicates a certain tag for this directory.