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...")
 
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)
 +
 +
 +
= Draft =
  
 
Rename FcitxConfigFile -> FcitxConfig
 
Rename FcitxConfigFile -> FcitxConfig

Revision as of 20:24, 22 April 2013

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)


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