summaryrefslogtreecommitdiffstats
path: root/src/cc4group.h
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2020-04-23 15:55:03 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2020-04-23 15:59:48 +0200
commit340d597440f27ac7c7ad7a9493cc7cad46ba48c5 (patch)
treeaf746826786e26a96369381f6a427597e1270473 /src/cc4group.h
parent2288b901243d626b106fb45293d39d32006b04aa (diff)
downloadcc4group-340d597440f27ac7c7ad7a9493cc7cad46ba48c5.tar.gz
cc4group-340d597440f27ac7c7ad7a9493cc7cad46ba48c5.zip
Add cc4group.setEntryNameMatchingCallback
Diffstat (limited to 'src/cc4group.h')
-rw-r--r--src/cc4group.h13
1 files changed, 13 insertions, 0 deletions
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
+