MiniGUI API Reference (MiniGUI-Threads)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
MiniGUI's general read/write operation provides a general interface to read from and write to various data source, such as files, memory, and so on. More...
Data Structures | |
struct | _MG_RWops |
Macros | |
#define | MGUI_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) |
Seeks an MG_RWops object. More... | |
#define | MGUI_RWtell(ctx) (ctx)->seek(ctx, 0, SEEK_CUR) |
Obtains the current value of the position indicator for a data source. More... | |
#define | MGUI_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) |
Reads data blocks from a data source. More... | |
#define | MGUI_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) |
Writes data blocks to a data source. More... | |
#define | MGUI_RWclose(ctx) (ctx)->close(ctx) |
Closes an MG_RWops object. More... | |
#define | MGUI_RWeof(ctx) (ctx)->eof(ctx) |
Tests the end-of-file indicator for an data source. More... | |
Typedefs | |
typedef struct _MG_RWops | MG_RWops |
Functions | |
MG_EXPORT MG_RWops * | MGUI_RWFromFile (const char *file, const char *mode) |
Creates an MG_RWops object from a file. More... | |
MG_EXPORT MG_RWops * | MGUI_RWFromFP (FILE *fp, int autoclose) |
Creates an MG_RWops object from an opened stdio FILE object. More... | |
MG_EXPORT MG_RWops * | MGUI_RWFromMem (void *mem, size_t size) |
Creates an MG_RWops object from a block of memory. More... | |
MG_EXPORT void | MGUI_InitMemRW (MG_RWops *area, void *mem, size_t size) |
Initializes an MG_RWops object from a block of memory. More... | |
MG_EXPORT MG_RWops * | MGUI_AllocRW (void) |
Allocates an uninitialized MG_RWops object. More... | |
MG_EXPORT void | MGUI_FreeRW (MG_RWops *area) |
Frees an MG_RWops object. More... | |
MG_EXPORT int | MGUI_RWgetc (MG_RWops *area) |
Reads the next character from an data source. More... | |
MiniGUI's general read/write operation provides a general interface to read from and write to various data source, such as files, memory, and so on.
#define MGUI_RWclose | ( | ctx | ) | (ctx)->close(ctx) |
Closes an MG_RWops object.
This macro close the MG_RWops object pointed to by ctx.
ctx | The pointer to the MG_RWops object. |
Definition at line 359 of file endianrw.h.
#define MGUI_RWeof | ( | ctx | ) | (ctx)->eof(ctx) |
Tests the end-of-file indicator for an data source.
This macro tests the end-of-file indicator for the data source pointed to by ctx.
ctx | The pointer to the MG_RWops object. |
Definition at line 374 of file endianrw.h.
#define MGUI_RWread | ( | ctx, | |
ptr, | |||
size, | |||
n | |||
) | (ctx)->read(ctx, ptr, size, n) |
Reads data blocks from a data source.
This macro reads up to n objects each of size size from the data source ctx to the area pointed to by ptr.
ctx | The pointer to the MG_RWops object. |
ptr | The buffer will save the data read. |
size | The size of each object. |
n | The number of objects to be read. |
Definition at line 327 of file endianrw.h.
#define MGUI_RWseek | ( | ctx, | |
offset, | |||
whence | |||
) | (ctx)->seek(ctx, offset, whence) |
Seeks an MG_RWops object.
This macro seeks to offset relative to whence.
ctx | The pointer to the MG_RWops object. |
offset | The offset relative to whence. |
whence | One of stdio's whence values: - SEEK_SET\n the offset is relative to the start of the file. - SEEK_CUR\n the offset is relative to the current position indicator. - SEEK_END\n the offset is relative to the end of the file. |
Definition at line 295 of file endianrw.h.
#define MGUI_RWtell | ( | ctx | ) | (ctx)->seek(ctx, 0, SEEK_CUR) |
Obtains the current value of the position indicator for a data source.
This macro obtains the current value of the position indicator for the data source pointed to by ctx.
ctx | The pointer to the MG_RWops object. |
Definition at line 310 of file endianrw.h.
#define MGUI_RWwrite | ( | ctx, | |
ptr, | |||
size, | |||
n | |||
) | (ctx)->write(ctx, ptr, size, n) |
Writes data blocks to a data source.
This macro writes exactly n objects each of size size from the area pointed to by ptr to the data source ctx.
ctx | The pointer to the MG_RWops object. |
ptr | The buffer contains the data to be written. |
size | The size of each object. |
n | The number of objects to be written. |
Definition at line 344 of file endianrw.h.
MG_RWops * MGUI_AllocRW | ( | void | ) |
Allocates an uninitialized MG_RWops object.
This function allocates an uninitialized MG_RWops object. You can specify the fields of the structure, and implemente a customized MG_RWops object.
void MGUI_FreeRW | ( | MG_RWops * | area | ) |
Frees an MG_RWops object.
This function frees the MG_RWops object pointed to by area.
area | The pointer to the MG_RWops object. |
void MGUI_InitMemRW | ( | MG_RWops * | area, |
void * | mem, | ||
size_t | size | ||
) |
Initializes an MG_RWops object from a block of memory.
This function initializes an MG_RWops object pointed to by area from a block of memory pointed to by mem, which is size bytes long.
area | The pointer to the MG_RWops object. |
mem | The pointer to the memory block. |
size | The size of the memory block. |
MG_RWops * MGUI_RWFromFile | ( | const char * | file, |
const char * | mode | ||
) |
Creates an MG_RWops object from a file.
This function uses the mode specified by mode and opens the file file by using stdio function fopen. If success, this function creates a MG_RWops object and returns it.
file | The file name. |
mode | The mode will be passed to fopen. |
MG_RWops * MGUI_RWFromFP | ( | FILE * | fp, |
int | autoclose | ||
) |
Creates an MG_RWops object from an opened stdio FILE object.
This function uses an opened stdio FILE object fp to create a MG_RWops object.
fp | The opened stdio FILE object. |
autoclose | Indicates whether to close the FILE object when close method is called. |
MG_RWops * MGUI_RWFromMem | ( | void * | mem, |
size_t | size | ||
) |
Creates an MG_RWops object from a block of memory.
This function creates an MG_RWops object from a block of memory pointed to by mem, which is size bytes long.
mem | The pointer to the memory block. |
size | The size of the memory block. |
int MGUI_RWgetc | ( | MG_RWops * | area | ) |
Reads the next character from an data source.
This function reads the next character from the data source pointed to by area, and returns it as an unsigned char cast to an int, or EOF on end of file or error.
area | The pointer to the MG_RWops object. |