summaryrefslogtreecommitdiffstats
path: root/src/cc4group.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cc4group.h')
-rw-r--r--src/cc4group.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cc4group.h b/src/cc4group.h
index cc04a4f..76a0970 100644
--- a/src/cc4group.h
+++ b/src/cc4group.h
@@ -37,6 +37,10 @@ typedef void* (*CC4Group_TmpMemoryStrategy)(CC4Group* const this, const size_t s
// the pointer passed in will be handled as specified with the corresponding MemoryManagement
typedef bool (*CC4Group_ReadCallback)(const void** const data, size_t* const size, void* const arg);
+// can be used as initialization before and deinitialization after all necessary calls to a read callback are made; for instance for buffer allocation and deletion
+// the callback should return true on success and false on failure
+typedef bool (*CC4Group_ReadSetupCallback)(void* const arg);
+
typedef struct {
CC4Group* (*new)(void);
bool (*create)(CC4Group* const this);
@@ -60,8 +64,8 @@ typedef struct {
// the file must have been opened with read access; also be aware that the file must be opened with binary mode on windows
bool (*openFilePointer)(CC4Group* const this, FILE* fd);
- // opens a group and calls the callback to get the group data
- bool (*openWithReadCallback)(CC4Group* const this, CC4Group_ReadCallback const callback, void* const callbackArg, int const memoryManagement);
+ // opens a group and calls the callback to get the group data; initCallback is called before readCallback is called and deinitCallback is called after all read operations are done; initCallback and deinitCallback may be NULL if they should not be used
+ bool (*openWithReadCallback)(CC4Group* const this, CC4Group_ReadCallback const readCallback, void* const callbackArg, int const memoryManagement, CC4Group_ReadSetupCallback const initCallback, CC4Group_ReadSetupCallback const deinitCallback);
bool (*save)(CC4Group* const this, const char* const path);
bool (*saveOverwrite)(CC4Group* const this, const char* const path);