Debian Codegraph @

plist.go

raw symbols SCIP
1 package plist
2
3 import (
4 "reflect"
5 )
6
7 // Property list format constants
8 const (
9 // Used by Decoder to represent an invalid property list.
10 InvalidFormat int = 0
11
12 // Used to indicate total abandon with regards to Encoder's output format.
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 // A UID represents a unique object identifier. UIDs are serialized in a manner distinct from
64 // that of integers.
65 type UID uint64
66
67 // Marshaler is the interface implemented by types that can marshal themselves into valid
68 // property list objects. The returned value is marshaled in place of the original value
69 // implementing Marshaler
70 //
71 // If an error is returned by MarshalPlist, marshaling stops and the error is returned.
72 type Marshaler interface {
73 MarshalPlist() (interface{}, error)
74 }
75
76 // Unmarshaler is the interface implemented by types that can unmarshal themselves from
77 // property list objects. The UnmarshalPlist method receives a function that may
78 // be called to unmarshal the original property list value into a field or variable.
79 //
80 // It is safe to call the unmarshal function more than once.
81 type Unmarshaler interface {
82 UnmarshalPlist(unmarshal func(interface{}) error) error
83 }