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

#include "OperatingSystemFile.h"

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

Public Member Functions

 UOperatingSystemFile ()
 
void OpenFile (FGenericError &OutError)
 
void CloseFile ()
 Closes the file and cleans up any associated resources.
 
FText GetFileName (const bool bWithExtension=true) const
 
FText GetExtension () const
 
bool IsSameFile (const UOperatingSystemFile *OtherFile) const
 
FORCEINLINE TSoftObjectPtr< UObject > GetIconObject () const
 
FORCEINLINE TScriptInterface< IOperatingSystemExplorerInterfaceGetExplorerInterface () const
 This method returns the TScriptInterface of the IOperatingSystemExplorer.
 

Static Public Member Functions

static UOperatingSystemFileCreateFile (TScriptInterface< IOperatingSystemExplorerInterface > ExplorerInterface, const TSoftClassPtr< UOperatingSystemFile > &FileSoftClass, FGenericError &OutError)
 Creates a new file in the operating system.
 
static UOperatingSystemFileCreateRuntimeFile (UOperatingSystemFile *ParentFile)
 Creates a runtime file based on the given parent file.
 

Protected Member Functions

virtual void OnValidate (FGenericError &OutError)
 Execute custom validation logic for the operating system file.
 
UOperatingSystemFileIconWidgetCreateIconWidget ()
 
void K2_OnOpen ()
 

Protected Attributes

FText Name
 
FText Extension
 
TSoftObjectPtr< UObject > IconObject
 
float SpaceRequiredInMB
 
uint8 bIsDeletable: 1
 
uint8 bIsMovable: 1
 
TSoftClassPtr< UOperatingSystemBaseProgramTargetProgramClass
 
TSoftClassPtr< UOperatingSystemFileIconWidgetIconWidgetClass
 
TSoftClassPtr< UOperatingSystemFileWidgetWidgetClass
 
TWeakObjectPtr< UOperatingSystemBaseProgramParentProgram
 
TObjectPtr< UOperatingSystemFileWidgetFileWidget
 
TScriptInterface< IOperatingSystemExplorerInterfaceParentExplorerInterface
 
bool bHasBlueprintOnOpen
 

Detailed Description

UOperatingSystemFile is a class that represents a file in an operating system.

It provides properties and methods to manage file data and behavior, such as name, extension, icon, space required, and more.

Constructor & Destructor Documentation

◆ UOperatingSystemFile()

UOperatingSystemFile::UOperatingSystemFile ( )

Member Function Documentation

◆ CloseFile()

void UOperatingSystemFile::CloseFile ( )

Closes the file and cleans up any associated resources.

This method is used to close the file and perform any necessary cleanup operations. It resets the parent program and removes the file widget from the parent if it is valid.

Note
This method does not perform any file system operations, such as saving or deleting the file. It is solely responsible for closing the file in the application.
See also
UOperatingSystemFile::ParentProgram
UOperatingSystemFile::FileWidget

◆ CreateFile()

UOperatingSystemFile * UOperatingSystemFile::CreateFile ( TScriptInterface< IOperatingSystemExplorerInterface > ExplorerInterface,
const TSoftClassPtr< UOperatingSystemFile > & FileSoftClass,
FGenericError & OutError )
static

Creates a new file in the operating system.

This method creates a new file in the operating system using the specified explorer interface and file class.

Parameters
ExplorerInterfaceThe interface to the operating system explorer used to create the file.
FileSoftClassThe soft class pointer to the file class that will be used to create the file.
OutError(output) The error object that will be populated if an error occurs during file creation. If the file creation is successful, this error object will be cleared.
Returns
A pointer to the newly created file if the creation was successful, nullptr otherwise.
Note
The returned file object must be managed by the caller and can be null if an error occurs during file creation.
The error message can be retrieved from OutError if the file creation fails.
This method will check for a valid explorer interface, access rights, enough space, and duplicate file names/extensions before creating the file.
This method will log the creation of the file with the file name, extension, and explorer interface path at a very verbose log level.
This method is expected to be called within a valid scope. Any cleanup required after file creation should be done in the calling code.
This method should be used to create files in the operating system.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateIconWidget()

UOperatingSystemFileIconWidget * UOperatingSystemFile::CreateIconWidget ( )
protected

Creates an operating system file icon widget.

Returns
A pointer to the created operating system file icon widget. Returns nullptr if the icon widget class is null.
Here is the call graph for this function:

◆ CreateRuntimeFile()

UOperatingSystemFile * UOperatingSystemFile::CreateRuntimeFile ( UOperatingSystemFile * ParentFile)
static

Creates a runtime file based on the given parent file.

This method creates a new runtime file by copying the properties of the parent file and setting the necessary flags.

Parameters
ParentFileThe parent file from which the runtime file will be created. Must have RF_Transient flag.
Returns
The newly created runtime file. This file is managed by the caller and is expected to be deleted when no longer needed.
Note
This method ensures that the ParentFile has RF_Transient flag.
The returned file object must be managed by the caller.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetExplorerInterface()

FORCEINLINE TScriptInterface< IOperatingSystemExplorerInterface > UOperatingSystemFile::GetExplorerInterface ( ) const
inline

This method returns the TScriptInterface of the IOperatingSystemExplorer.

Here is the caller graph for this function:

◆ GetExtension()

FText UOperatingSystemFile::GetExtension ( ) const
inline

Retrieves the extension of the file.

This method returns the extension of the file as a text string. The extension represents the part of the file name after the last period (.) character.

Returns
The extension of the file as a text string.

◆ GetFileName()

FText UOperatingSystemFile::GetFileName ( const bool bWithExtension = true) const

Gets the file name.

This method returns the file name of the operating system file. It can optionally include the file extension as well.

Parameters
bWithExtensionWhether to include the file extension in the returned file name. Default value is true.
Returns
The file name as a FText object.
Here is the caller graph for this function:

◆ GetIconObject()

FORCEINLINE TSoftObjectPtr< UObject > UOperatingSystemFile::GetIconObject ( ) const
inline

GetIconObject is a method that returns the icon object associated with the operating system file.

Returns
A TSoftObjectPtr<UObject> object representing the icon object associated with the operating system file.
Note
The returned icon object can be used to display the file icon in user interfaces or perform any other operations related to the icon.

◆ IsSameFile()

bool UOperatingSystemFile::IsSameFile ( const UOperatingSystemFile * OtherFile) const

Checks if the given file is the same as this file.

Parameters
OtherFileThe file to compare with this file.
Returns
True if the given file is the same as this file, false otherwise.
Here is the call graph for this function:

◆ K2_OnOpen()

void UOperatingSystemFile::K2_OnOpen ( )
protected

K2_OnOpen is an event method that is called when the operating system file is opened.

This method is blueprint implementable, allowing subclasses to override and provide custom functionality when the file is opened.

Here is the caller graph for this function:

◆ OnValidate()

virtual void UOperatingSystemFile::OnValidate ( FGenericError & OutError)
inlineprotectedvirtual

Execute custom validation logic for the operating system file.

This virtual method can be overridden in derived classes to provide custom validation logic for the operating system file. The derived class should implement the desired validation logic and modify the OutError object if there are any validation failures.

Parameters
OutError[in,out] The error object to store the validation failures, if any.
Note
The derived class should call the base class implementation of this method to perform any common validation checks before adding its own custom validation logic.
See also
FGenericError

Reimplemented in UOperatingSystemAudioFile, and UOperatingSystemVideoFile.

◆ OpenFile()

void UOperatingSystemFile::OpenFile ( FGenericError & OutError)

Opens the file in its associated program.

This method is used to open the file using the associated program. If the associated program is not set or no compatible program is installed, an error message is generated and added to the operating system's notification list.

Parameters
OutErrorA reference to a FGenericError object that will contain any error messages.
See also
FGenericError
Here is the call graph for this function:

Member Data Documentation

◆ bHasBlueprintOnOpen

bool UOperatingSystemFile::bHasBlueprintOnOpen
protected

◆ bIsDeletable

uint8 UOperatingSystemFile::bIsDeletable
protected

Is this file deletable?

◆ bIsMovable

uint8 UOperatingSystemFile::bIsMovable
protected

Is this file movable?

◆ Extension

FText UOperatingSystemFile::Extension
protected

Extension represents the file extension of an operating system file.

◆ FileWidget

TObjectPtr<UOperatingSystemFileWidget> UOperatingSystemFile::FileWidget
protected

Widget spawned by this file.

◆ IconObject

TSoftObjectPtr<UObject> UOperatingSystemFile::IconObject
protected

Obvious right? C'mon its just an Icon. What you need a tooltip for ¯_(ツ)_/¯

◆ IconWidgetClass

TSoftClassPtr<UOperatingSystemFileIconWidget> UOperatingSystemFile::IconWidgetClass
protected

Target icon class for this file.

◆ Name

FText UOperatingSystemFile::Name
protected

Name of this file without extension.

◆ ParentExplorerInterface

TScriptInterface<IOperatingSystemExplorerInterface> UOperatingSystemFile::ParentExplorerInterface
protected

◆ ParentProgram

TWeakObjectPtr<UOperatingSystemBaseProgram> UOperatingSystemFile::ParentProgram
protected

Program instance that owns this file.

◆ SpaceRequiredInMB

float UOperatingSystemFile::SpaceRequiredInMB
protected

How much space does this file require on hard disk.

◆ TargetProgramClass

TSoftClassPtr<UOperatingSystemBaseProgram> UOperatingSystemFile::TargetProgramClass
protected

Target class for the program that can open this file.

◆ WidgetClass

TSoftClassPtr<UOperatingSystemFileWidget> UOperatingSystemFile::WidgetClass
protected

Target widget class for this file.


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