Ultralight C API 1.3.0
Loading...
Searching...
No Matches
CAPI_FileSystem.h File Reference

Go to the source code of this file.

Data Structures

struct  ULFileSystem
 

Typedefs

typedef bool(* ULFileSystemFileExistsCallback) (ULString path)
 The callback invoked when the FileSystem wants to check if a file path exists, return true if it exists.
 
typedef ULString(* ULFileSystemGetFileMimeTypeCallback) (ULString path)
 Get the mime-type of the file (eg "text/html").
 
typedef ULString(* ULFileSystemGetFileCharsetCallback) (ULString path)
 Get the charset / encoding of the file (eg "utf-8").
 
typedef ULBuffer(* ULFileSystemOpenFileCallback) (ULString path)
 Open file for reading and map it to a Buffer.
 

Typedef Documentation

◆ ULFileSystemFileExistsCallback

typedef bool(* ULFileSystemFileExistsCallback) (ULString path)

The callback invoked when the FileSystem wants to check if a file path exists, return true if it exists.

◆ ULFileSystemGetFileCharsetCallback

typedef ULString(* ULFileSystemGetFileCharsetCallback) (ULString path)

Get the charset / encoding of the file (eg "utf-8").

This is only important for text-based files and is usually determined by analyzing the contents of the file.

If a charset cannot be determined, it's usually safe to return "utf-8" for this value.

The library will consume the result and call ulDestroyString() after this call returns.

◆ ULFileSystemGetFileMimeTypeCallback

typedef ULString(* ULFileSystemGetFileMimeTypeCallback) (ULString path)

Get the mime-type of the file (eg "text/html").

This is usually determined by analyzing the file extension.

If a mime-type cannot be determined, you should return "application/unknown" for this value.

The library will consume the result and call ulDestroyString() after this call returns.

◆ ULFileSystemOpenFileCallback

typedef ULBuffer(* ULFileSystemOpenFileCallback) (ULString path)

Open file for reading and map it to a Buffer.

To minimize copies, you should map the requested file into memory and use ulCreateBuffer() to wrap the data pointer (unmapping should be performed in the destruction callback).

If the file was unable to be opened, you should return NULL for this value.