4.3 API/FcitxConfig

From Fcitx
Revision as of 20:21, 22 April 2013 by Weng Xuetian (talk | contribs) (Created page with "This is only draft, feel free to improve. Rename FcitxConfigFile -> FcitxConfig <pre> <nowiki> // backend typedef FcitxConfigDesc* (*FcitxConfigDescGet)(void* arg, const cha...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is only draft, feel free to improve.

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