sincerely Singaporean

If you have not done so, read this full tutorial on how to use SGEXTN to build an application.

SGXFileBinUtilities

see header file

see source file

class SGXFileBinUtilities;

part of SGEXTN module SG_FileSystem

static functions class for the SGEXTN builtin file bin

detailed description

list of all including inherited members

implementation details

preprocessor file inclusion directive: #include ‹SGXFileBinUtilities.h›

CMake target for BuildLah: SGEXTN::SG_FileSystem

see this link for more information about BuildLah

parent class: (none)

children classes: (none)

static member functions

static int deleteFile(const SGXString& s);

static int deleteFolder(const SGXString& s);

static int getLifespan();

static void permanentClearBin();

static int permanentDeleteFile(SGXIdentifier x);

static int restoreFile(SGXIdentifier x);

static void setLifespan(int x);

Detailed Description

SGXFileBinUtilities provides access to the file bin builtin to SGEXTN. Deleted user data should be moved to the file bin so that it can be recovered if the user changes their mind. Files in the bin are automatically deleted after a period of time. Files in the bin must be accessed through their SGXIdentifier, not through the path.

Implementation Details

Manages a bin file which contains a list of files moved to the bin.

static int deleteFile(const SGXString& s);

Move the file at file path s to the file bin. This returns -2 if a file system error caused the operation to fail, 0 if there is no file at s, and 1 if the operation is successful.

The original path of the file is stored in the file bin after its deletion and can be used for recovery of deleted files.

Do not move application generated files to the bin, instead delete them directly using SGXFileSystem::permanentDeleteFile. The file bin is only for user data.

static int deleteFolder(const SGXString& s);

Move all files in the folder s and its recursive subfolders to the file bin. This returns -2 if a file system error caused the operation to fail, 0 if there is no folder at s, and 1 if the operation is successful.

Files in the folder are moved to the bin separately, so the user may see more than 1 files being added to the bin.

The original path of the files is stored in the file bin after its deletion and can be used for recovery of deleted files.

Do not move application generated files to the bin, instead delete them directly using SGXFileSystem::permanentDeleteFolder. The file bin is only for user data.

static int getLifespan();

Returns the time in days that files in the bin are stored before deletion.

The default value for this is 1000 days, or slightly less than 3 years.

static void permanentClearBin();

Permanently deletes everything in the file bin.

This is guaranteed to fix a corrupt bin.

Always warn the user before this is used. The operation can cause irreversible loss of user data if used inappropriately.

static int permanentDeleteFile(SGXIdentifier x);

Permanently deletes the file x currently in the bin. This returns -2 if the operation failed due to a file system error, 0 if there is no file x in the bin, and 1 if the operation is successful.

Always warn the user before this is used. The operation can cause irreversible loss of user data if used inappropriately.

static int restoreFile(SGXIdentifier x);

Restores the file x currently in the bin. This returns -3 if the file bin registry is corrupted, -2 if the operation failed due to a file system error, 0 if there is no file x in the bin, and 1 if the operation is successful.

The restored file is moved to its original location before deletion.

static void setLifespan(int x);

Sets files in the bin to be deleted permanently x days after being moved to the bin.

The default value for this is 1000 days, or slightly less than 3 years.

Always keep this at least the length of a school year.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects