File: text_tables.go

package info (click to toggle)
golang-github-dhowett-go-plist 0.0~git20181124.0.591f970-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 376 kB
  • sloc: makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package plist

type characterSet [4]uint64

func (s *characterSet) Contains(ch rune) bool {
	return ch >= 0 && ch <= 255 && s.ContainsByte(byte(ch))
}

func (s *characterSet) ContainsByte(ch byte) bool {
	return (s[ch/64]&(1<<(ch%64)) > 0)
}

// Bitmap of characters that must be inside a quoted string
// when written to an old-style property list
// Low bits represent lower characters, and each uint64 represents 64 characters.
var gsQuotable = characterSet{
	0x78001385ffffffff,
	0xa800000138000000,
	0xffffffffffffffff,
	0xffffffffffffffff,
}

// 7f instead of 3f in the top line: CFOldStylePlist.c says . is valid, but they quote it.
var osQuotable = characterSet{
	0xf4007f6fffffffff,
	0xf8000001f8000001,
	0xffffffffffffffff,
	0xffffffffffffffff,
}

var whitespace = characterSet{
	0x0000000100003f00,
	0x0000000000000000,
	0x0000000000000000,
	0x0000000000000000,
}

var newlineCharacterSet = characterSet{
	0x0000000000002400,
	0x0000000000000000,
	0x0000000000000000,
	0x0000000000000000,
}