The cl-apple-plist Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-apple-plist Reference Manual

This is the cl-apple-plist Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:27:54 2022 GMT+0.

Table of Contents


1 Introduction

cl-apple-plist

Encodes Common Lisp data structures in Apple property list XML format (.plist).

Released under a BSD style license.

Introduction

When building Apple IOS applications, it's convenient to use .plist files to store reference data.

About Property Lists

Rather than maintain plist files by hand or using Xcode, I've found it useful to create Lisp data structures as s-expressions and then use this library to export to .plist files.

Notes

Lists are encoded as array tags, number as integer or real and t and nil map to true and false respectively.

CL-USER> (encode-apple-plist (list "hello" "world" 1 2.89 t nil))
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>hello</string>
<string>world</string>
<integer>1</integer>
<real>2.89</real>
<true/>
<false/>
</array>
</plist>
NIL

Hash tables become dict tags.

 CL-USER> (let ((h (make-hash-table))) (setf (gethash 1 h) "one") (encode-apple-plist h))
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
 <key>1</key><string>one</string>
 </dict>
 </plist>
 NIL

encode-apple-plist takes an optional stream argument, but encode-apple-plist-to-file(data filename) is a convenenience function that writes the plist to a file.

CL-USER> (encode-apple-plist-to-file ((list "1" "2") "myfile.plist"))

Strings are HTML-encoded using the html-encode library.

There is currently no support for date tags, partly because Lisp dates are stored as integers rather than arecognizable date type. Ideas welcome.

There is currently no support for data tags. Ideas welcome.

Should BITs be mapped to true and false or 0 and 1?

Rob Blackwell

October 2011


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-apple-plist

Encodes Common Lisp data structures in Apple property list XML format (.plist).

Author

Rob Blackwell

Version

0.1

Dependency

html-encode (system).

Source

cl-apple-plist.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 cl-apple-plist/cl-apple-plist.asd

Source

cl-apple-plist.asd.

Parent Component

cl-apple-plist (system).

ASDF Systems

cl-apple-plist.


3.1.2 cl-apple-plist/package.lisp

Source

cl-apple-plist.asd.

Parent Component

cl-apple-plist (system).

Packages

cl-apple-plist.


3.1.3 cl-apple-plist/plist.lisp

Dependency

package.lisp (file).

Source

cl-apple-plist.asd.

Parent Component

cl-apple-plist (system).

Public Interface
Internals

encode-apple-plist-node (generic function).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 cl-apple-plist

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

encode-apple-plist-node (generic function).


5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: encode-apple-plist (object &optional stream)

Encodes the given data structure in Apple plist XML format

Package

cl-apple-plist.

Source

plist.lisp.

Function: encode-apple-plist-to-file (object filename)

Encodes the given data structure in Apple plist XML format which is written to the given file

Package

cl-apple-plist.

Source

plist.lisp.


5.2 Internals


Previous: , Up: Internals   [Contents][Index]

5.2.1 Generic functions

Generic Function: encode-apple-plist-node (object &optional stream)

Encodes the given object as a plist XML node

Package

cl-apple-plist.

Source

plist.lisp.

Methods
Method: encode-apple-plist-node ((self hash-table) &optional stream)

Encodes a hastable as a dict node in plist format

Method: encode-apple-plist-node ((self (eql nil)) &optional stream)

Encodes nil as a false node in plist format

Method: encode-apple-plist-node ((self (eql t)) &optional stream)

Encodes t as a true node in plist format

Method: encode-apple-plist-node ((self float) &optional stream)

Encodes a float in plist format

Method: encode-apple-plist-node ((self integer) &optional stream)

Encodes an integer in plist format

Method: encode-apple-plist-node ((self string) &optional stream)

Encodes a string in plist format

Method: encode-apple-plist-node ((self vector) &optional stream)

Encodes a vector as an array node in plist format

Method: encode-apple-plist-node ((self cons) &optional stream)

Encodes a list as an array node in plist format


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables