tags:

views:

285

answers:

2

I'm tasked with reading Apple's property list files within a c++ application. Focusing primarily on the xml-type plist files specified in OS X, which mimic a xml-type implementation.. Apple's implementation of their property list is described here:

http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/plist.5.html

I'm wondering if there are classes or libraries available that already can read this type of implementation within standard c++ (not Objective-C); hoping to find something rather than rolling our own. Are there any open-source implementations of this available?

A: 

PList files are not only mimicing XML, they are XML, including valid XML headers.

Any XML reader should be able to parse these files as a result. If you're looking for a logical class that abstracts the files, I'm not aware of any existing ones. Given Apple's documentation, you should be able to write one yourself with an XML reader, although it would take some work for full compatibility.

Will Eddins
Apple have a binary, compressed .plist format also.
RedGlyph
External dlls was not an option.. However it did validate, and we were able to use TinyXml to parse the plist file and manually throw the key/value pairs into a data structure..
werelord
A: 

Is that target-specific?

For Windows, there is a crude solution which consists of using the functions of iTunes dynamic libraries to parse plist files (either binary or plain text format work).

That's a code originally written to interface an iPod, but you can easily extract the few functions you are interested in.

The repository is on this project page: http://code.google.com/p/t-pot/

Look for the file iPoTApi.h and iPoTApi.cpp, the function TranslatePLIST of the class CiPoTApi.

I wish there were a better solution, at the time I tried to compile it from Apple's sources targeted at Windows but it is a real nightmare, and files are missing. So using their libraries was a considerable shortcut.

RedGlyph