-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaddressbook.js
173 lines (173 loc) · 4.23 KB
/
addressbook.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// This file has been automatically generated by capnp-es.
import * as $ from "capnp-es";
export const _capnpFileId = BigInt("0xef1b5abe02e1f8d4");
export const Person_PhoneNumber_Type = {
MOBILE: 0,
HOME: 1,
WORK: 2
};
export class Person_PhoneNumber extends $.Struct {
static Type = Person_PhoneNumber_Type;
static _capnp = {
displayName: "PhoneNumber",
id: "af663da31c027e0e",
size: new $.ObjectSize(8, 1)
};
get number() {
return $.utils.getText(0, this);
}
set number(value) {
$.utils.setText(0, value, this);
}
get type() {
return $.utils.getUint16(0, this);
}
set type(value) {
$.utils.setUint16(0, value, this);
}
toString() {
return "Person_PhoneNumber_" + super.toString();
}
}
export const Person_Employment_Which = {
UNEMPLOYED: 0,
EMPLOYER: 1,
SCHOOL: 2,
SELF_EMPLOYED: 3
};
export class Person_Employment extends $.Struct {
static UNEMPLOYED = Person_Employment_Which.UNEMPLOYED;
static EMPLOYER = Person_Employment_Which.EMPLOYER;
static SCHOOL = Person_Employment_Which.SCHOOL;
static SELF_EMPLOYED = Person_Employment_Which.SELF_EMPLOYED;
static _capnp = {
displayName: "employment",
id: "e88780a90af3da0c",
size: new $.ObjectSize(8, 4)
};
get _isUnemployed() {
return $.utils.getUint16(4, this) === 0;
}
set unemployed(_) {
$.utils.setUint16(4, 0, this);
}
get employer() {
$.utils.testWhich("employer", $.utils.getUint16(4, this), 1, this);
return $.utils.getText(3, this);
}
get _isEmployer() {
return $.utils.getUint16(4, this) === 1;
}
set employer(value) {
$.utils.setUint16(4, 1, this);
$.utils.setText(3, value, this);
}
get school() {
$.utils.testWhich("school", $.utils.getUint16(4, this), 2, this);
return $.utils.getText(3, this);
}
get _isSchool() {
return $.utils.getUint16(4, this) === 2;
}
set school(value) {
$.utils.setUint16(4, 2, this);
$.utils.setText(3, value, this);
}
get _isSelfEmployed() {
return $.utils.getUint16(4, this) === 3;
}
set selfEmployed(_) {
$.utils.setUint16(4, 3, this);
}
toString() {
return "Person_Employment_" + super.toString();
}
which() {
return $.utils.getUint16(4, this);
}
}
export class Person extends $.Struct {
static PhoneNumber = Person_PhoneNumber;
static _capnp = {
displayName: "Person",
id: "d94307c4985be8e7",
size: new $.ObjectSize(8, 4)
};
static _Phones;
get id() {
return $.utils.getUint32(0, this);
}
set id(value) {
$.utils.setUint32(0, value, this);
}
get name() {
return $.utils.getText(0, this);
}
set name(value) {
$.utils.setText(0, value, this);
}
get email() {
return $.utils.getText(1, this);
}
set email(value) {
$.utils.setText(1, value, this);
}
_adoptPhones(value) {
$.utils.adopt(value, $.utils.getPointer(2, this));
}
_disownPhones() {
return $.utils.disown(this.phones);
}
get phones() {
return $.utils.getList(2, Person._Phones, this);
}
_hasPhones() {
return !$.utils.isNull($.utils.getPointer(2, this));
}
_initPhones(length) {
return $.utils.initList(2, Person._Phones, length, this);
}
set phones(value) {
$.utils.copyFrom(value, $.utils.getPointer(2, this));
}
get employment() {
return $.utils.getAs(Person_Employment, this);
}
_initEmployment() {
return $.utils.getAs(Person_Employment, this);
}
toString() {
return "Person_" + super.toString();
}
}
export class AddressBook extends $.Struct {
static _capnp = {
displayName: "AddressBook",
id: "c06ea6d038a357bb",
size: new $.ObjectSize(0, 1)
};
static _People;
_adoptPeople(value) {
$.utils.adopt(value, $.utils.getPointer(0, this));
}
_disownPeople() {
return $.utils.disown(this.people);
}
get people() {
return $.utils.getList(0, AddressBook._People, this);
}
_hasPeople() {
return !$.utils.isNull($.utils.getPointer(0, this));
}
_initPeople(length) {
return $.utils.initList(0, AddressBook._People, length, this);
}
set people(value) {
$.utils.copyFrom(value, $.utils.getPointer(0, this));
}
toString() {
return "AddressBook_" + super.toString();
}
}
Person._Phones = $.CompositeList(Person_PhoneNumber);
AddressBook._People = $.CompositeList(Person);