4.3 API/FcitxConfig
This is only draft, feel free to improve.
Comment
merge argument is very ugly, any idea about how to improve? Weng Xuetian 16:24, 22 April 2013 (EDT)
New Data Type comment are also welcome, seems at least we need something like list, map. And in order to make it much more useful, some dynamic technics maybe also needed, like option is fetched on runtime. And seems we also need a "input method -> value" map.
Also, maybe binary type with base64? Though I don't have a good use case for this. Weng Xuetian 16:29, 22 April 2013 (EDT)
Draft
Rename FcitxConfigFile -> FcitxConfig
// backend typedef FcitxConfigDesc* (*FcitxConfigDescGet)(void* arg, const char* name); typedef FcitxConfig* (*FcitxConfigGet)(void* arg, const char* path, const char* name, boolean merge); typedef FcitxConfig** (*FcitxConfigGetMulti)(void* arg, const char* path, const char* prefix, const char* suffix, boolean merge); typedef struct _FcitxConfigBackend { void *data; FcitxConfigDescGet descGet; FcitxConfigGet configGet; FcitxConfigGetMulti configGetMulti; FcitxDestroyNotify destroyData; FcitxCallBack padding1; FcitxCallBack padding2; FcitxCallBack padding3; FcitxCallBack padding4; FcitxCallBack padding5; FcitxCallBack padding6; FcitxCallBack padding7; FcitxCallBack padding8; } FcitxConfigBackend; // configmanager, keep desc cache, and parse new config typedef struct _FcitxConfigManager FcitxConfigManager; FcitxConfigManager* FcitxConfigManagerCreate(FcitxConfigBackend* backend); boolean FcitxConfigManagerLoad(FcitxConfigManager* manager, const char* path, const char* name, const char* configDescName, boolean merge, FcitxGenericConfig* config); void FcitxConfigManagerSave(FcitxConfigManager* manager, const char* name, const char* configdesc, FcitxGenericConfig* config); void FcitxConfigManagerDestroy(FcitxConfigManager* manager);