#include <sc_store.h>

Public Member Functions

bool CreateDirectories (char const *utf8_directory_path)
 
bool Exists (char const *utf8_path)
 
bool IsDirectory (char const *utf8_path)
 
MemoryDeviceFile OpenFileForReading (char const *utf8_path)
 
bool RemoveAll (char const *utf8_path)
 
char const * ToAbsolutePath (char const *utf8_path)
 

Detailed Description

The MemoryDevice class is an in-memory virtual file device used to sandbox file IO. These objects can be obtained by Database::GetMemoryDevice.

Member Function Documentation

◆ CreateDirectories()

bool SC::Store::MemoryDevice::CreateDirectories ( char const *  utf8_directory_path)

Creates all the directories in this device required for the input directory path to exist.

Returns
True if the leaf directory was successfully created and false otherwise.

◆ Exists()

bool SC::Store::MemoryDevice::Exists ( char const *  utf8_path)

Queries if a path exists within this device.

Returns
True if the path exists and false otherwise.

◆ IsDirectory()

bool SC::Store::MemoryDevice::IsDirectory ( char const *  utf8_path)

Queries if a path is a directory within this device.

Returns
True if the path is a directory and false otherwise.

◆ OpenFileForReading()

MemoryDeviceFile SC::Store::MemoryDevice::OpenFileForReading ( char const *  utf8_path)

Opens the file specified by path for read operations. A valid MemoryDeviceFile will be returned which allows reading the file data.

If the path is not a valid file, an Exception will be thrown.

Returns
A valid file object if the given path is an actual file.

◆ RemoveAll()

bool SC::Store::MemoryDevice::RemoveAll ( char const *  utf8_path)

Removes a file or directory in this device. If it is a directory, all of its children are also removed.

Returns
True if the directory was successfully removed and false otherwise.

◆ ToAbsolutePath()

char const* SC::Store::MemoryDevice::ToAbsolutePath ( char const *  utf8_path)

Transforms the given path into an absolute version of the same underlying path. To find the current working directory for the MemoryDevice, call this function with an empty string for the path.

Returns
An aboslute version of the given path.