CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches

Modules

 File Producers
 
 File Consumers
 

Macros

#define sbufFSFileIn(sb, file, close)   sbufFileIn(sb, file, close)
 
#define sbufFSFilePRegisterPull(sb, file, close)   sbufFilePRegisterPull(sb, file, close)
 
#define sbufFSFileOut(sb, file, close)   sbufFileOut(sb, file, close)
 
#define sbufFSFileCRegisterPush(sb, file, close)   sbufFileCRegisterPush(sb, file, close)
 

Detailed Description

Adapters for using files as stream buffer producers and consumers.

These functions provide convenient ways to read from or write to files using the stream buffer abstraction, supporting both push and pull modes. They take any File, so it does not matter whether the file came from fsOpen() or vfsOpen().

Producer (Input) Functions:

Consumer (Output) Functions:

Every one of them takes any File – an FSFile from fsOpen() or a VFSFile from vfsOpen() – with no cast at the call site.

Where close is true, the file is closed and its reference released, the same as fileClose() would. The handle must not be used again after that.

The two register functions attach the file to the stream buffer and return; their callbacks run later, whenever the buffer is driven and on whichever thread drives it. Each of them holds a reference to the file for as long as it stays attached, so releasing your own reference after registering is safe – the file goes away when the registration does. A file handle is still single-owner while it is registered: nothing else may read, write or seek it until the slot has been handed back.

Macro Definition Documentation

◆ sbufFSFileCRegisterPush

#define sbufFSFileCRegisterPush (   sb,
  file,
  close 
)    sbufFileCRegisterPush(sb, file, close)

bool sbufFSFileCRegisterPush(StreamBuffer *sb, FSFile *file, bool close)

Another name for sbufFileCRegisterPush(), for a file opened with fsOpen()

Definition at line 168 of file sbfile.h.

◆ sbufFSFileIn

#define sbufFSFileIn (   sb,
  file,
  close 
)    sbufFileIn(sb, file, close)

bool sbufFSFileIn(StreamBuffer *sb, FSFile *file, bool close)

Another name for sbufFileIn(), for a file opened with fsOpen()

Definition at line 153 of file sbfile.h.

◆ sbufFSFileOut

#define sbufFSFileOut (   sb,
  file,
  close 
)    sbufFileOut(sb, file, close)

bool sbufFSFileOut(StreamBuffer *sb, FSFile *file, bool close)

Another name for sbufFileOut(), for a file opened with fsOpen()

Definition at line 163 of file sbfile.h.

◆ sbufFSFilePRegisterPull

#define sbufFSFilePRegisterPull (   sb,
  file,
  close 
)    sbufFilePRegisterPull(sb, file, close)

bool sbufFSFilePRegisterPull(StreamBuffer *sb, FSFile *file, bool close)

Another name for sbufFilePRegisterPull(), for a file opened with fsOpen()

Definition at line 158 of file sbfile.h.