Difference between revisions of "4.3 API/FcitxConfig"

From Fcitx
Jump to navigation Jump to search
(Created page with "This is only draft, feel free to improve. Rename FcitxConfigFile -> FcitxConfig <pre> <nowiki> // backend typedef FcitxConfigDesc* (*FcitxConfigDescGet)(void* arg, const cha...")
 
m (4 revisions imported)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This is only draft, feel free to improve.
 
This is only draft, feel free to improve.
 +
 +
= Comment =
 +
 +
merge argument is very ugly, any idea about how to improve? [[User:Weng Xuetian|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. [[User:Weng Xuetian|Weng Xuetian]] 16:29, 22 April 2013 (EDT)
 +
 +
= Draft =
  
 
Rename FcitxConfigFile -> FcitxConfig
 
Rename FcitxConfigFile -> FcitxConfig

Latest revision as of 22:42, 2 February 2016

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);