以纯C版本的, CF-855.11中的CFPropertyList.c为例
完成了CoreFoundation对plist的支持的需求, 使用CF对象来作描述. 题主想了解高级的解析, 个人觉得这个实现是比较不错的了, 做过性能测试, 很给力. 代码也算通俗易懂, 带有一定的注释, 不二选择.虽然不短(3000行+, 但是就是跑的快(
这个实现忘记来源了, 不长 直接贴吧,
(nsuser(:import(org.apache.commons.codec.binaryBase64)(org.joda.timeDateTime))(:requireclojure.xml))(defn-first-content[c](first(c:content)))(defmulticontent(fn[c](c:tag)))(defmethodcontent:array[c](apply vector(for[item(c:content)](trampolinecontentitem))))(defmethodcontent:data[c](.decode(Base64.)(first-contentc)))(defmethodcontent:date[c](DateTime.(first-contentc)))(defmethodcontent:dict[c](apply hash-map(for[item(c:content)](trampolinecontentitem))))(defmethodcontent:false[c]false)(defmethodcontent:integer[c](Long.(first-contentc)))(defmethodcontent:key[c](first-contentc))(defmethodcontent:real[c](Double.(first-contentc)))(defmethodcontent:string[c](first-contentc))(defmethodcontent:true[c]true)(defnparse-plist[source](trampolinecontent(first-content(clojure.xml/parsesource))))(defnfile-content[file-path](java.io.File.file-path))