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

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"

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

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< IOperatingSystemExplorerInterfaceGetChildDirectory (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 UOperatingSystemGetOperatingSystem () 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< IOperatingSystemExplorerInterfaceGetInterfaceFromPath (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 UOperatingSystemDirectoryCreateDirectory (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< UOperatingSystemDirectoriesCollectionChildDirectoryCollection
 
TWeakObjectPtr< UOperatingSystemDirectoryParentDirectory
 
TWeakObjectPtr< UOperatingSystemPartitionParentPartition
 
TArray< TObjectPtr< UOperatingSystemFile > > Files
 
TArray< TObjectPtr< UOperatingSystemDirectory > > ChildDirectories
 
TWeakObjectPtr< UOperatingSystemParentOS
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ UOperatingSystemDirectory()

UOperatingSystemDirectory::UOperatingSystemDirectory ( )

Member Function Documentation

◆ CanCreateNewFile()

virtual bool UOperatingSystemDirectory::CanCreateNewFile ( ) const
inlinefinaloverridevirtual

Determines whether the operating system directory can create a new file.

Returns
true if the operating system directory can create a new file, false otherwise.

Implements IOperatingSystemExplorerInterface.

◆ CanCreateNewFolder()

FORCEINLINE bool UOperatingSystemDirectory::CanCreateNewFolder ( ) const
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.

Returns
True if the user has permission to create a new folder, false otherwise.

◆ CanRename()

FORCEINLINE bool UOperatingSystemDirectory::CanRename ( ) const
inline

Checks if the directory can be renamed.

Returns
true if the directory can be renamed, false otherwise.

◆ CheckForDirectoryWithTag()

bool UOperatingSystemDirectory::CheckForDirectoryWithTag ( const FGameplayTag & TestTag,
const bool bRecursive ) const

Check if the directory has a specific tag.

Parameters
TestTagThe tag to check against.
bRecursiveWhether to check recursively through child directories.
Returns
Returns true if the directory or any of its child directories have the specified tag, false otherwise.

◆ CreateDirectory() [1/2]

UOperatingSystemDirectory * UOperatingSystemDirectory::CreateDirectory ( const TWeakObjectPtr< UOperatingSystemPartition > OwningPartition,
const TWeakObjectPtr< UOperatingSystemDirectory > OwningDirectory,
const TWeakObjectPtr< UOperatingSystem > OwningOS,
const TSoftClassPtr< UOperatingSystemDirectory > & DirectoryClass,
const bool bIsFromSaveGame,
FGenericError & OutError )
static

Creates a new directory.

Parameters
OwningPartitionThe owning partition that the directory belongs to.
OwningDirectoryThe parent directory that the directory belongs to.
OwningOSThe operating system that the directory belongs to.
DirectoryClassThe class of the directory.
bIsFromSaveGameIndicates if the directory is from a saved game.
OutErrorError message in case of failure.
Returns
The created directory if successful, nullptr otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateDirectory() [2/2]

template<class T >
static T * UOperatingSystemDirectory::CreateDirectory ( const TWeakObjectPtr< UOperatingSystemPartition > OwningPartition,
const TWeakObjectPtr< UOperatingSystemDirectory > OwningDirectory,
const TWeakObjectPtr< UOperatingSystem > OwningOS,
const TSoftClassPtr< UOperatingSystemDirectory > & DirectoryClass,
const bool bIsFromSaveGame,
FGenericError & OutError )
inlinestatic

Creates a new directory of type T in the operating system.

Template Parameters
TThe type of directory to create. It must be derived from UOperatingSystemDirectory.
Parameters
OwningPartitionThe owning partition of the directory.
OwningDirectoryThe parent directory of the directory being created.
OwningOSThe operating system object that the directory will belong to.
DirectoryClassThe class of the directory to create.
bIsFromSaveGameFlag indicating if the directory is being created from a save game.
OutErrorThe error encountered during the creation process, if any.
Returns
A pointer to the newly created directory of type T, or nullptr if the creation failed.
Warning
Compile will fail if the T parameter is not derived from UOperatingSystemDirectory.
Note
This method internally calls the base CreateDirectory method, passing the parameters and performing additional checks and casts.
See also
UOperatingSystemPartition
UOperatingSystemDirectory
UOperatingSystem

◆ FindDirectoryByTag()

bool UOperatingSystemDirectory::FindDirectoryByTag ( const FGameplayTag DirectoryTag,
const bool bRecursive,
UOperatingSystemDirectory *& OutDirectory ) const
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.

Parameters
DirectoryTagThe tag of the directory to find.
bRecursiveWhether to search the child directories recursively.
OutDirectoryA pointer to the found directory. It will be set to nullptr if no directory with the specified tag is found.
Returns
True if a directory with the specified tag is found, false otherwise.

Implements IOperatingSystemExplorerInterface.

Here is the call graph for this function:

◆ GetAllFiles()

TArray< UOperatingSystemFile * > UOperatingSystemDirectory::GetAllFiles ( const FString & WithExtension = "*") const
finaloverridevirtual

GetAllFiles is a method that returns an array of operating system files in the directory.

Parameters
WithExtensionThe extension of files to filter. Defaults to "*".
Returns
An array of UOperatingSystemFile pointers that match the specified extension. If WithExtension is "*", "." or empty, all files are returned.

Implements IOperatingSystemExplorerInterface.

◆ GetAs()

template<class T >
T * UOperatingSystemDirectory::GetAs ( ) const
inline

Returns a pointer to the current object casted to the specified type. The specified type, T, must be derived from the UOperatingSystemDirectory class.

Template Parameters
TThe type to cast the current object to.
Returns
A pointer to the current object casted to the specified type, or nullptr if the cast fails.
Note
This method uses the Cast function from Unreal Engine to perform the cast.
Warning
T parameter must be derived from UOperatingSystemDirectory. If not, compile will fail.

◆ GetAsConst()

template<class T >
FORCEINLINE const T * UOperatingSystemDirectory::GetAsConst ( ) const
inline

Returns a pointer to the current object casted to the specified type. The specified type, T, must be derived from the UOperatingSystemDirectory class.

Template Parameters
TThe type to cast the current object to.
Returns
A pointer to the current object casted to the specified type, or nullptr if the cast fails.
Note
This method uses the Cast function from Unreal Engine to perform the cast.
Warning
T parameter must be derived from UOperatingSystemDirectory. If not, compile will fail. This returns a const object.

◆ GetChildDirectories()

virtual TArray< UOperatingSystemDirectory * > UOperatingSystemDirectory::GetChildDirectories ( ) const
inlinefinaloverridevirtual

Get the child directories of the current operating system directory.

Returns
An array of UOperatingSystemDirectory pointers representing the child directories.

Implements IOperatingSystemExplorerInterface.

Here is the caller graph for this function:

◆ GetChildDirectory() [1/2]

template<class T >
T * UOperatingSystemDirectory::GetChildDirectory ( const FString & TargetChildDirectoryName,
const bool bRecursive = true ) const
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.

Parameters
TargetChildDirectoryNameThe 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.
Returns
A pointer to the child directory object, or nullptr if the child directory is not found or if T is not derived from UOperatingSystemDirectory.
Warning
T parameter must be derived from UOperatingSystemDirectory. If not, compile will fail.

Implements IOperatingSystemExplorerInterface.

◆ GetChildDirectory() [2/2]

TScriptInterface< IOperatingSystemExplorerInterface > UOperatingSystemDirectory::GetChildDirectory ( const FString & TargetChildDirectoryName,
const bool bRecursive = true ) const
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.

Parameters
TargetChildDirectoryNameThe name of the child directory to retrieve.
bRecursiveOptional 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.
Returns
A pointer to the child directory if found, nullptr otherwise.

Implements IOperatingSystemExplorerInterface.

Here is the caller graph for this function:

◆ GetDirectoryIconObject()

UObject * UOperatingSystemDirectory::GetDirectoryIconObject ( ) const

Returns the directory icon object.

Returns
The directory icon object.

◆ GetDirectoryName()

FText UOperatingSystemDirectory::GetDirectoryName ( ) const

Returns the name of this directory.

Returns
The name of the directory as a FText object.
Note
If a special directory name is set for the object using UOperatingSystemStatics::GetSpecialDirectoryName(), that name will be returned. Otherwise, the Name property will be returned.
See also
UOperatingSystemStatics::GetSpecialDirectoryName()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDirectoryPath()

FString UOperatingSystemDirectory::GetDirectoryPath ( ) const

Same as GetFullPath except this removes the directory name from the path.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDirectoryTag()

FORCEINLINE FGameplayTag UOperatingSystemDirectory::GetDirectoryTag ( ) const
inline

Retrieves the directory tag.

This method returns the gameplay tag associated with the directory.

Returns
The gameplay tag associated with the directory.

◆ GetFullPath()

TOptional< FString > UOperatingSystemDirectory::GetFullPath ( ) const
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.

Returns
The full path of the operating system directory as a string, or an empty optional if the path could not be retrieved.

Implements IOperatingSystemExplorerInterface.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInterfaceDisplayName()

virtual FText UOperatingSystemDirectory::GetInterfaceDisplayName ( ) const
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.

Returns
The FText object representing the display name of the interface.

Implements IOperatingSystemExplorerInterface.

◆ GetInterfaceFromPath()

TScriptInterface< IOperatingSystemExplorerInterface > UOperatingSystemDirectory::GetInterfaceFromPath ( const FString & NewPath) const
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.

Parameters
NewPathThe path to the interface.
Returns
The interface requested, represented as TScriptInterface<IOperatingSystemExplorerInterface>.

Implements IOperatingSystemExplorerInterface.

◆ GetOperatingSystem()

UOperatingSystem * UOperatingSystemDirectory::GetOperatingSystem ( ) const
finaloverridevirtual

Returns the operating system object associated with the directory.

Returns
A pointer to the UOperatingSystem object.

Implements IOperatingSystemExplorerInterface.

◆ GetParentExplorerInterface()

void UOperatingSystemDirectory::GetParentExplorerInterface ( TScriptInterface< IOperatingSystemExplorerInterface > & OutInterface) const
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.

Parameters
OutInterface[out] The output parameter that will be set to the parent explorer interface.

Implements IOperatingSystemExplorerInterface.

◆ GetSaveData()

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.

Parameters
OutSaveDataThe 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.
Here is the call graph for this function:

◆ HasEnoughSpace()

bool UOperatingSystemDirectory::HasEnoughSpace ( const FOperatingSystemSizeInMB & TestSpace) const
finaloverridevirtual

Determines if the operating system directory has enough space to hold a given amount of data.

Parameters
TestSpaceThe size of the data to be tested for space.
Returns
True if the directory has enough space, false otherwise.

Implements IOperatingSystemExplorerInterface.

◆ IsPartition()

virtual bool UOperatingSystemDirectory::IsPartition ( ) const
inlinefinaloverridevirtual

Check if the directory is a partition. This method checks whether the directory is a partition or not.

Returns
Returns true always.

Implements IOperatingSystemExplorerInterface.

◆ IsSystemDirectory()

bool UOperatingSystemDirectory::IsSystemDirectory ( ) const

Checks if the directory is classified as a system directory.

Returns
True if the directory is a system directory, false otherwise.

◆ IsUnixRootDirectory()

virtual bool UOperatingSystemDirectory::IsUnixRootDirectory ( ) const
inlinevirtual

DO NOT MODIFY THIS!

Reimplemented in UOperatingSystemRootDirectory.

Here is the caller graph for this function:

◆ LoadFiles()

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.

Parameters
DirectoriesSaveLoadThe 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.
Note
The files are added to the Files array of the UOperatingSystemDirectory object.
If there are any newly added file classes in the FileClasses array of the UOperatingSystemDirectory object, UOperatingSystemFile objects are created for each newly added file class and added to the Files array.
Warning
If the UOperatingSystemDirectory object already has UOperatingSystemFile objects in the Files array with the same file as specified in the FOperatingSystemDirectoriesSaveLoad object, they will be skipped and not re-created.
See also
UOperatingSystemDirectory, FOperatingSystemDirectoriesSaveLoad, UOperatingSystemFile
Here is the call graph for this function:

◆ OnValidate()

virtual void UOperatingSystemDirectory::OnValidate ( FGenericError & OutError)
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.

Parameters
OutErrorA reference to a FGenericError object which can be used to report any validation errors encountered.
Note
If any validation errors are encountered, they should be added to the OutError object using the MAKE_ERROR method. If no validation errors are encountered, the method should return without adding any errors to the OutError object.
See also
FGenericError

Member Data Documentation

◆ bCanCreateNewFile

uint8 UOperatingSystemDirectory::bCanCreateNewFile
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.

◆ bCanCreateNewFolder

uint8 UOperatingSystemDirectory::bCanCreateNewFolder
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.

Remarks
This variable is exposed in the default settings but cannot be modified at runtime. It is accessed in read-only mode.

◆ bIsHidden

uint8 UOperatingSystemDirectory::bIsHidden
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.

◆ ChildDirectories

TArray<TObjectPtr<UOperatingSystemDirectory> > UOperatingSystemDirectory::ChildDirectories
protected

All the child directories that belongs to this directory.

◆ ChildDirectoryCollection

TSoftObjectPtr<UOperatingSystemDirectoriesCollection> UOperatingSystemDirectory::ChildDirectoryCollection
protected

Stores a collection of child directories in this directory.

◆ FileClasses

TSet<TSoftClassPtr<UOperatingSystemFile> > UOperatingSystemDirectory::FileClasses
protected

Set of file classes representing files in the operating system directory.

◆ Files

TArray<TObjectPtr<UOperatingSystemFile> > UOperatingSystemDirectory::Files
protected

Holds an array of UOperatingSystemFile's that belongs to this directory.

◆ Name

FText UOperatingSystemDirectory::Name
protected

The Name variable represents the name of a specific operating system directory.

◆ OverrideIcon

TSoftObjectPtr<UObject> UOperatingSystemDirectory::OverrideIcon
protected

The icon to be used as an override for the default icon.

◆ ParentDirectory

TWeakObjectPtr<UOperatingSystemDirectory> UOperatingSystemDirectory::ParentDirectory
protected

Represents the parent directory that owns this directory.

◆ ParentOS

TWeakObjectPtr<UOperatingSystem> UOperatingSystemDirectory::ParentOS
protected

The operating system that owns this directory.

◆ ParentPartition

TWeakObjectPtr<UOperatingSystemPartition> UOperatingSystemDirectory::ParentPartition
protected

A weak object pointer to a UOperatingSystemPartition object representing the parent partition.

◆ Tag

FGameplayTag UOperatingSystemDirectory::Tag
protected

Indicates a certain tag for this directory.


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