From 340d597440f27ac7c7ad7a9493cc7cad46ba48c5 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Thu, 23 Apr 2020 15:55:03 +0200 Subject: Add cc4group.setEntryNameMatchingCallback --- src/cc4group.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/cc4group.h') diff --git a/src/cc4group.h b/src/cc4group.h index 4bcec34..25f3c53 100644 --- a/src/cc4group.h +++ b/src/cc4group.h @@ -180,6 +180,12 @@ typedef bool (*CC4Group_WriteCallback)(const void* const data, size_t const size typedef void (*CC4Group_WarningCallback)(const CC4Group* const group, const char* const format, ...); +// callback type for entry name matching +// must return 0 on match, non-zero otherwise +// query is the querying string passed in by the application, name is the candidate name +// query will be path-components of the actually queried path, determined by '/' +typedef int (*CC4Group_EntryNameMatchingCallback)(const char* query, const char* name); + // this is the main API struct of cc4group // it contains all available methods and constants typedef struct { @@ -225,6 +231,12 @@ typedef struct { // this will affect all groups in any state void (*setWarningCallback)(const CC4Group_WarningCallback callback); + // sets the global entry name comparison callback + // strcmp is the default callback; it can be restored by calling setEntryNameMatchingCallback with callback as NULL + // NOTE: this is a static method (i.e. it is used without any object) + // this will affect all groups in any state + void (*setEntryNameMatchingCallback)(const CC4Group_EntryNameMatchingCallback callback); + // allocates and initializes a new group object, like the operator new // NULL may be returned if the memory allocation (malloc) fails; in this case errno contains additional error information @@ -468,3 +480,4 @@ extern CC4Group_API cc4group; #undef new #undef delete #endif + -- cgit v1.2.3-54-g00ecf