Hi Zhoulei, On Mar 20, 2012, at 10:31 , zhou lei wrote:
> We can find "snowwhite" in the doc of the libsynthesis, and in the file named > "dbapi.cpp" we can find it too. This is the C++ branch of things, it is not relevant for iOS (except maybe for general understanding of how the library works on other platforms). > And from the demo for IOS, We can find out that, in cocoa, the lib would > using the code in "dbplugin_cocoa.m". dbplugin_cocoa.m is the wrapper code that handles the somewhat tricky interface between C and ObjC for you. No need to edit this. The actual plugin code to write will go into sample_dbplugin1.mm (2,3,4...). All you need to do is implementing the following methods: - (TSyError)startDataReadWithLastToken:(cAppCharP)aLastToken andResumeToken:(cAppCharP)aResumeToken; - (TSyError)readNextItemAsKey:(SettingsKey *)aItemKey itemIdP:(NSString **)aItemIdP parentIdP:(NSString **)aParentIdP statusP:(sInt32 *)aStatusP isFirst:(BOOL)aFirst; - (TSyError)readItemAsKey:(SettingsKey *)aItemKey itemID:(NSString *)aItemID parentID:(NSString *)aParentID; - (TSyError)endDataRead; - (TSyError)startDataWrite; - (TSyError)insertItemAsKey:(SettingsKey *)aItemKey parentID:(NSString *)aParentID newItemIdP:(NSString **)aNewItemIdP; - (TSyError)updateItemAsKey:(SettingsKey *)aItemKey itemIdP:(NSString **)aItemIdP parentIdP:(NSString **)aParentIdP; - (TSyError)deleteItem:(NSString *)aItemID parentID:(NSString *)aParentID; - (TSyError)endDataWriteWithSuccess:(BOOL)aSuccess andNewToken:(NSString **)aNewTokenP; ...plus maybe some of the optional methods if you have advanced features like filtering (but probably not to start with). These are semantically 1:1 representations in ObjC of the functions you find described in more detail in doc/SDK_manual.pdf and also in the C++ samples. Because of the work the wrapper code does for you, it is only a small subset of what the C plugin ABI consists of. Things like module/db context creation/deletion is done in the wrapper. One important note: the Cocoa wrapper code only uses the "AsKey" variants from the plugin API. This means that rather than passing items as text strings, a SettingsKey object is passed, on which you can call methods like stringValueByName: / setStringValueByName:toValue: to access individual fields (see SettingsKey.h for all available access methods). Note that this is the same mechanism as for accessing settings, and you'll find examples for SettingsKey usage in the sample iOS app. Best Regards, Lukas Zeller, plan44.ch l...@plan44.ch - www.plan44.ch _______________________________________________ os-libsynthesis mailing list os-libsynthesis@synthesis.ch http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis