zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_rwops.h File Reference
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Classes

struct  SDL_RWops
 

Macros

#define RW_SEEK_CUR   1
 
#define RW_SEEK_END   2
 
#define RW_SEEK_SET   0
 
#define SDL_RWOPS_JNIFILE   3 /* Android asset */
 
#define SDL_RWOPS_MEMORY   4 /* Memory stream */
 
#define SDL_RWOPS_MEMORY_RO   5 /* Read-Only memory stream */
 
#define SDL_RWOPS_STDFILE   2 /* Stdio file */
 
#define SDL_RWOPS_UNKNOWN   0 /* Unknown stream type */
 
#define SDL_RWOPS_WINFILE   1 /* Win32 file */
 
Read/write macros

Macros to easily read and write from an SDL_RWops structure.

#define SDL_RWsize(ctx)   (ctx)->size(ctx)
 
#define SDL_RWseek(ctx, offset, whence)   (ctx)->seek(ctx, offset, whence)
 
#define SDL_RWtell(ctx)   (ctx)->seek(ctx, 0, RW_SEEK_CUR)
 
#define SDL_RWread(ctx, ptr, size, n)   (ctx)->read(ctx, ptr, size, n)
 
#define SDL_RWwrite(ctx, ptr, size, n)   (ctx)->write(ctx, ptr, size, n)
 
#define SDL_RWclose(ctx)   (ctx)->close(ctx)
 

Typedefs

typedef struct SDL_RWops SDL_RWops
 

Functions

DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW (void)
 
DECLSPEC void SDLCALL SDL_FreeRW (SDL_RWops *area)
 
RWFrom functions

Functions to create SDL_RWops structures from various data streams.

DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile (const char *file, const char *mode)
 
DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP (void *fp, SDL_bool autoclose)
 
DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem (void *mem, int size)
 
DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem (const void *mem, int size)
 
Read endian functions

Read an item of the specified endianness and return in native format.

DECLSPEC Uint8 SDLCALL SDL_ReadU8 (SDL_RWops *src)
 
DECLSPEC Uint16 SDLCALL SDL_ReadLE16 (SDL_RWops *src)
 
DECLSPEC Uint16 SDLCALL SDL_ReadBE16 (SDL_RWops *src)
 
DECLSPEC Uint32 SDLCALL SDL_ReadLE32 (SDL_RWops *src)
 
DECLSPEC Uint32 SDLCALL SDL_ReadBE32 (SDL_RWops *src)
 
DECLSPEC Uint64 SDLCALL SDL_ReadLE64 (SDL_RWops *src)
 
DECLSPEC Uint64 SDLCALL SDL_ReadBE64 (SDL_RWops *src)
 
Write endian functions

Write an item of native format to the specified endianness.

DECLSPEC size_t SDLCALL SDL_WriteU8 (SDL_RWops *dst, Uint8 value)
 
DECLSPEC size_t SDLCALL SDL_WriteLE16 (SDL_RWops *dst, Uint16 value)
 
DECLSPEC size_t SDLCALL SDL_WriteBE16 (SDL_RWops *dst, Uint16 value)
 
DECLSPEC size_t SDLCALL SDL_WriteLE32 (SDL_RWops *dst, Uint32 value)
 
DECLSPEC size_t SDLCALL SDL_WriteBE32 (SDL_RWops *dst, Uint32 value)
 
DECLSPEC size_t SDLCALL SDL_WriteLE64 (SDL_RWops *dst, Uint64 value)
 
DECLSPEC size_t SDLCALL SDL_WriteBE64 (SDL_RWops *dst, Uint64 value)
 

Detailed Description

This file provides a general interface for SDL to read and write data streams. It can easily be extended to files, memory, etc.

Definition in file SDL_rwops.h.

Macro Definition Documentation

#define RW_SEEK_CUR   1

Seek relative to current read point

Definition at line 175 of file SDL_rwops.h.

Referenced by mem_seek(), and SDL_LoadWAV_RW().

#define RW_SEEK_END   2

Seek relative to the end of data

Definition at line 176 of file SDL_rwops.h.

Referenced by mem_seek().

#define RW_SEEK_SET   0

Seek from the beginning of data

Definition at line 174 of file SDL_rwops.h.

Referenced by mem_seek(), SDL_LoadBMP_RW(), and SDL_SaveBMP_RW().

#define SDL_RWclose (   ctx)    (ctx)->close(ctx)

Definition at line 189 of file SDL_rwops.h.

Referenced by SDL_LoadBMP_RW(), SDL_LoadWAV_RW(), and SDL_SaveBMP_RW().

#define SDL_RWOPS_JNIFILE   3 /* Android asset */

Definition at line 45 of file SDL_rwops.h.

Referenced by SDL_RWFromFile().

#define SDL_RWOPS_MEMORY   4 /* Memory stream */

Definition at line 46 of file SDL_rwops.h.

Referenced by SDL_RWFromMem().

#define SDL_RWOPS_MEMORY_RO   5 /* Read-Only memory stream */

Definition at line 47 of file SDL_rwops.h.

Referenced by SDL_RWFromConstMem().

#define SDL_RWOPS_STDFILE   2 /* Stdio file */

Definition at line 44 of file SDL_rwops.h.

#define SDL_RWOPS_UNKNOWN   0 /* Unknown stream type */

Definition at line 42 of file SDL_rwops.h.

Referenced by SDL_AllocRW().

#define SDL_RWOPS_WINFILE   1 /* Win32 file */

Definition at line 43 of file SDL_rwops.h.

Referenced by SDL_RWFromFile().

#define SDL_RWread (   ctx,
  ptr,
  size,
  n 
)    (ctx)->read(ctx, ptr, size, n)
#define SDL_RWseek (   ctx,
  offset,
  whence 
)    (ctx)->seek(ctx, offset, whence)

Definition at line 185 of file SDL_rwops.h.

Referenced by SDL_LoadBMP_RW(), SDL_LoadWAV_RW(), and SDL_SaveBMP_RW().

#define SDL_RWsize (   ctx)    (ctx)->size(ctx)

Definition at line 184 of file SDL_rwops.h.

#define SDL_RWtell (   ctx)    (ctx)->seek(ctx, 0, RW_SEEK_CUR)

Definition at line 186 of file SDL_rwops.h.

Referenced by SDL_LoadBMP_RW(), and SDL_SaveBMP_RW().

#define SDL_RWwrite (   ctx,
  ptr,
  size,
  n 
)    (ctx)->write(ctx, ptr, size, n)

Typedef Documentation

typedef struct SDL_RWops SDL_RWops

This is the read/write operation structure – very basic.

Function Documentation

DECLSPEC void SDLCALL SDL_FreeRW ( SDL_RWops area)

Definition at line 637 of file SDL_rwops.c.

References SDL_free().

Referenced by mem_close(), and SDL_RWFromFile().

DECLSPEC Uint16 SDLCALL SDL_ReadBE16 ( SDL_RWops src)

Definition at line 663 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapBE16.

DECLSPEC Uint32 SDLCALL SDL_ReadBE32 ( SDL_RWops src)

Definition at line 681 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapBE32.

DECLSPEC Uint64 SDLCALL SDL_ReadBE64 ( SDL_RWops src)

Definition at line 699 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapBE64.

DECLSPEC Uint16 SDLCALL SDL_ReadLE16 ( SDL_RWops src)

Definition at line 654 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapLE16.

Referenced by SDL_LoadBMP_RW().

DECLSPEC Uint32 SDLCALL SDL_ReadLE32 ( SDL_RWops src)

Definition at line 672 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapLE32.

Referenced by ReadChunk(), SDL_LoadBMP_RW(), and SDL_LoadWAV_RW().

DECLSPEC Uint64 SDLCALL SDL_ReadLE64 ( SDL_RWops src)

Definition at line 690 of file SDL_rwops.c.

References SDL_RWread, and SDL_SwapLE64.

DECLSPEC Uint8 SDLCALL SDL_ReadU8 ( SDL_RWops src)

Definition at line 645 of file SDL_rwops.c.

References SDL_RWread.

DECLSPEC SDL_RWops* SDLCALL SDL_RWFromFP ( void fp,
SDL_bool  autoclose 
)

Definition at line 559 of file SDL_rwops.c.

References NULL, and SDL_SetError().

Referenced by SDL_RWFromFile().

DECLSPEC size_t SDLCALL SDL_WriteBE16 ( SDL_RWops dst,
Uint16  value 
)

Definition at line 721 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapBE16.

DECLSPEC size_t SDLCALL SDL_WriteBE32 ( SDL_RWops dst,
Uint32  value 
)

Definition at line 735 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapBE32.

DECLSPEC size_t SDLCALL SDL_WriteBE64 ( SDL_RWops dst,
Uint64  value 
)

Definition at line 749 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapBE64.

DECLSPEC size_t SDLCALL SDL_WriteLE16 ( SDL_RWops dst,
Uint16  value 
)

Definition at line 714 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapLE16.

Referenced by SDL_SaveBMP_RW().

DECLSPEC size_t SDLCALL SDL_WriteLE32 ( SDL_RWops dst,
Uint32  value 
)

Definition at line 728 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapLE32.

Referenced by SDL_SaveBMP_RW().

DECLSPEC size_t SDLCALL SDL_WriteLE64 ( SDL_RWops dst,
Uint64  value 
)

Definition at line 742 of file SDL_rwops.c.

References SDL_RWwrite, and SDL_SwapLE64.

DECLSPEC size_t SDLCALL SDL_WriteU8 ( SDL_RWops dst,
Uint8  value 
)

Definition at line 708 of file SDL_rwops.c.

References SDL_RWwrite.