Ultralight C API 1.3.0
Loading...
Searching...
No Matches
CAPI_FileSystem.h
Go to the documentation of this file.
1/******************************************************************************
2 * This file is a part of Ultralight, an ultra-portable web-browser engine. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2023 Ultralight, Inc. *
7 *****************************************************************************/
8#ifndef ULTRALIGHT_CAPI_FILESYSTEM_H
9#define ULTRALIGHT_CAPI_FILESYSTEM_H
10
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/******************************************************************************
18 * File System
19 *****************************************************************************/
20
21///
22/// The callback invoked when the FileSystem wants to check if a file path exists, return true if it
23/// exists.
24///
26
27///
28/// Get the mime-type of the file (eg "text/html").
29///
30/// This is usually determined by analyzing the file extension.
31///
32/// If a mime-type cannot be determined, you should return "application/unknown" for this value.
33///
34/// The library will consume the result and call ulDestroyString() after this call returns.
35///
37
38///
39/// Get the charset / encoding of the file (eg "utf-8").
40///
41/// This is only important for text-based files and is usually determined by analyzing the
42/// contents of the file.
43///
44/// If a charset cannot be determined, it's usually safe to return "utf-8" for this value.
45///
46/// The library will consume the result and call ulDestroyString() after this call returns.
47///
49
50///
51/// Open file for reading and map it to a Buffer.
52///
53/// To minimize copies, you should map the requested file into memory and use ulCreateBuffer()
54/// to wrap the data pointer (unmapping should be performed in the destruction callback).
55///
56/// If the file was unable to be opened, you should return NULL for this value.
57///
59
60typedef struct {
66
67#ifdef __cplusplus
68} // extern "C"
69#endif
70
71#endif // ULTRALIGHT_CAPI_FILESYSTEM_H
struct C_String * ULString
Definition CAPI_Defines.h:54
struct C_Buffer * ULBuffer
Definition CAPI_Defines.h:55
ULBuffer(* ULFileSystemOpenFileCallback)(ULString path)
Open file for reading and map it to a Buffer.
Definition CAPI_FileSystem.h:58
bool(* ULFileSystemFileExistsCallback)(ULString path)
The callback invoked when the FileSystem wants to check if a file path exists, return true if it exis...
Definition CAPI_FileSystem.h:25
ULString(* ULFileSystemGetFileMimeTypeCallback)(ULString path)
Get the mime-type of the file (eg "text/html").
Definition CAPI_FileSystem.h:36
ULString(* ULFileSystemGetFileCharsetCallback)(ULString path)
Get the charset / encoding of the file (eg "utf-8").
Definition CAPI_FileSystem.h:48
Definition CAPI_FileSystem.h:60
ULFileSystemOpenFileCallback open_file
Definition CAPI_FileSystem.h:64
ULFileSystemGetFileMimeTypeCallback get_file_mime_type
Definition CAPI_FileSystem.h:62
ULFileSystemFileExistsCallback file_exists
Definition CAPI_FileSystem.h:61
ULFileSystemGetFileCharsetCallback get_file_charset
Definition CAPI_FileSystem.h:63