| 1 |
package plist |
| 2 |
|
| 3 |
import ( |
| 4 |
"reflect" |
| 5 |
) |
| 6 |
|
| 7 |
|
| 8 |
const ( |
| 9 |
|
| 10 |
InvalidFormat int = 0 |
| 11 |
|
| 12 |
|
| 13 |
AutomaticFormat = 0 |
| 14 |
|
| 15 |
XMLFormat = 1 |
| 16 |
BinaryFormat = 2 |
| 17 |
OpenStepFormat = 3 |
| 18 |
GNUStepFormat = 4 |
| 19 |
) |
| 20 |
|
| 21 |
var FormatNames = map[int]string{ |
| 22 |
InvalidFormat: "unknown/invalid", |
| 23 |
XMLFormat: "XML", |
| 24 |
BinaryFormat: "Binary", |
| 25 |
OpenStepFormat: "OpenStep", |
| 26 |
GNUStepFormat: "GNUStep", |
| 27 |
} |
| 28 |
|
| 29 |
type unknownTypeError struct { |
| 30 |
typ reflect.Type |
| 31 |
} |
| 32 |
|
| 33 |
func (u *unknownTypeError) Error() string { |
| 34 |
return "plist: can't marshal value of type " + u.typ.String() |
| 35 |
} |
| 36 |
|
| 37 |
type invalidPlistError struct { |
| 38 |
format string |
| 39 |
err error |
| 40 |
} |
| 41 |
|
| 42 |
func (e invalidPlistError) Error() string { |
| 43 |
s := "plist: invalid " + e.format + " property list" |
| 44 |
if e.err != nil { |
| 45 |
s += ": " + e.err.Error() |
| 46 |
} |
| 47 |
return s |
| 48 |
} |
| 49 |
|
| 50 |
type plistParseError struct { |
| 51 |
format string |
| 52 |
err error |
| 53 |
} |
| 54 |
|
| 55 |
func (e plistParseError) Error() string { |
| 56 |
s := "plist: error parsing " + e.format + " property list" |
| 57 |
if e.err != nil { |
| 58 |
s += ": " + e.err.Error() |
| 59 |
} |
| 60 |
return s |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
type UID uint64 |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
type Marshaler interface { |
| 73 |
MarshalPlist() (interface{}, error) |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
type Unmarshaler interface { |
| 82 |
UnmarshalPlist(unmarshal func(interface{}) error) error |
| 83 |
} |