NetSurf
Data Fields
gui_file_table Struct Reference

/brief function table for file and filename operations. More...

#include <file.h>

Data Fields

nserror(* mkpath )(char **str, size_t *size, size_t nemb, va_list ap)
 Generate a path from one or more component elemnts. More...
 
nserror(* basename )(const char *path, char **str, size_t *size)
 Get the basename of a file. More...
 
nserror(* nsurl_to_path )(struct nsurl *url, char **path)
 Create a path from a nsurl. More...
 
nserror(* path_to_nsurl )(const char *path, struct nsurl **url)
 Create a nsurl from a path. More...
 
nserror(* mkdir_all )(const char *fname)
 Ensure that all directory elements needed to store a filename exist. More...
 

Detailed Description

/brief function table for file and filename operations.

function table implementing an interface to file and filename functionality appropriate for the OS filesystem. All paths are in terms of the OS filesystem convention and must not require additional system specific changes.

Definition at line 50 of file file.h.

Field Documentation

◆ basename

nserror(* gui_file_table::basename) (const char *path, char **str, size_t *size)

Get the basename of a file.

This gets the last element of a path and returns it.

Parameters
[in]pathThe path to extract the name from.
[in,out]strPointer to string pointer if this is NULL enough storage will be allocated for the path element.
[in,out]sizeThe size of the space available if str not NULL on input and set to the total output length on output.
Returns
NSERROR_OK and the complete path is written to str or error code on faliure.

Definition at line 84 of file file.h.

Referenced by fetch_curl_postdata_convert(), and verify_file_register().

◆ mkdir_all

nserror(* gui_file_table::mkdir_all) (const char *fname)

Ensure that all directory elements needed to store a filename exist.

Parameters
[in]fnameThe filename to ensure the path to exists.
Returns
NSERROR_OK on success or error code on failure.

Definition at line 116 of file file.h.

Referenced by netsurf_mkdir_all(), and verify_file_register().

◆ mkpath

nserror(* gui_file_table::mkpath) (char **str, size_t *size, size_t nemb, va_list ap)

Generate a path from one or more component elemnts.

If a string is allocated it must be freed by the caller.

Parameters
[in,out]strpointer to string pointer if this is NULL enough storage will be allocated for the complete path.
[in,out]sizeThe size of the space available if str not NULL on input and if not NULL set to the total output length on output.
[in]nembThe number of elements.
[in]apThe elements of the path as string pointers.
Returns
NSERROR_OK and the complete path is written to str or error code on faliure.

Definition at line 68 of file file.h.

Referenced by netsurf_mkpath(), and verify_file_register().

◆ nsurl_to_path

nserror(* gui_file_table::nsurl_to_path) (struct nsurl *url, char **path)

Create a path from a nsurl.

Parameters
[in]urlThe url to encode.
[out]pathA string containing the result path which must be freed by the caller.
Returns
NSERROR_OK and the path is written to path or error code on faliure.

Definition at line 95 of file file.h.

Referenced by fetch_file_setup(), netsurf_nsurl_to_path(), and verify_file_register().

◆ path_to_nsurl

nserror(* gui_file_table::path_to_nsurl) (const char *path, struct nsurl **url)

Create a nsurl from a path.

Perform the necessary operations on a path to generate a nsurl.

Parameters
[in]pathThe path to convert.
[out]urlpointer to recive the nsurl, The returned url should be unreferenced by the caller.
Returns
NSERROR_OK and the url is placed in url or error code on faliure.

Definition at line 108 of file file.h.

Referenced by netsurf_path_to_nsurl(), process_dir_ent(), and verify_file_register().


The documentation for this struct was generated from the following file: